getInvC: Utility function for kriging computation

View source: R/Utility_cov.R

getInvCR Documentation

Utility function for kriging computation

Description

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.

Usage

getInvC(covmatrix, CC, mse = TRUE)

Arguments

covmatrix

A covariance matrix:

covmatrix

A covariance matrix (dense or sparse).

sparse

Logical scalar indicating whether the matrix is stored in sparse format.

CC

Numeric matrix to be multiplied by the inverse of the covariance matrix (length must match the dimension of covmatrix).

mse

Logical. If TRUE (default) the quadratic form \mathbf{cc}^\top \Sigma^{-1} \mathbf{cc} is also returned.

Details

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.

Value

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).

Author(s)

Moreno Bevilacqua, moreno.bevilacqua@uai.cl


GeoModels documentation built on Sept. 1, 2025, 1:09 a.m.

Related to getInvC in GeoModels...