Cholesky {RandomFieldsUtils}R Documentation

Cholesky Decomposition of Positive Definite Matrices

Description

This function calculates the Choleskey decomposition of a matrix.

Usage

cholx(a)

Arguments

a

a square real-valued positive definite matrix

Details

If the matrix is diagonal direct calculations are performed.

Else the Cholesky decomposition is tried.

Value

a matrix containing the Choleskey decomposition (in its upper part)

Author(s)

Martin Schlather, schlather@math.uni-mannheim.de

See Also

chol.spam in the package spam

Examples


if (FALSE) {
## This examples shows that 'cholesky' can be much faster
## than 'chol'

## creating a covariance matrix for a temporal process
covmatrix <- function(model, x) {
  x <- as.matrix(dist(x))
  return(eval(substitute(model)))
}

size <- 600
x <- runif(size, 0, size / 10)
M <- covmatrix((1 - x) * (x < 1) , x) ## Askey's model of covariance
b <- seq(0, 1, len=size)
system.time(C2 <- chol(M))
system.time(C1 <- cholx(M))
range(C2 - C1)
stopifnot(all(abs(C2 - C1) < 10^{-9}))
}


[Package RandomFieldsUtils version 0.3.25 Index]