ILNumerics Ultimate VS

ILMathlu Method (InArraycomplex, OutArraycomplex, OutArraycomplex)

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
Decompose matrix A into uper and lower triangular matrices. Also generates pivoting permutation matrix.

[ILNumerics Computing Engine]

Namespace:  ILNumerics
Assembly:  ILNumerics.Computing (in ILNumerics.Computing.dll) Version: 5.5.0.0 (5.5.7503.3146)
Syntax

public static RetArray<complex> lu(
	InArray<complex> A,
	OutArray<complex> U,
	OutArray<complex> P = null
)

Parameters

A
Type: ILNumericsInArraycomplex
Input matrix. Size [m x n].
U
Type: ILNumericsOutArraycomplex
[Output] Upper triangular matrix. Size [min(m,n) x n]. This can be null.
P (Optional)
Type: ILNumericsOutArraycomplex
[Output, optional] Permutation matrix P. Size [m x m]. Default: (null) do not compute the permutation matrix. L is ordered propery before the function returns.

Return Value

Type: RetArraycomplex
Lower triangular matrix L. Size [m x min(m,n)].
Exceptions

ExceptionCondition
ArgumentException if input A is not a matrix.
Remarks

A is decomposed into L and U so that the equation ILMath.multiply(L,U) == ILMath.multiply(P,A) holds within the range of round off errors.

The matrix L returned is a lower triangular matrix with unit diagonal. Depending on P the rows of L may be reordered due to pivoting during the triangulation. If P is not null on entry (i.e.: the permutation matrix P is computed and returned from lu(InArraycomplex, OutArraycomplex, OutArraycomplex)) L is truely lower triangular. In this case the equation ILMath.multiply(L,U) == ILMath.multiply(P,A) holds. Note, that the result of matrix multiplying L with U yields a version of A having its rows reordered. P permutes the rows of A accordingly. Note further, that P is suitable to be multiplied to A, while some other systems return P-1 for reordering the result L**U instead.

If P is null on entry (i.e.: the permutation matrix P is not requested and thus not returned) any permutation performed in the triangulation is reversed before returning L so that the matrix L returned is not guranteed to be lower triangular. Instead, the rows of L are reordered by P-1**L. In this case the simplified equation ILMath.multiply(L,U) == ILMath.multiply(A) holds (default).

U is a strictly upper triangular matrix. Any permutation is performed on L and not on U. Thus, the order of rows of U does not depend on P.

Examples

<code> // Construct a matrix A: Array<complex> A = new complex[,]{ {1, 2, 3}, {4, 4, 4}, {5, 6, 7} }; // A // <Double> [3x3] order: - //(:,:) // 1 2 3 // 4 4 4 // 5 6 7 // // define arrays serving as output arrays for U and P Array<complex> U = 1, P = 1; Array<complex> L = ILMath.lu(A, U, P); // L // <Double> [3,3] 1...1 order:| // 1 0 0 // 0,800000 1 0 // 0,200000 -1,000000 1 // // U //<Double> [3,3] 5...1,11022302462516E-15 order:| // 5 6 7 // 0 -0,800000 -1,600000 // 0 0 0,000000 // //P //<Double> [3,3] 0...0 order:| // 0 0 1 // 0 1 0 // 1 0 0 </code> L and U are triangular matrices. P is returned as well. The result of L**U gives:
multiply(L,U)
5          6          7
4          4          4
1          2          3
This result matches a reordered version of A, which can be computed by help of P: multiply(P,A) 5 6 7 4 4 4 1 2 3
Examples

// Computing the LU factorization of A without returning the permutation matrix P: <code> L = lu(A,U); // L // <Double> [3,3] 1...1 order:| // 0,200000 -1,000000 1 // 0,800000 1 0 // 1 0 0 // // U //<Double> [3,3] 5...1,11022302462516E-15 order:| // 5 6 7 // 0 -0,800000 -1,600000 // 0 0 0,000000 // </code> This time, while U did not change, L is not triangular but a reordered version of a lower triangular matrix. However, multiplying L ** U gives A directly: <code> multiply(L,U) 1 2 3 4 4 4 5 6 7 </code>

lu uses the Lapack function ?getrf.

The input matrix A is not altered.

Either of U and/or P can be null on entry. If U is null the upper triangular matrix will be computed but not returned. Instead, the compressed form of L and U is returned as created by the LAPACK function ?getrf:

:'''''''|
|1 \    |
| 1 \ R |
|  1 \  |
| L 1 \ |
|    1 \|
'''''''''

If P is null on entry and U is not null the permutation matrix is not computed but rows of L are reordered accordingly in order to fullfill the equation 'A = L**U'.

[ILNumerics Computing Engine]

See Also

Reference

MathInternal.chol(InArraycomplex, Boolean)