[ILNumerics Computing Engine]

**Namespace:**ILNumerics

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

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

#### Parameters

- A
- Type: ILNumericsInArrayDouble

Input matrix. Size [m x n]. - U
- Type: ILNumericsOutArrayDouble

[Output] Upper triangular matrix. Size [min(m,n) x n]. This can be null. - P (Optional)
- Type: ILNumericsOutArrayDouble

[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: RetArrayDoubleLower triangular matrix L. Size [m x min(m,n)].

Exception | Condition |
---|---|

ArgumentException | if input A is not a matrix. |

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(InArrayDouble, OutArrayDouble, OutArrayDouble)) 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.

multiply(L,U) 5 6 7 4 4 4 1 2 3

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]