Extreme Optimization > User's Guide > Vector and Matrix Library > Matrix Decompositions > The Cholesky Decomposition

Extreme Optimization User's Guide

User's Guide

Up: Matrix Decompositions Next: The Symmetric Eigenvalue Decomposition Previous: The QR Decomposition Contents

The Cholesky Decomposition

The Cholesky decomposition or Cholesky factorization  is defined only for positive-definite symmetric matrices. It expresses a matrix as the product of a lower triangular matrix and its transpose.

The Cholesky decomposition algorithm exploits the special structure of symmetric matrices. As a result, it is about twice as fast as the LU decomposition. Moreover, the decomposition is fairly stable, so it is suitable for use in a broader range of problems.

In the Extreme Optimization Mathematics Library for .NET, the Cholesky decomposition is implemented by the CholeskyDecomposition class.

The CholeskyDecompositionclass

The CholeskyDecomposition class represents the Cholesky decomposition of a matrix. It has two constructors. The first variant takes a SymmetricMatrix as its only parameter.

C# CopyCode imageCopy Code
SymmetricMatrix aC = new SymmetricMatrix(4, 
    new double[]
{
    4.16,-3.12, 0.56,-0.10,
    0, 5.03,-0.83, 1.18,
    0,0, 0.76, 0.34,
    0,0,0, 1.18
}, MatrixTriangleMode.Lower);
CholeskyDecomposition c = new CholeskyDecomposition(aC);
Visual Basic CopyCode imageCopy Code
Dim aC As SymmetricMatrix = New SymmetricMatrix(4, _
    New Double() _
    { _
     4.16, -3.12, 0.56, -0.1, _
     0, 5.03, -0.83, 1.18, _
     0, 0, 0.76, 0.34, _
     0, 0, 0, 1.18 _
    }, MatrixTriangleMode.Lower)
Dim c As CholeskyDecomposition = New CholeskyDecomposition(aC)

The second constructor has an additional Boolean parameter that specifies whether the contents of the first parameter should be overwritten by the Cholesky decomposition. The matrix must be positive definite.

C# CopyCode imageCopy Code
CholeskyDecomposition c2 = new CholeskyDecomposition(aC, true);
Visual Basic CopyCode imageCopy Code
Dim c2 As CholeskyDecomposition = New CholeskyDecomposition(aC, True)

The Decompose method performs the actual decomposition. This method copies the matrix if necessary. It then calls the appropriate LAPACK routine to perform the actual decomposition. If the matrix is not positive definite, an exception of type MatrixNotPositiveDefiniteException is thrown. This method is called by other methods as needed. You will rarely need to call it explicitly.

Once the decomposition is computed, a number of operations can be performed in much less time. You can repeatedly solve a system of simultaneous linear equations with different right-hand sides. You can also calculate the determinant and the inverse of the base matrix:

C# CopyCode imageCopy Code
GeneralMatrix bC = new GeneralMatrix(4, 2,
    new double[] {8.70,-13.35,1.89,-4.14,8.30,2.13,1.61,5.00});
Matrix xC = c.Solve(bC);
Console.WriteLine("x = {0}", xC);
Console.WriteLine("Inv A = {0}", c.GetInverse().ToString("F4"));
Console.WriteLine("Det A = {0}", c.GetDeterminant());
Visual Basic CopyCode imageCopy Code
Dim bC As GeneralMatrix = New GeneralMatrix(4, 2, _
    New Double() {8.7, -13.35, 1.89, -4.14, 8.3, 2.13, 1.61, 5.0})
Dim xC As Matrix = c.Solve(bC)
Console.WriteLine("x = {0}", xC)
Console.WriteLine("Inv A = {0}", c.GetInverse().ToString("F4"))
Console.WriteLine("Det A = {0}", c.GetDeterminant())

The LowerTriangularFactor property returns a TriangularMatrix containing the lower triangular matrix, G, of the decomposition.

C# CopyCode imageCopy Code
Console.WriteLine("L = {0}", c.LowerTriangularFactor.ToString("F4"));
Visual Basic CopyCode imageCopy Code
Console.WriteLine("L = {0}", c.LowerTriangularFactor.ToString("F4"))

Band Cholesky Decomposition

The Cholesky decomposition of a symmetric band matrix is made up of a lower band matrix with lower bandwidth the same as the original matrix, and its transpose. The band structure allows for significant savings in computation time over a full Cholesky decomposition. The BandCholeskyDecomposition class takes advantage of the band structure. This class has the equivalent functionality as the general CholeskyDecomposition class, but takes band matrices as parameters and returns a band matrix where applicable.

Up: Matrix Decompositions Next: The Symmetric Eigenvalue Decomposition Previous: The QR Decomposition Contents

Overview
Introduction
Features
Documentation
QuickStart Samples
Sample Applications
Downloads
Get it now!
Download trial version
How to Buy
Information
Resources
Contact Us
Search

"The Extreme Optimization Statistics Library for .NET is a major boon for those doing statistical work in .NET. I strongly recommend this product."
- Marc Brooks

"I have made it my mission to institutionalize the value of good API design.  I strongly believe that this is key to making developers more productive and happy on our platform. It is clear that you value good API design in your work, and take to heart developer productivity and synergy with the .NET framework."
- Brad Abrams,
Lead Program Manager, Microsoft.

This is a partial list of companies who are using our libraries:
ABB Robotics
Allstate
Applied Materials
Arcam
Astra Schedule
Babson College
Canadian Council on Learning
Canyon Associates
Caxton Associates
CECity
Constellation Energy
CreditSights
DeepOcean
Duke University
Dynamotive
Elecsoft
Engelhard Corporation
Epcor
Equipoise Software
Galileo International
GAM UK
Gammex
GlaxoSmithKline
Global Matrix
The Hartford
Infinera Corporation
Intel
JDS Uniphase
LaBranche & Co.
Learning & Skills Council
Jacobs Consultancy
Litman Gregory
Lucas Systems
Malvern Instruments
Medrio
Merck & Co.
Mintera.
Monitor Software
MorningStar
NanoString Technologies
Paletta Invent
Parametric Portfolio Associates
Prosanos
RATA Associates
RiskShield
Ramboll
Standard & Poor's
Strategic Analysis Corporation
Univ. of Alicante
Univ. of South Carolina
vielife
Xerox
US Army