LU decomposition of a real square matrix. The matrix is decomposed as P∙L∙U. |
||||||||||||||||||||
Syntax |
P,L,U = LU(M) |
|||||||||||||||||||
Argument |
Name |
Description |
||||||||||||||||||
M |
A positive definite matrix. |
|||||||||||||||||||
Outputs |
Name |
Description |
||||||||||||||||||
P |
The permutation matrix. Same size as M. |
|||||||||||||||||||
L |
The lower triangle of the decomposition. Same size as M. |
|||||||||||||||||||
U |
The upper triangle of the decomposition. Same size as M. |
|||||||||||||||||||
Example |
Find the LU decomposition of a square matrix. |
|||||||||||||||||||
Syntax |
||||||||||||||||||||
M = [1.7,0.5,1.2;1.7,-1,-2;-1,0.2,0.8]// Given matrix P,L,U = LU(M); |
||||||||||||||||||||
Result |
||||||||||||||||||||
|
||||||||||||||||||||
Comments |
LU decomposition is used for solving linear equations Ax = b. First, compute the LU decomposition P * A = L * U, then solve Ly = P-1b for y, and finally solve Ux = y for x. The purpose of P is to increase numerical stability by avoiding small pivots. LU is based on the LAPACK routines 'dgetrf' for real matrices and 'zgetrf' for the complex case." |
|||||||||||||||||||
See Also: |