pcg: Preconditioned Conjugate Gradient for R-separable Covariance

View source: R/pcg.R

pcgR Documentation

Preconditioned Conjugate Gradient for R-separable Covariance

Description

PCG method for solving A1 X B1 + ... + AR X BR + eps X = Y using the preconditioner (A1 x B1 + eps I)^(-1)

Usage

pcg(Est, Y, eps, Ig = NULL, tol = 1e-10)

Arguments

Est

list of 3 giving the left-hand side, produced by scd_est

Y

the right-hand side matrix

eps

ridge regularization constant

Ig

the initial guess, random by default

tol

the tolerance used for stopping

Value

list of 2: U - the solution X as a matrix; iter - the number of iterations

Examples

X <- array(runif(20*3*4),c(20,3,4))
X_new <- array(runif(3*4),c(3,4))
Est <- scd_est(X,R=2)
Y <- apply_lhs(Est, X_new)
X_hat <- pcg(Est, Y, 1e-5)
norm(X_new - X_hat$U, type="F")/norm(X_new, type="F")

TMasak/surfcov documentation built on April 25, 2022, 12:15 a.m.