37 #include <visp3/core/vpArray2D.h>
38 #include <visp3/core/vpConfig.h>
39 #include <visp3/core/vpException.h>
40 #include <visp3/core/vpForceTwistMatrix.h>
41 #include <visp3/core/vpHomogeneousMatrix.h>
42 #include <visp3/core/vpRotationMatrix.h>
43 #include <visp3/core/vpTime.h>
44 #include <visp3/core/vpVelocityTwistMatrix.h>
180 vpMatrix(
const vpMatrix &M,
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols);
198 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
200 explicit vpMatrix(
const std::initializer_list<double> &list);
201 explicit vpMatrix(
unsigned int nrows,
unsigned int ncols,
const std::initializer_list<double> &list);
202 explicit vpMatrix(
const std::initializer_list<std::initializer_list<double> > &lists);
211 if (data !=
nullptr) {
216 if (rowPtrs !=
nullptr) {
220 rowNum = colNum = dsize = 0;
258 void diag(
const double &val = 1.0);
262 void eye(
unsigned int n);
264 void eye(
unsigned int m,
unsigned int n);
278 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
282 vpMatrix &
operator=(
const std::initializer_list<std::initializer_list<double> > &lists);
324 vpMatrix extract(
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols)
const;
326 vpColVector getCol(
unsigned int j,
unsigned int i_begin,
unsigned int size)
const;
328 vpRowVector getRow(
unsigned int i,
unsigned int j_begin,
unsigned int size)
const;
330 void init(
const vpMatrix &M,
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols);
339 double det(vpDetMethod method = LU_DECOMPOSITION)
const;
340 double detByLU()
const;
341 #if defined(VISP_HAVE_EIGEN3)
342 double detByLUEigen3()
const;
344 #if defined(VISP_HAVE_LAPACK)
345 double detByLULapack()
const;
347 #if defined(VISP_HAVE_OPENCV)
348 double detByLUOpenCV()
const;
391 double sumSquare()
const;
438 #if defined(VISP_HAVE_EIGEN3)
441 #if defined(VISP_HAVE_LAPACK)
444 #if defined(VISP_HAVE_OPENCV)
452 #if defined(VISP_HAVE_LAPACK)
453 vpMatrix inverseByCholeskyLapack()
const;
455 #if defined(VISP_HAVE_OPENCV)
456 vpMatrix inverseByCholeskyOpenCV()
const;
461 #if defined(VISP_HAVE_LAPACK)
466 vpMatrix inverseTriangular(
bool upper =
true)
const;
468 vpMatrix pseudoInverse(
double svThreshold = 1e-6)
const;
469 unsigned int pseudoInverse(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
470 unsigned int pseudoInverse(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
473 vpMatrix pseudoInverse(
int rank_in)
const;
474 int pseudoInverse(
vpMatrix &Ap,
int rank_in)
const;
479 #if defined(VISP_HAVE_LAPACK)
489 #if defined(VISP_HAVE_EIGEN3)
499 #if defined(VISP_HAVE_OPENCV)
517 double cond(
double svThreshold = 1e-6)
const;
518 unsigned int kernel(
vpMatrix &kerAt,
double svThreshold = 1e-6)
const;
519 unsigned int nullSpace(
vpMatrix &kerA,
double svThreshold = 1e-6)
const;
520 unsigned int nullSpace(
vpMatrix &kerA,
int dim)
const;
529 #ifdef VISP_HAVE_EIGEN3
532 #if defined(VISP_HAVE_LAPACK)
535 #if defined(VISP_HAVE_OPENCV)
546 unsigned int qr(
vpMatrix &Q,
vpMatrix &R,
bool full =
false,
bool squareR =
false,
double tol = 1e-6)
const;
548 double tol = 1e-6)
const;
569 double frobeniusNorm()
const;
570 double inducedL2Norm()
const;
571 double infinityNorm()
const;
579 std::ostream &cppPrint(std::ostream &os,
const std::string &matrixName =
"A",
bool octet =
false)
const;
580 std::ostream &csvPrint(std::ostream &os)
const;
581 std::ostream &maplePrint(std::ostream &os)
const;
582 std::ostream &matlabPrint(std::ostream &os)
const;
583 int print(std::ostream &s,
unsigned int length,
const std::string &intro =
"")
const;
638 static void add2WeightedMatrices(
const vpMatrix &A,
const double &wA,
const vpMatrix &B,
const double &wB,
640 static void computeHLM(
const vpMatrix &H,
const double &alpha,
vpMatrix &HLM);
749 char *header =
nullptr)
897 const char *header =
"")
978 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
979 vp_deprecated
double euclideanNorm()
const;
1029 vp_deprecated
void setIdentity(
const double &val = 1.0);
1035 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1039 vp_deprecated
double detByLUGsl()
const
1041 #if defined(VISP_HAVE_LAPACK)
1042 return detByLULapack();
1051 vp_deprecated
vpMatrix inverseByLUGsl()
const
1053 #if defined(VISP_HAVE_LAPACK)
1054 return inverseByLULapack();
1063 vpMatrix inverseByCholeskyGsl()
const
1065 #if defined(VISP_HAVE_LAPACK)
1066 return inverseByCholeskyLapack();
1077 #if defined(VISP_HAVE_LAPACK)
1078 return inverseByQRLapack();
1087 vpMatrix pseudoInverseGsl(
double svThreshold = 1e-6)
const
1089 #if defined(VISP_HAVE_LAPACK)
1090 return pseudoInverseLapack(svThreshold);
1100 unsigned int pseudoInverseGsl(
vpMatrix &Ap,
double svThreshold = 1e-6)
const
1102 #if defined(VISP_HAVE_LAPACK)
1103 return pseudoInverseLapack(Ap, svThreshold);
1114 unsigned int pseudoInverseGsl(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const
1116 #if defined(VISP_HAVE_LAPACK)
1117 return pseudoInverseLapack(Ap, sv, svThreshold);
1132 #if defined(VISP_HAVE_LAPACK)
1133 return pseudoInverseLapack(Ap, sv, svThreshold, imA, imAt, kerAt);
1150 #if defined(VISP_HAVE_LAPACK)
1164 static unsigned int m_lapack_min_size;
1165 static const unsigned int m_lapack_min_size_default;
1167 #if defined(VISP_HAVE_LAPACK)
1168 static void blas_dgemm(
char trans_a,
char trans_b,
unsigned int M_,
unsigned int N_,
unsigned int K_,
double alpha,
1169 double *a_data,
unsigned int lda_,
double *b_data,
unsigned int ldb_,
double beta,
1170 double *c_data,
unsigned int ldc_);
1171 static void blas_dgemv(
char trans,
unsigned int M_,
unsigned int N_,
double alpha,
double *a_data,
unsigned int lda_,
1172 double *x_data,
int incx_,
double beta,
double *y_data,
int incy_);
1173 static void blas_dsyev(
char jobz,
char uplo,
unsigned int n_,
double *a_data,
unsigned int lda_,
double *w_data,
1174 double *work_data,
int lwork_,
int &info_);
1182 #if defined(VISP_USE_MSVC) && defined(visp_EXPORTS)
1183 const __declspec(selectany)
unsigned int vpMatrix::m_lapack_min_size_default = 0;
1184 __declspec(selectany)
unsigned int vpMatrix::m_lapack_min_size = vpMatrix::m_lapack_min_size_default;
1187 #ifndef DOXYGEN_SHOULD_SKIP_THIS
Implementation of a generic 2D array used as base class for matrices and vectors.
unsigned int getCols() const
static bool loadYAML(const std::string &filename, vpArray2D< Type > &A, char *header=nullptr)
void insert(const vpArray2D< Type > &A, unsigned int r, unsigned int c)
static bool saveYAML(const std::string &filename, const vpArray2D< Type > &A, const char *header="")
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
static bool load(const std::string &filename, vpArray2D< Type > &A, bool binary=false, char *header=nullptr)
vpArray2D< Type > t() const
Compute the transpose of the array.
unsigned int getRows() const
vpArray2D< Type > & operator=(Type x)
Set all the elements of the array to x.
vpArray2D< Type > hadamard(const vpArray2D< Type > &m) const
static bool save(const std::string &filename, const vpArray2D< Type > &A, bool binary=false, const char *header="")
Implementation of column vector and the associated operations.
vpColVector operator*(const double &x, const vpColVector &v)
error that can be emitted by ViSP classes.
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of a matrix and operations on matrices.
static void setLapackMatrixMinSize(unsigned int min_size)
int pseudoInverseOpenCV(vpMatrix &Ap, int rank_in) const
vpMatrix(unsigned int r, unsigned int c)
vpMatrix(unsigned int r, unsigned int c, double val)
vpMatrix pseudoInverseOpenCV(double svThreshold=1e-6) const
int pseudoInverseLapack(vpMatrix &Ap, int rank_in) const
unsigned int pseudoInverseLapack(vpMatrix &Ap, double svThreshold=1e-6) const
static unsigned int getLapackMatrixMinSize()
vpMatrix pseudoInverseEigen3(double svThreshold=1e-6) const
unsigned int pseudoInverseOpenCV(vpMatrix &Ap, double svThreshold=1e-6) const
unsigned int pseudoInverseEigen3(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt, vpMatrix &kerAt) const
int pseudoInverseLapack(vpMatrix &Ap, vpColVector &sv, int rank_in) const
static bool loadMatrix(const std::string &filename, vpArray2D< double > &M, bool binary=false, char *header=nullptr)
int pseudoInverseEigen3(vpMatrix &Ap, vpColVector &sv, int rank_in, vpMatrix &imA, vpMatrix &imAt, vpMatrix &kerAt) const
int pseudoInverseLapack(vpMatrix &Ap, vpColVector &sv, int rank_in, vpMatrix &imA, vpMatrix &imAt, vpMatrix &kerAt) const
vpMatrix pseudoInverseOpenCV(int rank_in) const
vp_deprecated void stackMatrices(const vpMatrix &A)
unsigned int pseudoInverseEigen3(vpMatrix &Ap, vpColVector &sv, double svThreshold=1e-6) const
int pseudoInverseEigen3(vpMatrix &Ap, vpColVector &sv, int rank_in) const
vpMatrix(const vpArray2D< double > &A)
unsigned int pseudoInverseEigen3(vpMatrix &Ap, double svThreshold=1e-6) const
static vp_deprecated vpMatrix stackMatrices(const vpMatrix &A, const vpMatrix &B)
unsigned int pseudoInverseLapack(vpMatrix &Ap, vpColVector &sv, double svThreshold=1e-6) const
vpMatrix pseudoInverseLapack(int rank_in) const
unsigned int pseudoInverseLapack(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt, vpMatrix &kerAt) const
vpMatrix pseudoInverseEigen3(int rank_in) const
int pseudoInverseOpenCV(vpMatrix &Ap, vpColVector &sv, int rank_in, vpMatrix &imA, vpMatrix &imAt, vpMatrix &kerAt) const
int pseudoInverseOpenCV(vpMatrix &Ap, vpColVector &sv, int rank_in) const
vpMatrix pseudoInverseLapack(double svThreshold=1e-6) const
vpMatrix(const vpMatrix &A)
vp_deprecated void init()
int pseudoInverseEigen3(vpMatrix &Ap, int rank_in) const
static bool saveMatrixYAML(const std::string &filename, const vpArray2D< double > &M, const char *header="")
static vp_deprecated void stackMatrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C)
unsigned int pseudoInverseOpenCV(vpMatrix &Ap, vpColVector &sv, double svThreshold=1e-6) const
static bool loadMatrixYAML(const std::string &filename, vpArray2D< double > &M, char *header=nullptr)
static bool saveMatrix(const std::string &filename, const vpArray2D< double > &M, bool binary=false, const char *header="")
unsigned int pseudoInverseOpenCV(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt, vpMatrix &kerAt) const
Implementation of a rotation matrix and operations on such kind of matrices.
Implementation of row vector and the associated operations.
Class that consider the case of a translation vector.
vpMatrix operator*(const double &x, const vpMatrix &A)