TMtx.LU Method

TMtx LU(TMtx Dst, TVecInt P, TMtxType MtxType)

LU, Cholesky or Bunch-Kaufmann factorization.

#NameTypeDescription
1DstTMtxsource TMtx
2PTVecIntsource TVecInt
3MtxTypeTMtxType

Result: stored in self (calling object), returns self for chaining

Remarks:

Performs a general LU, Cholesky or Bunch-Kaufmann factorization on the calling matrix and stores the results in lower triangular matrix L and upper triangular matrix U. The MtxType parameter defines which optimized method will be used to calculate the LU factorization. Depending on the type of the calling matrix the LU method will use specific optimized algorithm to perform the factorization. If you don't know the Dew.Math.TMtxType of the calling matrix, you can omit the MtxType parameter (the default value mtGeneral will be used) or determine the type of matrix with the Dew.Math.TMtx.DetectMtxType method. The following methods can be used to calculate the LU factorization:

  • Matrix type is mtSymmPosDef, mtHermPosDef, mtBandSymmPosDef, mtBandHermPosDef : Cholesky factorization.
  • mtSymmetric : Bunch-Kaufmann factorization.
  • mtHermitian : Bunch-Kaufmann factorization (only for complex calling matrix).
  • mtTriangle : or Dew.Math.TMtx.UpperTriangle method.
  • mtGeneral, mtBandGeneral : general m x n matrix LU factorization.

Note
An exception will be raised if the calling matrix Dew.Math.TMtx.Quadratic property is not true and matrix storage format is not banded.

Examples
TMtx LU;
TMtx A;
TVecInt P;
MtxVec.CreateIt(out LU, out A);
MtxVec.CreateIt(out P);
try
    {
        A.SetIt(3,2,false,[1,2,
        3,4]);
        A.LU(LU,P);
    }
finally
    {
        MtxVec.FreeIt(ref LU, ref A);
        MtxVec.FreeIt(ref P);
    }
See Also: TMtx.LUSolve