fast_Gp_sim_Linv: Approximate GP simulation with specified Linverse

View source: R/simulation_functions.R

fast_Gp_sim_LinvR Documentation

Approximate GP simulation with specified Linverse

Description

In situations where we want to do many gaussian process simulations from the same model, we can compute Linverse once and reuse it, rather than recomputing for each identical simulation. This function also allows the user to input the vector of standard normals z.

Usage

fast_Gp_sim_Linv(Linv, NNarray, z = NULL)

Arguments

Linv

Matrix containing the entries of Linverse, usually the output from vecchia_Linv.

NNarray

Matrix of nearest neighbor indices, usually the output from find_ordered_nn

z

Optional vector of standard normals. If not specified, these are computed within the function.

Value

vector of simulated values

Examples

locs <- as.matrix( expand.grid( (1:50)/50, (1:50)/50 ) )
ord <- order_maxmin(locs)
locsord <- locs[ord,]
m <- 10
NNarray <- find_ordered_nn(locsord,m)
covparms <- c(2, 0.2, 1, 0)
Linv <- vecchia_Linv( covparms, "matern_isotropic", locsord, NNarray )
y <- fast_Gp_sim_Linv(Linv,NNarray)
y[ord] <- y
fields::image.plot( matrix(y,50,50) )

joeguinness/GpGp documentation built on Feb. 22, 2024, 9:43 a.m.