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)A list with components
aNumeric vector: the product \(\Sigma^{-1} \mathbf{cc}\).
bNumeric scalar: the quadratic form
\(\mathbf{cc}^\top \Sigma^{-1} \mathbf{cc}\) (only if
mse = TRUE).
A covariance matrix:
covmatrixA covariance matrix (dense or sparse).
sparseLogical scalar indicating whether the matrix is stored in sparse format.
Numeric matrix to be multiplied by the inverse of the
covariance matrix (length must match the dimension of
covmatrix).
Logical. If TRUE (default) the quadratic form
\(\mathbf{cc}^\top \Sigma^{-1} \mathbf{cc}\) is also returned.
Moreno Bevilacqua, moreno.bevilacqua@uai.cl
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.