39 #include <visp3/core/vpArray2D.h> 40 #include <visp3/core/vpConfig.h> 41 #include <visp3/core/vpException.h> 42 #include <visp3/core/vpForceTwistMatrix.h> 43 #include <visp3/core/vpHomogeneousMatrix.h> 44 #include <visp3/core/vpRotationMatrix.h> 45 #include <visp3/core/vpTime.h> 46 #include <visp3/core/vpVelocityTwistMatrix.h> 187 vpMatrix(
const vpMatrix &M,
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols);
205 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) 207 explicit vpMatrix(
const std::initializer_list<double> &list);
208 explicit vpMatrix(
unsigned int nrows,
unsigned int ncols,
const std::initializer_list<double> &list);
209 explicit vpMatrix(
const std::initializer_list<std::initializer_list<double> > &lists);
226 if (rowPtrs != NULL) {
230 rowNum = colNum = dsize = 0;
268 void diag(
const double &val = 1.0);
272 void eye(
unsigned int n);
274 void eye(
unsigned int m,
unsigned int n);
286 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) 291 vpMatrix &
operator=(
const std::initializer_list<std::initializer_list<double> > &lists);
325 void insert(
const vpMatrix &A,
unsigned int r,
unsigned int c);
333 vpMatrix extract(
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols)
const;
335 vpColVector getCol(
unsigned int j,
unsigned int i_begin,
unsigned int size)
const;
337 vpRowVector getRow(
unsigned int i,
unsigned int j_begin,
unsigned int size)
const;
339 void init(
const vpMatrix &M,
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols);
348 double det(vpDetMethod method = LU_DECOMPOSITION)
const;
349 double detByLU()
const;
350 #ifdef VISP_HAVE_EIGEN3 351 double detByLUEigen3()
const;
353 #if defined(VISP_HAVE_LAPACK) 354 double detByLULapack()
const;
356 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 357 double detByLUOpenCV()
const;
400 double sumSquare()
const;
447 #if defined(VISP_HAVE_EIGEN3) 450 #if defined(VISP_HAVE_LAPACK) 453 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 461 #if defined(VISP_HAVE_LAPACK) 462 vpMatrix inverseByCholeskyLapack()
const;
464 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 465 vpMatrix inverseByCholeskyOpenCV()
const;
470 #if defined(VISP_HAVE_LAPACK) 475 vpMatrix inverseTriangular(
bool upper =
true)
const;
477 vpMatrix pseudoInverse(
double svThreshold = 1e-6)
const;
478 unsigned int pseudoInverse(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
479 unsigned int pseudoInverse(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
483 vpMatrix pseudoInverse(
int rank_in)
const;
484 int pseudoInverse(
vpMatrix &Ap,
int rank_in)
const;
489 #if defined(VISP_HAVE_LAPACK) 490 vpMatrix pseudoInverseLapack(
double svThreshold = 1e-6)
const;
491 unsigned int pseudoInverseLapack(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
492 unsigned int pseudoInverseLapack(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
495 vpMatrix pseudoInverseLapack(
int rank_in)
const;
496 int pseudoInverseLapack(
vpMatrix &Ap,
int rank_in)
const;
501 #if defined(VISP_HAVE_EIGEN3) 502 vpMatrix pseudoInverseEigen3(
double svThreshold = 1e-6)
const;
503 unsigned int pseudoInverseEigen3(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
504 unsigned int pseudoInverseEigen3(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
507 vpMatrix pseudoInverseEigen3(
int rank_in)
const;
508 int pseudoInverseEigen3(
vpMatrix &Ap,
int rank_in)
const;
513 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 514 vpMatrix pseudoInverseOpenCV(
double svThreshold = 1e-6)
const;
515 unsigned int pseudoInverseOpenCV(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
516 unsigned int pseudoInverseOpenCV(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
519 vpMatrix pseudoInverseOpenCV(
int rank_in)
const;
520 int pseudoInverseOpenCV(
vpMatrix &Ap,
int rank_in)
const;
533 double cond(
double svThreshold = 1e-6)
const;
534 unsigned int kernel(
vpMatrix &kerAt,
double svThreshold = 1e-6)
const;
535 unsigned int nullSpace(
vpMatrix &kerA,
double svThreshold = 1e-6)
const;
536 unsigned int nullSpace(
vpMatrix &kerA,
int dim)
const;
545 #ifdef VISP_HAVE_EIGEN3 548 #if defined(VISP_HAVE_LAPACK) 551 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1 562 unsigned int qr(
vpMatrix &Q,
vpMatrix &R,
bool full =
false,
bool squareR =
false,
double tol = 1e-6)
const;
564 double tol = 1e-6)
const;
585 double euclideanNorm()
const;
586 double frobeniusNorm()
const;
587 double inducedL2Norm()
const;
588 double infinityNorm()
const;
596 std::ostream &cppPrint(std::ostream &os,
const std::string &matrixName =
"A",
bool octet =
false)
const;
597 std::ostream &csvPrint(std::ostream &os)
const;
598 std::ostream &maplePrint(std::ostream &os)
const;
599 std::ostream &matlabPrint(std::ostream &os)
const;
600 int print(std::ostream &s,
unsigned int length,
const std::string &intro =
"")
const;
655 static void add2WeightedMatrices(
const vpMatrix &A,
const double &wA,
const vpMatrix &B,
const double &wB,
657 static void computeHLM(
const vpMatrix &H,
const double &alpha,
vpMatrix &HLM);
753 const char *header =
"")
776 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) 825 vp_deprecated
void setIdentity(
const double &val = 1.0);
831 #ifndef DOXYGEN_SHOULD_SKIP_THIS 835 vp_deprecated
double detByLUGsl()
const 837 #if defined(VISP_HAVE_LAPACK) 838 return detByLULapack();
847 vp_deprecated
vpMatrix inverseByLUGsl()
const 849 #if defined(VISP_HAVE_LAPACK) 850 return inverseByLULapack();
859 vpMatrix inverseByCholeskyGsl()
const 861 #if defined(VISP_HAVE_LAPACK) 862 return inverseByCholeskyLapack();
873 #if defined(VISP_HAVE_LAPACK) 874 return inverseByQRLapack();
883 vpMatrix pseudoInverseGsl(
double svThreshold = 1e-6)
const 885 #if defined(VISP_HAVE_LAPACK) 886 return pseudoInverseLapack(svThreshold);
896 unsigned int pseudoInverseGsl(
vpMatrix &Ap,
double svThreshold = 1e-6)
const 898 #if defined(VISP_HAVE_LAPACK) 899 return pseudoInverseLapack(Ap, svThreshold);
910 unsigned int pseudoInverseGsl(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const 912 #if defined(VISP_HAVE_LAPACK) 913 return pseudoInverseLapack(Ap, sv, svThreshold);
928 #if defined(VISP_HAVE_LAPACK) 929 return pseudoInverseLapack(Ap, sv, svThreshold, imA, imAt, kerAt);
946 #if defined(VISP_HAVE_LAPACK) 955 #endif // ifndef DOXYGEN_SHOULD_SKIP_THIS 960 static unsigned int m_lapack_min_size;
961 static const unsigned int m_lapack_min_size_default;
963 #if defined(VISP_HAVE_LAPACK) 964 static void blas_dgemm(
char trans_a,
char trans_b,
unsigned int M_,
unsigned int N_,
unsigned int K_,
double alpha,
965 double *a_data,
unsigned int lda_,
double *b_data,
unsigned int ldb_,
double beta,
966 double *c_data,
unsigned int ldc_);
967 static void blas_dgemv(
char trans,
unsigned int M_,
unsigned int N_,
double alpha,
double *a_data,
unsigned int lda_,
968 double *x_data,
int incx_,
double beta,
double *y_data,
int incy_);
969 static void blas_dsyev(
char jobz,
char uplo,
unsigned int n_,
double *a_data,
unsigned int lda_,
double *w_data,
970 double *work_data,
int lwork_,
int &info_);
978 #if defined(VISP_USE_MSVC) && defined(visp_EXPORTS) 979 const __declspec(selectany)
unsigned int vpMatrix::m_lapack_min_size_default = 0;
980 __declspec(selectany)
unsigned int vpMatrix::m_lapack_min_size = vpMatrix::m_lapack_min_size_default;
983 #ifndef DOXYGEN_SHOULD_SKIP_THIS Implementation of a matrix and operations on matrices.
static bool saveYAML(const std::string &filename, const vpArray2D< Type > &A, const char *header="")
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.
static bool save(const std::string &filename, const vpArray2D< Type > &A, bool binary=false, const char *header="")
error that can be emited by ViSP classes.
unsigned int getRows() const
vp_deprecated void stackMatrices(const vpMatrix &A)
Implementation of a generic 2D array used as base class for matrices and vectors. ...
static bool saveMatrix(const std::string &filename, const vpArray2D< double > &M, bool binary=false, const char *header="")
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
static unsigned int getLapackMatrixMinSize()
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()
vpArray2D< Type > hadamard(const vpArray2D< Type > &m) const
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
static void setLapackMatrixMinSize(unsigned int min_size)
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="")
vpMatrix(const vpArray2D< double > &A)
Class that consider the case of a translation vector.
static bool loadMatrix(const std::string &filename, vpArray2D< double > &M, bool binary=false, char *header=NULL)
static bool load(const std::string &filename, vpArray2D< Type > &A, bool binary=false, char *header=NULL)
static bool loadMatrixYAML(const std::string &filename, vpArray2D< double > &M, char *header=NULL)