getInvC | R Documentation |
Utility function that computes
(\Sigma^{-1} \mathbf{CC}
) where \Sigma
is a covariance matrix and
\mathbf{CC}
is the matrix of of covariances between the observed location and the locations to predict.
Optionally, the quadratic form
\mathbf{cc}^\top \Sigma^{-1} \mathbf{cc}
can be computed. Both dense and sparse matrix representations are supported.
getInvC(covmatrix, CC, mse = TRUE)
covmatrix |
A covariance matrix:
|
CC |
Numeric matrix to be multiplied by the inverse of the
covariance matrix (length must match the dimension of
|
mse |
Logical. If |
For dense matrices the function uses the Cholesky decomposition provided
by FastGP::rcppeigen_get_chol
.
For sparse matrices (class spam
) the factorisation is performed
with spam::chol.spam
.
If the covariance matrix is not positive definite an error is thrown.
A list with components
a
Numeric vector: the product
\Sigma^{-1} \mathbf{cc}
.
b
Numeric scalar: the quadratic form
\mathbf{cc}^\top \Sigma^{-1} \mathbf{cc}
(only if
mse = TRUE
).
Moreno Bevilacqua, moreno.bevilacqua@uai.cl
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.