Learn R Programming

maxstablePCA (version 0.1.2)

maxmatmul: Multiply two matrices with a matrix product that uses maxima instead of addition

Description

By calculating the entries with $$(A \diamond B)_{ij} = \max_{j=1,..., l} A_{il} B_{lj}$$ for appropriate dimensions. Note that this operation is particularly useful when working with multivariate exreme value distributions, because, if the margins are standardized to standard Fréchet margins, then the max-matrix product of a matrix A and a multivariate extreme value distribution Z with standard Fréchet margins has the same margins up to scaling.

Usage

maxmatmul(A, B)

Value

A non netgative array of dim n, l. The entries are given by the maximum of componentwise multiplication of rows from A and columns from B.

Arguments

A

a non-negative array of dim n, k

B

a non-negative array of dim k, l

Examples

Run this code
# Set up example matrices
A <- matrix(c(1,2,3,4,5,6), 2, 3)
B <- matrix(c(1,2,1,2,1,2), 3, 2)

# calling the function 
m1 <- maxmatmul(A, B)

# can be used for matrix-vector multiplication as well
v <- c(7,4,7)
m2 <- maxmatmul(A, v)
m3 <- maxmatmul(v,v)

Run the code above in your browser using DataLab