LU-class {Matrix} | R Documentation

## LU (dense) Matrix Decompositions

### Description

The `"LU"` class is the virtual class of LU decompositions of real matrices. `"denseLU"` the class of LU decompositions of dense real matrices.

### Objects from the Class

Objects can be created by calls of the form `new("denseLU", ...)`. More commonly the objects are created explicitly from calls of the form `lu(mm)` where `mm` is an object that inherits from the `"dgeMatrix"` class or as a side-effect of other functions applied to `"dgeMatrix"` objects.

### Extends

`"LU"` directly extends the virtual class `"MatrixFactorization"`.

`"denseLU"` directly extends `"LU"`.

### Slots

`x`:
  object of class `"numeric"`. The `"L"` (unit lower triangular) and `"U"` (upper triangular) factors of the original matrix. These are stored in a packed format described in the Lapack manual.
`perm`:
  Object of class `"integer"` - a vector of length `min(Dim)` that describes the permutation applied to the rows of the original matrix. The contents of this vector are described in the Lapack manual.
`Dim`:
  the dimension of the original matrix; inherited from class `MatrixFactorization` .

### Methods

expand
  `signature(x = "denseLU")`: Produce the `"L"` and `"U"` (and `"P"`) factors as a named list of matrices, see also the example below.
solve
  `signature(a = "denseLU", b = "missing")`: ComputeProduce the `"L"` and `"U"` (and `"P"`) factors as a named list of matrices, see also the example below.

### See Also

class `sparseLU` for LU decompositions of sparse matrices; further, class `dgeMatrix` and functions `lu`, `expand`.

### Examples

    set.seed(1)
    mm <- Matrix(round(rnorm(9),2), nrow = 3)
    mm
    str(lum <- lu(mm))
    elu <- expand(lum)
    elu # three components: "L", "U", and "P", the permutation
    elu$L %*% elu$U
    (m2 <- with(elu, P %*% L %*% U)) # the same as 'mm'
    stopifnot(all.equal(as(mm, "matrix"),
                        as(m2, "matrix")))

[Package Matrix version 0.999375-33 Index]