adi: Alternating Direction Implicit Method for...

View source: R/adi.R

adiR Documentation

Alternating Direction Implicit Method for Separable-plus-banded Covariance

Description

Calculates the solution to the inverse problem involving the separable-plus-banded structure as the left-hand side, where the banded part is stationary.

Usage

adi(
  A1,
  A2,
  band,
  y,
  theta = 1e-05,
  rho = NULL,
  adapt = TRUE,
  maxiter = 200,
  tol = 10^-9
)

Arguments

A1

temporal kernel of the separable-plus-banded model

A2

spatial kernel of the separable-plus-banded model

band

symbol of the banded part of the separable-plus-banded 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 <- matrix(c(4,2,2,1)/4,2)/K^2 # to have trace 1
theta <- 1e-5
eigvals <- Re(stats::fft(to_book_format(B,K,K)))
B <- Re(stats::fft(eigvals,inverse = TRUE)/(4*K^2))
B <- B[1:K,1:K]
x <- runif(K^2)
X <- matrix(x,ncol=K)
y <- c(A1 %*% X %*% A2) + BXfast(eigvals,x) + theta*x
x_adi <- adi(A1, A2, B, 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.