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;
247 return m_lapack_min_size;
263 m_lapack_min_size = min_size;
272 void diag(
const double &val = 1.0);
276 void eye(
unsigned int n);
278 void eye(
unsigned int m,
unsigned int n);
290 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) 295 vpMatrix&
operator=(
const std::initializer_list<std::initializer_list<double> > &lists);
329 void insert(
const vpMatrix &A,
unsigned int r,
unsigned int c);
337 vpMatrix extract(
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols)
const;
339 vpColVector getCol(
unsigned int j,
unsigned int i_begin,
unsigned int size)
const;
341 vpRowVector getRow(
unsigned int i,
unsigned int j_begin,
unsigned int size)
const;
343 void init(
const vpMatrix &M,
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols);
352 double det(vpDetMethod method = LU_DECOMPOSITION)
const;
353 double detByLU()
const;
354 #ifdef VISP_HAVE_EIGEN3 355 double detByLUEigen3()
const;
357 #if defined(VISP_HAVE_LAPACK) 358 double detByLULapack()
const;
360 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 361 double detByLUOpenCV()
const;
404 double sumSquare()
const;
451 #if defined(VISP_HAVE_EIGEN3) 454 #if defined(VISP_HAVE_LAPACK) 457 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 465 #if defined(VISP_HAVE_LAPACK) 466 vpMatrix inverseByCholeskyLapack()
const;
468 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 469 vpMatrix inverseByCholeskyOpenCV()
const;
474 #if defined(VISP_HAVE_LAPACK) 479 vpMatrix inverseTriangular(
bool upper =
true)
const;
481 vpMatrix pseudoInverse(
double svThreshold = 1e-6)
const;
482 unsigned int pseudoInverse(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
483 unsigned int pseudoInverse(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
486 vpMatrix pseudoInverse(
int rank_in)
const;
487 int pseudoInverse(
vpMatrix &Ap,
int rank_in)
const;
492 #if defined(VISP_HAVE_LAPACK) 493 vpMatrix pseudoInverseLapack(
double svThreshold = 1e-6)
const;
494 unsigned int pseudoInverseLapack(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
495 unsigned int pseudoInverseLapack(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
497 vpMatrix pseudoInverseLapack(
int rank_in)
const;
498 int pseudoInverseLapack(
vpMatrix &Ap,
int rank_in)
const;
502 #if defined(VISP_HAVE_EIGEN3) 503 vpMatrix pseudoInverseEigen3(
double svThreshold = 1e-6)
const;
504 unsigned int pseudoInverseEigen3(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
505 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;
512 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 513 vpMatrix pseudoInverseOpenCV(
double svThreshold = 1e-6)
const;
514 unsigned int pseudoInverseOpenCV(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
515 unsigned int pseudoInverseOpenCV(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
517 vpMatrix pseudoInverseOpenCV(
int rank_in)
const;
518 int pseudoInverseOpenCV(
vpMatrix &Ap,
int rank_in)
const;
530 double cond(
double svThreshold = 1e-6)
const;
531 unsigned int kernel(
vpMatrix &kerAt,
double svThreshold = 1e-6)
const;
532 unsigned int nullSpace(
vpMatrix &kerA,
double svThreshold = 1e-6)
const;
533 unsigned int nullSpace(
vpMatrix &kerA,
int dim)
const;
542 #ifdef VISP_HAVE_EIGEN3 545 #if defined(VISP_HAVE_LAPACK) 548 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1 559 unsigned int qr(
vpMatrix &Q,
vpMatrix &R,
bool full =
false,
bool squareR =
false,
double tol = 1e-6)
const;
560 unsigned int qrPivot(
vpMatrix &Q,
vpMatrix &R,
vpMatrix &P,
bool full =
false,
bool squareR =
false,
double tol = 1e-6)
const;
581 double euclideanNorm()
const;
582 double frobeniusNorm()
const;
583 double inducedL2Norm()
const;
584 double infinityNorm()
const;
592 std::ostream &cppPrint(std::ostream &os,
const std::string &matrixName =
"A",
bool octet =
false)
const;
593 std::ostream &csvPrint(std::ostream &os)
const;
594 std::ostream &maplePrint(std::ostream &os)
const;
595 std::ostream &matlabPrint(std::ostream &os)
const;
596 int print(std::ostream &s,
unsigned int length,
const std::string &intro =
"")
const;
651 static void add2WeightedMatrices(
const vpMatrix &A,
const double &wA,
const vpMatrix &B,
const double &wB,
653 static void computeHLM(
const vpMatrix &H,
const double &alpha,
vpMatrix &HLM);
749 const char *header =
"")
772 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) 821 vp_deprecated
void setIdentity(
const double &val = 1.0);
827 #ifndef DOXYGEN_SHOULD_SKIP_THIS 831 vp_deprecated
double detByLUGsl()
const {
832 #if defined(VISP_HAVE_LAPACK) 833 return detByLULapack();
836 "Undefined detByLULapack(). Install Lapack 3rd party"));
843 vp_deprecated
vpMatrix inverseByLUGsl()
const {
844 #if defined(VISP_HAVE_LAPACK) 845 return inverseByLULapack();
848 "Undefined inverseByLULapack(). Install Lapack 3rd party"));
855 vpMatrix inverseByCholeskyGsl()
const {
856 #if defined(VISP_HAVE_LAPACK) 857 return inverseByCholeskyLapack();
860 "Undefined inverseByCholeskyLapack(). Install Lapack 3rd party"));
868 #if defined(VISP_HAVE_LAPACK) 869 return inverseByQRLapack();
872 "Undefined inverseByQRLapack(). Install Lapack 3rd party"));
879 vpMatrix pseudoInverseGsl(
double svThreshold = 1e-6)
const {
880 #if defined(VISP_HAVE_LAPACK) 881 return pseudoInverseLapack(svThreshold);
885 "Undefined pseudoInverseLapack(). Install Lapack 3rd party"));
892 unsigned int pseudoInverseGsl(
vpMatrix &Ap,
double svThreshold = 1e-6)
const {
893 #if defined(VISP_HAVE_LAPACK) 894 return pseudoInverseLapack(Ap, svThreshold);
899 "Undefined pseudoInverseLapack(). Install Lapack 3rd party"));
906 unsigned int pseudoInverseGsl(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const {
907 #if defined(VISP_HAVE_LAPACK) 908 return pseudoInverseLapack(Ap, sv, svThreshold);
914 "Undefined pseudoInverseLapack(). Install Lapack 3rd party"));
923 #if defined(VISP_HAVE_LAPACK) 924 return pseudoInverseLapack(Ap, sv, svThreshold, imA, imAt, kerAt);
933 "Undefined pseudoInverseLapack(). Install Lapack 3rd party"));
941 #if defined(VISP_HAVE_LAPACK) 947 "Undefined svdLapack(). Install Lapack 3rd party"));
951 #endif // ifndef DOXYGEN_SHOULD_SKIP_THIS 956 static unsigned int m_lapack_min_size;
957 static const unsigned int m_lapack_min_size_default;
959 #if defined(VISP_HAVE_LAPACK) 960 static void blas_dgemm(
char trans_a,
char trans_b,
unsigned int M_,
unsigned int N_,
unsigned int K_,
double alpha,
961 double *a_data,
unsigned int lda_,
double *b_data,
unsigned int ldb_,
double beta,
double *c_data,
963 static void blas_dgemv(
char trans,
unsigned int M_,
unsigned int N_,
double alpha,
double *a_data,
unsigned int lda_,
964 double *x_data,
int incx_,
double beta,
double *y_data,
int incy_);
965 static void blas_dsyev(
char jobz,
char uplo,
unsigned int n_,
double *a_data,
unsigned int lda_,
966 double *w_data,
double *work_data,
int lwork_,
int &info_);
974 #if defined(VISP_USE_MSVC) && defined(visp_EXPORTS) 975 const __declspec(selectany)
unsigned int vpMatrix::m_lapack_min_size_default = 0;
976 __declspec(selectany)
unsigned int vpMatrix::m_lapack_min_size = vpMatrix::m_lapack_min_size_default;
979 #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)