Learn R Programming

varComp (version 0.2-0)

cholRoot: Lower Cholesky Root

Description

This function is similar to base::chol, but it returns the lower root and possibly remove unnecessary columns.

Usage

cholRoot(x)

Arguments

x

A positive semidefinite matrix.

Value

A numeric matrix, not necessarily a square matrix.

Details

This function calls base::chol with pivoting and returns the lower root. In the case of less than full rank x, unnecessary columns are removed. tcrossprod(cholRoot(x)) will reproduce x (up to numerical errors).

See Also

Matrix::chol, base::chol.

Examples

Run this code
# NOT RUN {
	set.seed(3456L)
	A=tcrossprod(matrix(runif(10L), 5L))
	cholRoot(A)
	range(A - tcrossprod(cholRoot(A)))
	
# }

Run the code above in your browser using DataLab