ProductName  

Performs Cholesky decomposition of the current matrix object.

Syntax

MatrixObject.Cholesky L

Parameters

L
Optional. A matrix object variable that, upon exit, will contain the reference to a matrix representing the lower triangular part of the Cholesky decomposition.

Remarks

If the matrix object represents a real matrix, Cholesky decomposition can be performed if the matrix is a symmetric positive definite matrix.

Error Codes

Error 1305 will be returned if the matrix is not square.

Error 1314 will be returned if the matrix is real but not a symmetric positive definite matrix.

Example

This example demonstrates the use of Cholesky method.

  Private sub MatrixCholesky()

Dim L As Matrix, Lt As Matrix
Dim A As Matrix, L2 As Matrix
Dim i As Long, j As Long

    'first we create a lower triangular matrix
    Set L = New Matrix
    L.Size 5, 5
    For i = 0 To 4
        For j = 0 To i
            L(i, j) = Int(Rnd * 10 + 1)
        Next
    Next

    'and we print it
    Debug.Print "L="
    Debug.Print L.GetString

    'and we set Lt to its transpose
    Set Lt = L.Transpose

    'we form the product L x Lt
    Set A = L.Times(Lt)

    ' A now contains a symmetric positive definite matrix
    Debug.Print "A="
    Debug.Print A.GetString

    'now we perform Cholesky decomposition
    'and we return results in L2
    Set L2 = New Matrix
    A.Cholesky L2

    Debug.Print "L2="
    Debug.Print L2.GetString

    'please notice that L2 equals matrix L
    '
End Sub

Output

L=
| 8,000 0,000 0,000 0,000 0,000 |
| 6,000 6,000 0,000 0,000 0,000 |
| 3,000 4,000 8,000 0,000 0,000 |
| 1,000 8,000 9,000 8,000 0,000 |
| 1,000 5,000 9,000 8,000 4,000 |

A=
|  64,000  48,000  24,000   8,000   8,000 |
|  48,000  72,000  42,000  54,000  36,000 |
|  24,000  42,000  89,000 107,000  95,000 |
|   8,000  54,000 107,000 210,000 186,000 |
|   8,000  36,000  95,000 186,000 187,000 |

L2=
| 8,000 0,000 0,000 0,000 0,000 |
| 6,000 6,000 0,000 0,000 0,000 |
| 3,000 4,000 8,000 0,000 0,000 |
| 1,000 8,000 9,000 8,000 0,000 |
| 1,000 5,000 9,000 8,000 4,000 |

See Also

LU Method | QR method | SVD method

Applies To: Matrix | CMatrix