DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....


LUPdecomposition

Declaration: LUPDecomposition (Data: TDouble2DArray; var MatL, MatU: TDouble2DArray; var MatP: TInt2DArray; var NumPerm: integer): integer;
The function LUPDecomposition decomposes the square matrix Data into two triangular matrices MatL and MatU and the permutation matrix MatP, with the matrix MatL being the lower triangular matrix (containing all 1s in the diagonal), and MatU the upper triangular matrix. The variable parameter NumPerm returns the number of exchanged rows.

The figure below shows the LUP decomposition of a matrix of order 5 with the rows 3 and 4 exchanged.

The function returns the following error codes:

 0 ... everything is OK
-1 ... the data matrix is not square
-2 ... the data matrix is singular

Hint: Please note that the function LUPDecomposition uses partial pivoting and thus has a higher precision (less rounding errors) than the function LUDecomposition