lu - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Matlab

  

lu

  

compute the LU decomposition of a MapleMatrix or MatlabMatrix in MATLAB(R), where P*X = L*U

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

lu(X, output=L)

lu(X, output=LU)

lu(X, output=LUP)

Parameters

X

-

MapleMatrix or MatlabMatrix

output

-

specify the form of the output (optional)

L

-

return combined upper and lower decomposed matrices

LU

-

return lower L and upper U decomposed matrices

LUP

-

return L, U, and permutation matrix P

Description

• 

The lu command computes the LU decomposition of a MapleMatrix or MatlabMatrix in MATLAB®, where PX=LU, when output=LUP, and X=LU, when output=LU.

• 

Matrix X is expressed as the product of two triangular matrices: L, a permutation of a lower triangular matrix, and U, a permutation of an upper triangular matrix.

• 

The LU decomposition for a MatlabMatrix is executed as a string. The matrix must be defined in the MATLAB® session.

• 

The output parameter L returns a combined lower and upper triangular matrix such that the diagonal and above are the entries of U, and the entries below the diagonal are the entries of L (with all diagonal entries for L implicitly having the value 1). As a matrix equation, this can be described as output=U+LI.

  

Note that for MATLAB® version 5.2, the entries of L are stored with the opposite sign, so as a matrix equation this can be described as UL+I.

• 

The output parameter LU returns the lower and upper triangular matrices.  This is the default if no output parameter is specified.

• 

The output parameter LUP returns matrices L and U with a permutation matrix P.

Examples

Define the Maple matrix

withMatlab:

maplematrix_aMatrix3,1,3,5,1,6,4,2,6,7,8,1,3,3,7,3

maplematrix_a3135164267813373

(1)

The LU decomposition of this MapleMatrix returning L and U is computed as

L,UMatlablumaplematrix_a

L, U :=

[0.500000000000000000 , -0.517241379310344750 , 0.115789473684210484 ,         1.        ]

[0.166666666666666657 ,          1. ,                   0. ,                   0.        ]

[        1. ,                    0. ,                   0. ,                   0.        ]

[0.500000000000000000 , -0.103448275862068950 ,         1. ,                   0.        ],

[        6. ,                    7. ,                   8. ,                   1.        ]

[                                                                                        ]

[        0. ,           4.83333333333333392 ,   2.66666666666666695 , 1.83333333333333326]

[                                                                                        ]

[        0. ,                    0. ,           3.27586206896551735 , 2.68965517241379314]

[                                                                                        ]

[        0. ,                    0. ,                   0. ,          5.13684210526315788]

The LU decomposition of this MapleMatrix returning both L and U combined is computed as follows. Since the variable L is defined, the L must have quotation marks around it in the procedure call.

Matlablumaplematrix_a,output=L

[         6. ,                   7. ,                    8. ,                   1.        ]

[0.166666666666666657 , 4.83333333333333392 ,   2.66666666666666695 ,  1.83333333333333326]

[0.500000000000000000 , -0.103448275862068950 , 3.27586206896551735 ,  2.68965517241379314]

[0.500000000000000000 , -0.517241379310344750 , 0.115789473684210484 , 5.13684210526315788]

The same decomposition including the permutation matrix P is

L,U,PMatlablumaplematrix_a,output=LUP:

Verify correctness using MATLAB®.

Matlabsetvara,maplematrix_a

Matlabsetvarl,L

Matlabsetvaru,U

Matlabsetvarp,P

MatlabevalMresult = isequal(l*u, p*a)

ifMatlabgetvarresult=1.0thentrueelsefalseendif

true

See Also

LinearAlgebra[LUDecomposition]

Matlab

Matlab[det]

Matlab[evalM]

Matlab[inv]

Matlab[lu]

Matlab[qr]

MatlabMatrix