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 108 return inverseByCholeskyLapack();
109 #elif (VISP_HAVE_OPENCV_VERSION >= 0x020101) 110 return inverseByCholeskyOpenCV();
113 "Cholesky. Install Lapack or " 114 "OpenCV 3rd party"));
118 #ifndef DOXYGEN_SHOULD_SKIP_THIS 120 #ifdef VISP_HAVE_LAPACK 157 vpMatrix vpMatrix::inverseByCholeskyLapack()
const 164 integer rowNum_ = (integer)this->
getRows();
165 integer lda = (integer)rowNum_;
169 dpotrf_((
char *)
"L", &rowNum_, A.
data, &lda, &info);
174 dpotri_((
char *)
"L", &rowNum_, A.
data, &lda, &info);
176 std::cout <<
"cholesky:dpotri_:error" << std::endl;
180 for (
unsigned int i = 0; i < A.
getRows(); i++)
181 for (
unsigned int j = 0; j < A.
getCols(); j++)
189 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 226 vpMatrix vpMatrix::inverseByCholeskyOpenCV()
const 234 cv::Mat Minv = M.inv(cv::DECOMP_CHOLESKY);
237 memcpy(A.
data, Minv.data, (
size_t)(8 * Minv.rows * Minv.cols));
243 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
Implementation of a matrix and operations on matrices.
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.
error that can be emited by the vpMatrix class and its derivates