rchol: Cholesky decomposition via R factorization.
Description
rchol, provides the Cholesky decomposition of the symmetric and positive definite matrix \(X^\top X\in\mathbb{R}^{p\times p}\), where \(X\in\mathbb{R}^{n\times p}\) is the input matrix.
Value
an upper triangular matrix of dimension \(p\times p\) which represents the Cholesky decomposition of \(X^\top X\).
Arguments
X
an \((n\times p)\) matrix, with \(n\geq p\). If \(n< p\) an error message is returned.
set.seed(1234)
n <- 10
p <- 6
X <- matrix(rnorm(n * p, 1), n, p)
## compute the Cholesky decomposition of X^TXS <- fastQR::rchol(X = X)
S
## checkround(S - chol(crossprod(X)), 5)