Matlab[lu] - compute the LU decomposition of a MapleMatrix or MatlabMatrix in MATLAB, where P*X = L*U
|
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 , when output=LUP, and , 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 .
|
|
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 .
|
•
|
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
>
|
|
>
|
|
| (1) |
The LU decomposition of this MapleMatrix returning L and U is computed as
>
|
|
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.
>
|
|
[ 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
>
|
|
Verify correctness using MATLAB.
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
|
|