Extreme Optimization™: Complexity made simple.

Math and Statistics
Libraries for .NET

  • Home
  • Features
    • Math Library
    • Vector and Matrix Library
    • Statistics Library
    • Performance
    • Usability
  • Documentation
    • Introduction
    • Math Library User's Guide
    • Vector and Matrix Library User's Guide
    • Data Analysis Library User's Guide
    • Statistics Library User's Guide
    • Reference
  • Resources
    • Downloads
    • QuickStart Samples
    • Sample Applications
    • Frequently Asked Questions
    • Technical Support
  • Blog
  • Order
  • Company
    • About us
    • Testimonials
    • Customers
    • Press Releases
    • Careers
    • Partners
    • Contact us
Introduction
Deployment Guide
Nuget packages
Configuration
Using Parallelism
Expand Mathematics Library User's GuideMathematics Library User's Guide
Expand Vector and Matrix Library User's GuideVector and Matrix Library User's Guide
Expand Data Analysis Library User's GuideData Analysis Library User's Guide
Expand Statistics Library User's GuideStatistics Library User's Guide
Expand Data Access Library User's GuideData Access Library User's Guide
Expand ReferenceReference
  • Extreme Optimization
    • Features
    • Solutions
    • Documentation
    • QuickStart Samples
    • Sample Applications
    • Downloads
    • Technical Support
    • Download trial
    • How to buy
    • Blog
    • Company
    • Resources
  • Documentation
    • Introduction
    • Deployment Guide
    • Nuget packages
    • Configuration
    • Using Parallelism
    • Mathematics Library User's Guide
    • Vector and Matrix Library User's Guide
    • Data Analysis Library User's Guide
    • Statistics Library User's Guide
    • Data Access Library User's Guide
    • Reference
  • Vector and Matrix Library User's Guide
    • Basic Concepts
    • Vectors
    • Matrices
    • Structured Matrix Types
    • Matrix Decompositions
    • Sparse Vectors and Matrices
    • Complex Linear Algebra
    • Single-Precision Linear Algebra
    • Distributed and GPU Computing
  • Matrix Decompositions
    • The LU Decomposition
    • The QR Decomposition
    • The Cholesky Decomposition
    • The Symmetric Indefinite Decomposition
    • The Eigenvalue Decomposition
    • The Generalized Eigenvalue Decomposition
    • The Singular Value Decomposition
    • The Generalized Singular Value Decomposition
    • Non-Negative Matrix Factorization
    • Solving Linear Systems
  • The Cholesky Decomposition

The Cholesky Decomposition

Extreme Optimization Numerical Libraries for .NET Professional

The Cholesky decomposition or Cholesky factorization of a matrix is defined only for positive-definite symmetric or Hermitian 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 Cholesky decomposition. Moreover, the decomposition is fairly stable, so it is suitable for use in a broader range of problems.

Working with Cholesky decompositions

The Cholesky decomposition of a matrix is implemented by the CholeskyDecompositionT class. It has no constructors. Instead, it is created by calling the GetCholeskyDecomposition method on the matrix. This method has two overloads. The first overload has no arguments. The second overload takes a Boolean value that specifies whether the contents of the matrix may be overwritten by the Cholesky decomposition. The default is .

C#
VB
C++
F#
Copy
var A = Matrix.CreateSymmetric(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
}, MatrixTriangle.Upper, MatrixElementOrder.RowMajor);
var c = A.GetCholeskyDecomposition();
Dim A = Matrix.CreateSymmetric(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
}, MatrixTriangle.Upper, MatrixElementOrder.RowMajor)
Dim c = A.GetCholeskyDecomposition()
'

No code example is currently available or this language may not be supported.

let A = Matrix.CreateSymmetric(4, 
            [|
                4.16;-3.12; 0.56;-0.10;
                0.00; 5.03;-0.83; 1.18;
                0.00; 0.00; 0.76; 0.34;
                0.00; 0.00; 0.00; 1.18 
            |], 
            MatrixTriangle.Upper, MatrixElementOrder.RowMajor)
let c = A.GetCholeskyDecomposition()

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. This method is called by other methods as needed. You will rarely need to call it explicitly.

If the matrix is not positive definite a MatrixNotPositiveDefiniteException is thrown. The TryDecompose method performs the same operation, but never throws an exception. Instead, it returns if the decomposition succeeded, and otherwise.

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

C#
VB
C++
F#
Copy
var b = Matrix.Create(4, 2, new double[] {
    8.70,-13.35, 1.89,-4.14,
    8.30,  2.13, 1.61, 5.00
}, MatrixElementOrder.ColumnMajor);
var x = c.Solve(b);
var invA = c.GetInverse();
var detA = c.GetDeterminant();
Dim b = Matrix.Create(4, 2, New Double() {
    8.7, -13.35, 1.89, -4.14,
    8.3, 2.13, 1.61, 5.0
}, MatrixElementOrder.ColumnMajor)
Dim x = c.Solve(b)
Dim invA = c.GetInverse()
Dim detA = c.GetDeterminant()
'

No code example is currently available or this language may not be supported.

let b = Matrix.Create(4, 2, 
          [|
            8.70;-13.35; 1.89;-4.14;
            8.30;  2.13; 1.61; 5.00
          |], MatrixElementOrder.ColumnMajor)
let x = c.Solve(b)
let invA = c.GetInverse()
let detA = c.GetDeterminant()

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

C#
VB
C++
F#
Copy
var L = c.LowerTriangularFactor;
var LT = c.UpperTriangularFactor;
Dim L = c.LowerTriangularFactor
Dim LT = c.UpperTriangularFactor
'

No code example is currently available or this language may not be supported.

let L = c.LowerTriangularFactor
let LT = c.UpperTriangularFactor
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. No specific action is needed to take advantage of this: the most suitable form of the decomposition is chosen automatically.

Copyright (c) 2004-2021 ExoAnalytics Inc.

Send comments on this topic to support@extremeoptimization.com

Copyright © 2004-2021, Extreme Optimization. All rights reserved.
Extreme Optimization, Complexity made simple, M#, and M Sharp are trademarks of ExoAnalytics Inc.
Microsoft, Visual C#, Visual Basic, Visual Studio, Visual Studio.NET, and the Optimized for Visual Studio logo
are registered trademarks of Microsoft Corporation.