39 #include <visp3/core/vpConfig.h>
41 #include <visp3/core/vpColVector.h>
42 #include <visp3/core/vpMath.h>
43 #include <visp3/core/vpMatrix.h>
46 #include <visp3/core/vpException.h>
47 #include <visp3/core/vpMatrixException.h>
50 #include <visp3/core/vpDebug.h>
52 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1
53 #include <opencv2/core/core.hpp>
56 #ifdef VISP_HAVE_LAPACK
57 #ifdef VISP_HAVE_LAPACK_BUILT_IN
58 typedef long int integer;
63 extern "C" void dpotrf_(
char *uplo, integer *n,
double *a, integer *lda, integer *info);
64 extern "C" int dpotri_(
char *uplo, integer *n,
double *a, integer *lda, integer *info);
107 #ifdef VISP_HAVE_LAPACK
109 #elif (VISP_HAVE_OPENCV_VERSION >= 0x020101)
113 "Cholesky. Install Lapack or "
114 "OpenCV 3rd party"));
118 #ifdef VISP_HAVE_LAPACK
162 integer rowNum_ = (integer)this->
getRows();
163 integer lda = (integer)rowNum_;
167 dpotrf_((
char *)
"L", &rowNum_, A.
data, &lda, &info);
172 dpotri_((
char *)
"L", &rowNum_, A.
data, &lda, &info);
174 std::cout <<
"cholesky:dpotri_:error" << std::endl;
178 for (
unsigned int i = 0; i < A.
getRows(); i++)
179 for (
unsigned int j = 0; j < A.
getCols(); j++)
187 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101)
232 cv::Mat Minv = M.inv(cv::DECOMP_CHOLESKY);
235 memcpy(A.
data, Minv.data, (
size_t)(8 * Minv.rows * Minv.cols));