crossprodV {mniw} | R Documentation |
Matrix cross-product.
Description
Vectorized matrix cross-products t(X) V Y
or t(X) V^{-1} Y
.
Usage
crossprodV(X, Y = NULL, V, inverse = FALSE)
Arguments
X |
A matrix of size |
Y |
A matrix of size |
V |
A matrix of size |
inverse |
Logical; whether or not the inner product should be calculated with |
Value
An array of size q x r x n
.
Examples
# problem dimensions
p <- 4
q <- 2
r <- 3
n <- 5
X <- array(rnorm(p*q*n), dim = c(p, q, n)) # vectorized
Y <- array(rnorm(p*r*n), dim = c(p, r, n)) # vectorized
V <- crossprod(matrix(rnorm(p*p), p, p)) # not vectorized (but positive definite)
crossprodV(X = X, V = V) # self cross-product
# cross-product with inverse matrix weight
crossprodV(X = X, V = V, Y = Y, inverse = TRUE)
[Package mniw version 1.0.1 Index]