| dupl.cross {fastmatrix} | R Documentation |
Given the order of two duplication matrices and matrix x, this function performs
the operation: \bold{Y} = \bold{D}_n^T\bold{X}\bold{D}_k, where \bold{D}_n
and \bold{D}_k are duplication matrices of order n and k, respectively.
dupl.cross(n = 1, k = n, x = NULL)
n |
order of the duplication matrix used pre-multiplying |
k |
order of the duplication matrix used post-multiplying |
x |
numeric matrix, this argument is required. |
This function calls dupl.prod to performs the matrix multiplications required
but without forming any duplication matrices.
D2 <- duplication(n = 2, matrix = TRUE) D3 <- duplication(n = 3, matrix = TRUE) x <- matrix(1, nrow = 9, ncol = 4) y <- t(D3) %*% x %*% D2 z <- dupl.cross(n = 3, k = 2, x) # D2 and D3 are not stored all(z == y) # matrices y and z are equal! x <- matrix(1, nrow = 9, ncol = 9) z <- dupl.cross(n = 3, x = x) # same matrix is used to pre- and post-multiplying x z # print result