Hi,
I want to have cholski decomposition of a matrix. In opencv doc is here and I think this doc is still good. In following program I try to have cholesky decomposition of matrix A
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main (int argc,char **argv)
{
Mat m1=(Mat_<double>(3,3) << 4,12,-16,12,37,-43,-16,-43,98);
cout<<m1<<endl;
Cholesky ((double*)m1.ptr(),m1.cols*8, 3,NULL, 0, 0);
m1.at<double>(0,1)=0;m1.at<double>(0,2)=0;m1.at<double>(1,2)=0;
cout<<"L = "<<m1<<endl;
cout<<"L' = "<<m1.t()<<endl;
cout << "LL'="<<m1.mul(m1.t())<<endl;
}
Result is
A=[4, 12, -16;
12, 37, -43;
-16, -43, 98]
L = [0.5, 0, 0;
6, 1, 0;
-8, 5, 0.3333333333333333]
L' = [0.5, 6, -8;
0, 1, 5;
0, 0, 0.3333333333333333]
LL'=[0.25, 0, -0;
0, 1, 0;
-0, 0, 0.1111111111111111] <> A
Is it a bug or I miss something?