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 58 # include <gsl/gsl_linalg.h> 62 typedef MKL_INT integer;
63 # elif !defined(VISP_HAVE_GSL) 64 # ifdef VISP_HAVE_LAPACK_BUILT_IN 65 typedef long int integer;
69 extern "C" void dpotrf_(
char *uplo, integer *n,
double *a, integer *lda, integer *info);
70 extern "C" int dpotri_(
char *uplo, integer *n,
double *a, integer *lda, integer *info);
114 #if defined(VISP_HAVE_LAPACK) 116 #elif (VISP_HAVE_OPENCV_VERSION >= 0x020101) 120 "Cholesky. Install Lapack or " 121 "OpenCV 3rd party"));
125 #if defined(VISP_HAVE_LAPACK) 164 #if defined(VISP_HAVE_GSL) 171 cholesky.tda = cholesky.size2;
172 cholesky.data = invA.
data;
176 #if (GSL_MAJOR_VERSION >= 2 && GSL_MINOR_VERSION >= 3) 177 gsl_linalg_cholesky_decomp1(&cholesky);
179 gsl_linalg_cholesky_decomp(&cholesky);
181 gsl_linalg_cholesky_invert(&cholesky);
191 integer rowNum_ = (integer)this->
getRows();
192 integer lda = (integer)rowNum_;
196 dpotrf_((
char *)
"L", &rowNum_, A.
data, &lda, &info);
201 dpotri_((
char *)
"L", &rowNum_, A.
data, &lda, &info);
203 std::cout <<
"cholesky:dpotri_:error" << std::endl;
207 for (
unsigned int i = 0; i < A.
getRows(); i++)
208 for (
unsigned int j = 0; j < A.
getCols(); j++)
218 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 263 cv::Mat Minv = M.inv(cv::DECOMP_CHOLESKY);
266 memcpy(A.
data, Minv.data, (
size_t)(8 * Minv.rows * Minv.cols));
Used to indicate that a value is not in the allowed range.
Implementation of a matrix and operations on matrices.
vpMatrix inverseByCholeskyOpenCV() const
error that can be emited by ViSP classes.
unsigned int getRows() const
Type * data
Address of the first element of the data array.
unsigned int getCols() const
unsigned int rowNum
Number of rows in the array.
vpMatrix inverseByCholesky() const
unsigned int colNum
Number of columns in the array.
vpMatrix inverseByCholeskyLapack() const
error that can be emited by the vpMatrix class and its derivates