Compute the LU decomposition of A.
If A is full then subroutines from LAPACK are used, and if A is sparse then UMFPACK is used.
The result is returned in a permuted form, according to the optional return
value P. For example, given the matrix a = [1, 2; 3, 4]
,
[l, u, p] = lu (a)
returns
l = 1.00000 0.00000 0.33333 1.00000 u = 3.00000 4.00000 0.00000 0.66667 p = 0 1 1 0
The matrix is not required to be square.
When called with two or three output arguments and a sparse input matrix,
lu
does not attempt to perform sparsity preserving column
permutations. Called with a fourth output argument, the sparsity
preserving column transformation Q is returned, such that
P * A * Q = L * U
.
Called with a fifth output argument and a sparse input matrix,
lu
attempts to use a scaling factor R on the input matrix
such that
P * (R \ A) * Q = L * U
.
This typically leads to a sparser and more stable factorization.
An additional input argument thres, that defines the pivoting
threshold can be given. thres can be a scalar, in which case
it defines the UMFPACK pivoting tolerance for both symmetric and
unsymmetric cases. If thres is a 2-element vector, then the first
element defines the pivoting tolerance for the unsymmetric UMFPACK
pivoting strategy and the second for the symmetric strategy. By default,
the values defined by spparms
are used ([0.1, 0.001]).
Given the string argument "vector"
, lu
returns the values
of P and Q as vector values, such that for full matrix,
A(P,:) = L * U
, and R(P,:)
* A(:,Q) = L * U
.
With two output arguments, returns the permuted forms of the upper and
lower triangular matrices, such that A = L * U
.
With one output argument y, then the matrix returned by the
LAPACK routines is returned. If the input matrix is sparse then the
matrix L is embedded into U to give a return value similar to
the full case. For both full and sparse matrices, lu
loses the
permutation information.
See also: luupdate, ilu, chol, hess, qr, qz, schur, svd.
Package: octave