42 #include <visp3/core/vpArray2D.h> 43 #include <visp3/core/vpConfig.h> 44 #include <visp3/core/vpException.h> 45 #include <visp3/core/vpForceTwistMatrix.h> 46 #include <visp3/core/vpHomogeneousMatrix.h> 47 #include <visp3/core/vpRotationMatrix.h> 48 #include <visp3/core/vpTime.h> 49 #include <visp3/core/vpVelocityTwistMatrix.h> 52 #include <gsl/gsl_eigen.h> 53 #include <gsl/gsl_math.h> 136 vpMatrix(
const vpMatrix &M,
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols);
151 #ifdef VISP_HAVE_CPP11_COMPATIBILITY 171 if (rowPtrs != NULL) {
175 rowNum = colNum = dsize = 0;
183 void diag(
const double &val = 1.0);
187 void eye(
unsigned int n);
189 void eye(
unsigned int m,
unsigned int n);
199 #ifdef VISP_HAVE_CPP11_COMPATIBILITY 234 void insert(
const vpMatrix &A,
const unsigned int r,
const unsigned int c);
242 vpMatrix extract(
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols)
const;
244 vpColVector getCol(
const unsigned int j,
const unsigned int i_begin,
const unsigned int size)
const;
246 vpRowVector getRow(
const unsigned int i,
const unsigned int j_begin,
const unsigned int size)
const;
247 void init(
const vpMatrix &M,
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols);
256 double det(vpDetMethod method = LU_DECOMPOSITION)
const;
257 double detByLU()
const;
258 #ifndef DOXYGEN_SHOULD_SKIP_THIS 259 #ifdef VISP_HAVE_EIGEN3 260 double detByLUEigen3()
const;
263 double detByLUGsl()
const;
265 #ifdef VISP_HAVE_LAPACK 266 double detByLULapack()
const;
268 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 269 double detByLUOpenCV()
const;
271 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS 293 vpMatrix &operator+=(
const double x);
295 vpMatrix &operator-=(
const double x);
297 vpMatrix &operator*=(
const double x);
302 vpMatrix operator*(
const double x)
const;
304 vpMatrix operator/(
const double x)
const;
312 double sumSquare()
const;
359 #ifndef DOXYGEN_SHOULD_SKIP_THIS 360 #if defined(VISP_HAVE_EIGEN3) 363 #if defined(VISP_HAVE_GSL) 366 #if defined(VISP_HAVE_LAPACK) 369 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 372 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS 378 #ifndef DOXYGEN_SHOULD_SKIP_THIS 379 #if defined(VISP_HAVE_LAPACK) 380 vpMatrix inverseByCholeskyLapack()
const;
382 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 383 vpMatrix inverseByCholeskyOpenCV()
const;
385 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS 390 #ifndef DOXYGEN_SHOULD_SKIP_THIS 391 #if defined(VISP_HAVE_LAPACK) 394 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS 396 vpMatrix pseudoInverse(
double svThreshold = 1e-6)
const;
397 unsigned int pseudoInverse(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
398 unsigned int pseudoInverse(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
403 #ifndef DOXYGEN_SHOULD_SKIP_THIS 404 #if defined(VISP_HAVE_LAPACK) 405 vpMatrix pseudoInverseLapack(
double svThreshold = 1e-6)
const;
406 unsigned int pseudoInverseLapack(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
407 unsigned int pseudoInverseLapack(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
411 #if defined(VISP_HAVE_EIGEN3) 412 vpMatrix pseudoInverseEigen3(
double svThreshold = 1e-6)
const;
413 unsigned int pseudoInverseEigen3(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
414 unsigned int pseudoInverseEigen3(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
418 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 419 vpMatrix pseudoInverseOpenCV(
double svThreshold = 1e-6)
const;
420 unsigned int pseudoInverseOpenCV(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
421 unsigned int pseudoInverseOpenCV(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
425 #if defined(VISP_HAVE_GSL) 426 vpMatrix pseudoInverseGsl(
double svThreshold = 1e-6)
const;
427 unsigned int pseudoInverseGsl(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
428 unsigned int pseudoInverseGsl(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
432 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS 443 unsigned int kernel(
vpMatrix &kerAt,
double svThreshold = 1e-6)
const;
452 #ifndef DOXYGEN_SHOULD_SKIP_THIS 453 #ifdef VISP_HAVE_EIGEN3 459 #ifdef VISP_HAVE_LAPACK 462 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1 484 double euclideanNorm()
const;
485 double infinityNorm()
const;
493 std::ostream &cppPrint(std::ostream &os,
const std::string &matrixName =
"A",
bool octet =
false)
const;
494 std::ostream &csvPrint(std::ostream &os)
const;
495 std::ostream &maplePrint(std::ostream &os)
const;
496 std::ostream &matlabPrint(std::ostream &os)
const;
497 int print(std::ostream &s,
unsigned int length,
char const *intro = 0)
const;
550 static void add2WeightedMatrices(
const vpMatrix &A,
const double &wA,
const vpMatrix &B,
const double &wB,
552 static void computeHLM(
const vpMatrix &H,
const double &alpha,
vpMatrix &HLM);
641 const char *header =
"")
664 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) 713 vp_deprecated
void setIdentity(
const double &val = 1.0);
715 vp_deprecated
vpRowVector row(
const unsigned int i);
716 vp_deprecated
vpColVector column(
const unsigned int j);
722 #if defined(VISP_HAVE_LAPACK) && !defined(VISP_HAVE_LAPACK_BUILT_IN) 723 static void blas_dgemm(
char trans_a,
char trans_b,
const int M,
const int N,
const int K,
double alpha,
724 double *a_data,
const int lda,
double *b_data,
const int ldb,
double beta,
double *c_data,
726 static void blas_dgemv(
char trans,
const int M,
const int N,
double alpha,
double *a_data,
const int lda,
727 double *x_data,
const int incx,
double beta,
double *y_data,
const int incy);
736 #ifndef DOXYGEN_SHOULD_SKIP_THIS Implementation of a matrix and operations on matrices.
static bool save(const std::string &filename, const vpArray2D< Type > &A, const bool binary=false, const char *header="")
static bool saveYAML(const std::string &filename, const vpArray2D< Type > &A, const char *header="")
static bool loadMatrix(const std::string &filename, vpArray2D< double > &M, const bool binary=false, char *header=NULL)
vpArray2D< Type > & operator=(Type x)
Set all the elements of the array to x.
static bool loadYAML(const std::string &filename, vpArray2D< Type > &A, char *header=NULL)
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of row vector and the associated operations.
unsigned int getRows() const
vp_deprecated void stackMatrices(const vpMatrix &A)
Implementation of a generic 2D array used as vase class of matrices and vectors.
vpMatrix(unsigned int r, unsigned int c, double val)
Implementation of a rotation matrix and operations on such kind of matrices.
unsigned int getCols() const
vpColVector operator*(const double &x, const vpColVector &v)
static vp_deprecated void stackMatrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C)
vpMatrix(const vpMatrix &A)
vp_deprecated void init()
static bool load(const std::string &filename, vpArray2D< Type > &A, const bool binary=false, char *header=NULL)
vpArray2D< Type > hadamard(const vpArray2D< Type > &m) const
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
static vp_deprecated vpMatrix stackMatrices(const vpMatrix &A, const vpMatrix &B)
vpMatrix(unsigned int r, unsigned int c)
Implementation of column vector and the associated operations.
virtual ~vpMatrix()
Destructor (Memory de-allocation)
static bool saveMatrixYAML(const std::string &filename, const vpArray2D< double > &M, const char *header="")
static bool saveMatrix(const std::string &filename, const vpArray2D< double > &M, const bool binary=false, const char *header="")
vpMatrix(const vpArray2D< double > &A)
Class that consider the case of a translation vector.
static bool loadMatrixYAML(const std::string &filename, vpArray2D< double > &M, char *header=NULL)