Learn R Programming

Matrix (version 0.3-19)

lu.Matrix: Triangular (LU) Decomposition of a Matrix

Description

Computes the LU decomposition of a matrix.

Usage

## S3 method for class 'Matrix':
lu(x, norm.comp = T, \dots)

Arguments

x
numeric or complex matrix (does not have to be square). Missing values (NAs) are not allowed.
norm.comp
a logical vector of length two telling whether or not to compute the one and/or infinity norm of the matrix, respectively. These norms should be computed if solve is going to eventually be applied to the factorization with condit
...
further arguments passed to or from other methods.

Value

  • The LU decomposition of x is returned as an object of class "lu.Matrix", which is a list with components "l", a unit lower triangular matrix, "u", an upper triangular matrix, and "permutation", a row permutation matrix. The one or infinity norm is included as an attribute, if requested. and/or infinity norms of the matrix if requested (used for condition estimation).

Details

This function uses the Lapack subroutine DGETRF to form an LU factorization of a matrix X. The factorization has the form X = P * L * U where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n).

References

Anderson, E., et al. (1994). LAPACK User's Guide, 2nd edition, SIAM, Philadelphia.

Examples

Run this code
x <- Matrix((1:16)^2, nrow = 4, ncol = 4)
lu.Matrix(x)

Run the code above in your browser using DataLab