Cholesky-class {Matrix} | R Documentation

## Cholesky and Bunch-Kaufman Decompositions

### Description

The `"Cholesky"` class is the class of Cholesky decompositions of positive-semidefinite, real dense matrices. The `"BunchKaufman"` class is the class of Bunch-Kaufman decompositions of symmetric, real matrices. The `"pCholesky"` and `"pBunchKaufman"` classes are their packed storage versions.

### Objects from the Class

Objects can be created by calls of the form `new("Cholesky", ...)` or `new("BunchKaufman", ...)`, etc, or rather by calls of the form `chol(pm)` or `BunchKaufman(pm)` where `pm` inherits from the `"dpoMatrix"` or `"dsyMatrix"` class or as a side-effect of other functions applied to `"dpoMatrix"` objects (see `dpoMatrix`).

### Slots

A Cholesky decomposition extends class `MatrixFactorization` but is basically a triangular matrix extending the `"dtrMatrix"` class.

`uplo`:
  inherited from the `"dtrMatrix"` class.
`diag`:
  inherited from the `"dtrMatrix"` class.
`x`:
  inherited from the `"dtrMatrix"` class.
`Dim`:
  inherited from the `"dtrMatrix"` class.
`Dimnames`:
  inherited from the `"dtrMatrix"` class.

A Bunch-Kaufman decomposition also extends the `"dtrMatrix"` class and has a `perm` slot representing a permutation matrix. The packed versions extend the `"dtpMatrix"` class.

### Extends

Class `"MatrixFactorization"` and `"dtrMatrix"`, directly. Class `"dgeMatrix"`, by class `"dtrMatrix"`. Class `"Matrix"`, by class `"dtrMatrix"`.

### Methods

There are currently no methods defined with class "Cholesky" in the signature. Of course methods for `"dtrMatrix"` or `"MatrixFactorization"` do apply.

### Note

1. Objects of class `"Cholesky"` typically stem from `chol(D)`, applied to a dense matrix `D`.

   On the other hand, the function `Cholesky(S)` applies to a sparse matrix `S`, and results in objects inheriting from class `CHMfactor`.

2. For traditional matrices `m`, `chol(m)` is a traditional matrix as well, triangular, but simply an n * n numeric `matrix`. Hence, for compatibility, the `"Cholesky"` and `"BunchKaufman"` classes (and their `"p*"` packed versions) also extend triangular Matrix classes (such as "dtrMatrix").

   Consequently, `determinant(R)` for `R <- chol(A)` returns the determinant of `R`, not of `A`. This is in contrast to class `CHMfactor` objects `C`, where `determinant(C)` gives the determinant of the original matrix `A`, for `C <- Cholesky(A)`, see also the `determinant` method documentation on the class `CHMfactor` page.

### See Also

Classes `dtrMatrix`, `dpoMatrix`; function `chol`.

Function `Cholesky` resulting in class `CHMfactor` objects, not class "Cholesky" ones, see the section ‘Note’.

### Examples

    (sm <- as(as(Matrix(diag(5) + 1), "dsyMatrix"), "dspMatrix"))
    signif(csm <- chol(sm), 4)

    (pm <- crossprod(Matrix(rnorm(18), nrow = 6, ncol = 3)))
    (ch <- chol(pm))
    if (toupper(ch@uplo) == "U") # which is TRUE
       crossprod(ch)
    stopifnot(all.equal(as(crossprod(ch), "matrix"),
                        as(pm, "matrix"), tol=1e-14))

[Package Matrix version 0.999375-33 Index]