R: The LDL decomposition

ldl {fastmatrix} | R Documentation

## The LDL decomposition

### Description

Compute the LDL decomposition of a real symmetric matrix.

### Usage

    ldl(x)

### Arguments

`x` | a symmetric numeric matrix whose LDL decomposition is to be computed.

### Value

The factorization has the form \bold{X} = \bold{LDL}^T, where \bold{D} is a diagonal matrix and \bold{L} is unitary lower triangular.

The LDL decomposition of `x` is returned as a list with components:

`lower` | the unitary lower triangular factor \bold{L}.
`d` | a vector containing the diagonal elements of \bold{D}.

### References

Golub, G.H., Van Loan, C.F. (1996). Matrix Computations, 3rd Edition. John Hopkins University Press.

### See Also

`chol`

### Examples

    a <- matrix(c(2,-1,0,-1,2,-1,0,-1,1), ncol = 3)
    z <- ldl(a)
    z # information of LDL factorization

    # computing det(a)
    prod(z$d) # product of diagonal elements of D

    # a non-positive-definite matrix
    m <- matrix(c(5,-5,-5,3), ncol = 2)
    try(chol(m)) # fails
    ldl(m)

[Package fastmatrix version 0.3-8196 Index]