MF_LUdecompose MD_LUdecompose ME_LUdecompose
MCF_LUdecompose MCD_LUdecompose MCE_LUdecompose
FunctionLU decomposition
Syntax C/C++#include <MFstd.h>
int MF_LUdecompose( fMatrix LU, uVector Ind, fMatrix MA, ui len );
C++ MatObj#include <OptiVec.h>
void matrix<T>::LUdecompose( vector<unsigned> Ind, const matrix<T>& MA );
void matrix<T>::LUdecompose( vector<unsigned>* Ind, const matrix<T>& MA );
Pascal/Delphiuses MFstd;
function MF_LUdecompose( MLU:fMatrix; Ind:uVector; MA:fMatrix; len:UIntSize ):Integer;
DescriptionMA is decomposed into a product MA = L * U, where L is lower-triangular with the diagonal elements equal to 1, and U is upper-triangular. As the combined number of non-trivial elements of L and U just fit into a matrix of the same dimensions as MA, the result is stored in a single matrix MLU rather than in to distinct matrices L and U. Actually, it is not the "true" matrices L and U which are combined into MLU, but rather a row-wise permutation, whose indices are output in the vector Ind. The return value indicates if the number of permuations was even (+1) or uneven (-1).

MA may or may not be overwritten by MLU. To check if MF_LUdecompose was successful, call MF_LUDresult, whose return value will be FALSE (0), if the MA could be decomposed, and TRUE (1) for singular MA.

There are applications where it makes sense to make near-singular matrices decomposable by "pivot editing": If, in the partial pivoting process employed in the decomposition and inversion, no diagonal element larger than the threshold is available, the scaling of the matrix is done with the threshold value rather than with the tiny diagonal element. That way, divisions by (near-)zero are avoided. This pivot editing can be chosen through a call to MF_LUDsetEdit. By default, pivot editing is switched off.

Please note that the present implementation of this function does not employ the fastest possible algorithm. In order to avoid excessive accumulation of round-off error, all dot products are internally summed up in double or extended precision, thus precluding the use of the faster SIMD instructions.

Error handlingIn the case of a singular matrix, MLU will be undefined, and an internal flag is set, but no error message is generated. To check if an error occurred, you must call MF_LUDresult.
Return value+1 or -1, indicating even or uneven number of row permutations
See alsochapter 10

MatrixLib Table of Contents  OptiVec home