<< logm Linear algebra orth >>

lu


LU matrix factorization.


Syntax


[L, U] = lu(A)
[L, U, P] = lu(A)

Input argument


A

a matrix: square, finite single or double.

Output argument


L

Lower triangular factor: matrix (same type A)

U

Upper triangular factor: matrix (same type A).

P

Row permutation: matrix (same type A).

Description


[L, U] = lu(A) function decomposes a full matrix A into two matrices: an upper triangular matrix U and a permuted lower triangular matrix L.

This factorization satisfies the equation A = L * U.

[L, U, P] = lu(A) function, when used with three output arguments, provides a permutation matrix P in addition to the unit lower triangular matrix L and the upper triangular matrix U.

This factorization is expressed as A = P'LU, where L is unit lower triangular, and U is upper triangular.

Used function(s)


LAPACKE_dgetrf, LAPACKE_sgetrf, LAPACKE_zgetrf, LAPACKE_cgetrf

Examples


A = magic(5)
[L, U] = lu(A)
L * U

A = magic(5)
[L, U, P] = lu(A);
subplot(1, 2, 1)
spy(L)
title(_('L factor'))
subplot(1, 2, 2)
spy(U)
title(_('U factor'))

See also


cond.

History


Version Description
1.1.0 initial version

Author


Allan CORNET

<< logm Linear algebra orth >>