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 matrix.

Syntax

L, U, P = lu(M)

Argument

Name

Description

 

M

A matrix; real or complex.

Outputs

Name

Description

 

L

Matrix of size m x n.

 

U

Matrix.

 

P

Matrix (permutation).

Example

Find the LU decomposition of a square matrix.

 

Syntax

 

M = [1,2,3;4,5,60;7,8,90];

l, u, p = lu(M);

print('l = ', l);

print('u = ', u);

print('p = ', p);

M = [1,2,3;4,5,60;7,8,90] + i;

l, u, p = lu(M);

print('l = ', l);

print('u = ', u);

print('p = ', p);

Comments

L, U, P = lu(M) computes three matrices (L, U and P) such that P * M = L * U with:

U: a upper triangular matrix,

P * L: lower triangular for a permutation matrix P.

lu factorization based on the LAPACK routines 'dgetrf' for real matrices and 'zgetrf' for the complex case.

See Also:

svd