Learn R Programming

automultinomial (version 1.0.0)

chol_psd: Cholesky decomposition for positive semidefinite matrix

Description

Takes a square symmetric positive definite or positive semidefinite matrix and returns a Cholesky factor.

Usage

chol_psd(a)

Arguments

a

A matrix

Value

The lower triangular Cholesky factor

Examples

Run this code
# NOT RUN {
X=replicate(100,rnorm(99))

#a is positive semidefinite but not positive definite
a_0=t(X)%*%X
b=chol_psd(a_0)

#recover a
a_1=b%*%t(b)
diff=max(abs(a_1-a_0))
# }

Run the code above in your browser using DataLab