Cholesky分解(Cholesky decomposition / Cholesky )
2024-09-03 04:49:01
Cholesky decomposition
In linear algebra, the Cholesky decomposition or Cholesky is a decomposition of a Hermitian, positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose.
Cholesky 分解是把一个对称正定的矩阵表示成一个下三角矩阵L和其转置的乘积的分解。
wiki
https://en.wikipedia.org/wiki/Cholesky_decomposition
MATLAB
https://www.mathworks.com/help/matlab/ref/chol.html?s_tid=gn_loc_drop#responsive_offcanvas
Cplusplus
https://eigen.tuxfamily.org/dox/classEigen_1_1LLT.html
#include <iostream>
#include <vector>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd A(3,3);
A << 4,-1,2, -1,6,0, 2,0,5;
cout << "The matrix A is" << endl << A << endl;
LLT<MatrixXd> lltOfA(A); // compute the Cholesky decomposition of A
//cout << "lltofA" << endl << lltOfA(A) << endl;
MatrixXd L = lltOfA.matrixL(); // retrieve factor L in the decomposition
// The previous two lines can also be written as "L = A.llt().matrixL()"
cout << "The Cholesky factor L is" << endl << L << endl;
cout << "To check this, let us compute L * L.transpose()" << endl;
cout << L * L.transpose() << endl;
cout << "This should equal the matrix A" << endl;
}
MATLAB Cholesky分解
>> A = [4 -1 2 ; -1 6 0 ; 2 0 5 ]
A =
4 -1 2
-1 6 0
2 0 5
>> L = chol(A,'lower')
L =
2.00000 0.00000 0.00000
-0.50000 2.39792 0.00000
1.00000 0.20851 1.98910
>> B = L * L'
B =
4.0000e+00 -1.0000e+00 2.0000e+00
-1.0000e+00 6.0000e+00 -2.5602e-17
2.0000e+00 -2.5602e-17 5.0000e+00
>>
最新文章
- 2012-2013 ACM-ICPC Northeastern European Regional Contest (NEERC 12)
- SynchronousQueue类
- DGV换行操作
- 14.约瑟夫环问题[JosephusProblem]
- 是否可以继承String类?
- OpenStack 多台计算节点时的问题
- union与struct以及大小端
- 《Python CookBook2》 第一章 文本 - 改变多行文本字符串的缩进 &;&; 扩展和压缩制表符(此节内容待定)
- top 10 js mvc
- deque用法 和与vector的区别
- MVVM模式应用 之的RelayCommand的使用
- 关于JS、JQuery、CSS的小知识点
- Python中TKinter模块中的Label组件
- puts fputs printf的区别
- poj 3264 Balanced Lineup(线段树、RMQ)
- Js内存泄露问题总结
- Java基础之异常
- MAC OSX下用pip安装lxml时遇到xmlversion.h not found的解决办法
- 你不知道的JavaScript--Item20 作用域与作用域链(scope chain)
- thymeleaf的配置