adi_diag: Alternating Direction Implicit Method for...

View source: R/adi.R

adi_diagR Documentation

Alternating Direction Implicit Method for Separable-plus-diagonal Covariance

Description

Calculates the solution to the inverse problem involving the separable-plus-diagonal structure as the left-hand side.

Usage

adi_diag(
  A1,
  A2,
  B_diag,
  y,
  theta = 0,
  rho = NULL,
  adapt = F,
  maxiter = 200,
  tol = 10^-6
)

Arguments

A1

temporal kernel of the separable-plus-diagonal model

A2

spatial kernel of the separable-plus-diagonal model

B_diag

the diagonal of the model

y

right-hand side vector

theta

regularization

rho

initial value of the shift parameter, defaults to the square-root of the smaller one of the condition numbers of A1 and A2. It should should be kept as default unless A1 or A2 is (exactly) low-rank.

adapt

whether the shift should change in between iterations

maxiter

maximum number of iterations

tol

relative tolerance - stopping criterion

Value

list of 3 elements: the solution as a vector, the number of ADI iterations and the vector of PCG iterations (one number per one ADI iteration)

Examples

K <- 30
A1 <- brownian_cov(K)
A1 <- A2 <- A1/sum(diag(A1))
B_diag <- array(runif(K^2),c(K,K))
B_diag <- B_diag/sum(B_diag)
theta <- 1e-5
x <- runif(K^2)
X <- matrix(x,ncol=K)
y <- c(A1 %*% X %*% A2) + c(B_diag*X) + theta*x
x_adi <- adi_diag(A1, A2, B_diag, y, theta, adapt=TRUE,maxiter=100,tol=10^-7)
sum((x-x_adi$x)^2)/sum(x^2)

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