CholeskyDecomposition(Data: Array): Array;
Data. A flat numeric array with an equal number of rows and columns.
The CholeskyDecomposition method returns Cholesky decomposition result.
The decomposition is executed only for symmetric positive definite matrices.
To execute the example, add a link to the MathFin system assembly.
Sub UserProc;
Var
ChD, matr: Array Of Double;
i, j: Integer;
Begin
matr := New Double[3, 3];
matr[0, 0] := 1; matr[0, 1] := 0; matr[0, 2] := 0;
matr[1, 0] := 0; matr[1, 1] := 15; matr[1, 2] := 0;
matr[2, 0] := 0; matr[2, 1] := 0; matr[2, 2] := 150;
ChD := Math.CholeskyDecomposition(matr);
If Math.Status = 0 Then
For i := 0 To ChD.GetUpperBound(1) Do
For j := 0 To ChD.GetUpperBound(2) Do
Debug.Write(ChD[i, j].ToString + " ");
End For;
Debug.WriteLine("");
End For;
Else
Debug.WriteLine("Error " + Math.Status.ToString + ": " + Math.ErrorMsg);
End If;
End Sub UserProc;
After executing the example the console window displays the result of Cholesky decomposition.
See also: