LU factorization with pivoting
[L,U]= lu(A) [L,U,E]= lu(A)
real or complex matrix (m x n).
real or complex matrices (m x min(m,n)).
real or complex matrices (min(m,n) x n ).
a (n x n) permutation matrix.
[L,U]= lu(A) produces two matrices
U such that
A = L*U with
upper triangular and
L a general matrix without any particular
structure. In fact, the matrix
A is factored as
where the matrix
B is lower triangular
and the matrix
L is computed from
A has rank
U are zero.
[L,U,E]= lu(A) produces three matrices
E such that
E*A = L*U with
U upper triangular and
triangular for a permutation matrix
A is a real matrix, using the function
luget it is possible to obtain
the permutation matrices and also when
A is not full
rank the column compression of the matrix
In the following example, we create the Hilbert matrix of size 4 and factor it with A=LU. Notice that the matrix L is not lower triangular. To get a lower triangular L matrix, we should have given the output argument E to Scilab.
a = testmatrix("hilb",4); [l,u]=lu(a) norm(l*u-a)
In the following example, we create the Hilbert matrix of size 4 and factor it with EA=LU. Notice that the matrix L is lower triangular.
a = testmatrix("hilb",4); [l,u,e]=lu(a) norm(l*u-e*a)
The following example shows how to use the lufact and luget functions.
lu decompositions are based on the Lapack routines DGETRF for real matrices and ZGETRF for the complex case.
|Report an issue|
|<< hess||Factorization||qr >>|