Linv_mult: Multiply approximate inverse Cholesky by a vector

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Vecchia's approximation implies a sparse approximation to the inverse Cholesky factor of the covariance matrix. This function returns the result of multiplying that matrix by a vector.

Usage

1
Linv_mult(Linv, z, NNarray)

Arguments

Linv

Entries of the sparse inverse Cholesky factor, usually the output from vecchia_Linv.

z

the vector to be multiplied

NNarray

A matrix of indices, usually the output from find_ordered_nn. Row i contains the indices of the observations that observation i conditions on. By convention, the first element of row i is i.

Value

the product of the sparse inverse Cholesky factor with a vector

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
n <- 2000
locs <- matrix( runif(2*n), n, 2 )
covparms <- c(2, 0.2, 0.75, 0.1)
ord <- order_maxmin(locs)
NNarray <- find_ordered_nn(locs,20)
Linv <- vecchia_Linv( covparms, "matern_isotropic", locs, NNarray )
z1 <- rnorm(n)
y <- fast_Gp_sim_Linv(Linv,NNarray,z1)
z2 <- Linv_mult(Linv, y, NNarray)
print( sum( (z1-z2)^2 ) )

GpGp documentation built on June 10, 2021, 1:07 a.m.