ldl | R Documentation |
Function ldl
computes the LDL decomposition of a positive semidefinite matrix.
ldl(x, tol)
x |
Symmetrix matrix. |
tol |
Tolerance parameter for LDL decomposition, determines which
diagonal values are counted as zero. Same value is used in isSymmetric function.
Default is |
Transformed matrix with D in diagonal, L in strictly lower diagonal and zeros on upper diagonal.
# Positive semidefinite matrix, example matrix taken from ?chol
x <- matrix(c(1:5, (1:5)^2), 5, 2)
x <- cbind(x, x[, 1] + 3*x[, 2])
m <- crossprod(x)
l <- ldl(m, tol = 1e-8) # arm64 Mac setup in CRAN fails with default tolerance
d <- diag(diag(l))
diag(l) <- 1
all.equal(l %*% d %*% t(l), m, tol = 1e-15)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.