HyperMath

LU

LU

Previous topic Next topic No expanding text in this topic  

LU

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

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

 

p =

1   0   0

 

0   0   0

 

0   0   1

 

l =

1          0          0

 

1          1          0

 

-0.58824   -0.32941    1

 

p =

1.7        0.5        1.2

 

0         -1.5       -3.2

 

0          0          0.45176

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:

LSolve

Csky

QR

svd