Learn R Programming

SpatioTemporal (version 1.1.7)

calc.mu.B: Matrix Multiplication with Block Matrices

Description

Computes either the product between a block diagonal, square matrix iS and a block matrix X; the quadratic form of a block diagonal, square matrix, t(X)*iS*X; or a block matrix multiplied by a vector, X*alpha.

Usage

calc.mu.B(X, alpha)

calc.iS.X(X, iS)

calc.X.iS.X(X, iS.X)

Arguments

X

A list of m matrices with which to form the block matrix; each matrix should be p[i] - by - n.

alpha

A list of m vectors, with the i:th vector being of length p[i].

iS

A block diagonal, square matrix, with dm blocks each of size n - by - dn.

iS.X

Matrix containing the product of iS and X. Output from calc.iS.X.

Value

matrix containing iS*X, X'*iS*X, or X*alpha.

See Also

Other block matrix functions: blockMult, calc.FX, calc.FXtF2, calc.tFX, calc.tFXF, invCholBlock, makeCholBlock, makeSigmaB, makeSigmaNu, solveTriBlock

Other likelihood utility functions: loglikeSTdim, loglikeSTgetPars, loglikeSTnames

Examples

Run this code
# NOT RUN {
## Create a block diagonal matrix, ...
iS <- rbind(c(2,1,0,0), c(1,3,0,0),
            c(0,0,3,2), c(0,0,2,4))
## ... a block matrix ...
X <- list(matrix(c(1,2)), matrix(c(2,2,3,4),2,2))
## ... with alternative form, ...
Xt <- rbind(cbind(X[[1]], matrix(0,2,2)),
            cbind(matrix(0,2,1), X[[2]]))
## ... and a vector alpha.
alpha <- list(c(1), c(-2,1))

## Compute iS * X
iS.X <- calc.iS.X(X, iS)
## or
iS %*% Xt
# }
# NOT RUN {
## Compute X'* iS * X
calc.X.iS.X(X, iS.X)
## or
t(Xt) %*% iS %*% Xt
# }
# NOT RUN {
## Compute X* alpha
calc.mu.B(X, alpha)
## or
cbind(X[[1]] %*% alpha[[1]], X[[2]] %*% alpha[[2]])
# }

Run the code above in your browser using DataLab