cholesky: Cholesky decomposition of a square matrix

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/cholesky.R

Description

Cholesky decomposition of a square matrix.

Usage

1

Arguments

x

A square positive definite matrix.

parallel

A boolean value for parallel version.

Details

The Cholesky decomposition of a square positive definite matrix is computed. The use of parallel is suggested for matrices with dimensions of 1000 or more.

Value

An upper triangular matrix.

Author(s)

Manos Papadakis

R implementation and documentation: Michail Tsagris <mtsagris@uoc.gr> and Manos Papadakis <papadakm95@gmail.com>

See Also

is.symmetric

Examples

1
2
3
4
5
6
7
8
9
x = matrix(rnorm(1000 * 50), ncol = 50)
s = cov(x)
system.time(a1 <- cholesky(s))
system.time(a2 <- chol(s))
all.equal(a1[upper.tri(a1)], a2[upper.tri(a2)])
x <- NULL
s <- NULL
a1 <- NULL
a2 <- NULL

Example output

Loading required package: Rcpp
Loading required package: RcppZiggurat
   user  system elapsed 
  0.001   0.000   0.004 
   user  system elapsed 
  0.000   0.000   0.003 
[1] TRUE

Rfast documentation built on May 18, 2021, 1:07 a.m.