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 235 void insert(
const vpMatrix &A,
const unsigned int r,
const unsigned int c);
243 vpMatrix extract(
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols)
const;
245 vpColVector getCol(
const unsigned int j,
const unsigned int i_begin,
const unsigned int size)
const;
247 vpRowVector getRow(
const unsigned int i,
const unsigned int j_begin,
const unsigned int size)
const;
248 void init(
const vpMatrix &M,
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols);
257 double det(vpDetMethod method = LU_DECOMPOSITION)
const;
258 double detByLU()
const;
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;
292 vpMatrix &operator+=(
const double x);
294 vpMatrix &operator-=(
const double x);
296 vpMatrix &operator*=(
const double x);
301 vpMatrix operator*(
const double x)
const;
303 vpMatrix operator/(
const double x)
const;
311 double sumSquare()
const;
358 #if defined(VISP_HAVE_EIGEN3) 361 #if defined(VISP_HAVE_GSL) 364 #if defined(VISP_HAVE_LAPACK) 367 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 375 #if defined(VISP_HAVE_LAPACK) 376 vpMatrix inverseByCholeskyLapack()
const;
378 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 379 vpMatrix inverseByCholeskyOpenCV()
const;
384 #if defined(VISP_HAVE_LAPACK) 389 vpMatrix inverseTriangular(
bool upper =
true)
const;
392 vpMatrix pseudoInverse(
double svThreshold = 1e-6)
const;
393 unsigned int pseudoInverse(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
394 unsigned int pseudoInverse(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
399 #if defined(VISP_HAVE_LAPACK) 400 vpMatrix pseudoInverseLapack(
double svThreshold = 1e-6)
const;
401 unsigned int pseudoInverseLapack(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
402 unsigned int pseudoInverseLapack(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
406 #if defined(VISP_HAVE_EIGEN3) 407 vpMatrix pseudoInverseEigen3(
double svThreshold = 1e-6)
const;
408 unsigned int pseudoInverseEigen3(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
409 unsigned int pseudoInverseEigen3(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
413 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 414 vpMatrix pseudoInverseOpenCV(
double svThreshold = 1e-6)
const;
415 unsigned int pseudoInverseOpenCV(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
416 unsigned int pseudoInverseOpenCV(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
420 #if defined(VISP_HAVE_GSL) 421 vpMatrix pseudoInverseGsl(
double svThreshold = 1e-6)
const;
422 unsigned int pseudoInverseGsl(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
423 unsigned int pseudoInverseGsl(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
437 unsigned int kernel(
vpMatrix &kerAt,
double svThreshold = 1e-6)
const;
446 #ifdef VISP_HAVE_EIGEN3 452 #ifdef VISP_HAVE_LAPACK 455 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1 466 unsigned int qr(
vpMatrix &Q,
vpMatrix &R,
bool full =
false,
bool squareR =
false,
double tol = 1e-6)
const;
467 unsigned int qrPivot(
vpMatrix &Q,
vpMatrix &R,
vpMatrix &P,
bool full =
false,
bool squareR =
false,
double tol = 1e-6)
const;
488 double euclideanNorm()
const;
489 double infinityNorm()
const;
497 std::ostream &cppPrint(std::ostream &os,
const std::string &matrixName =
"A",
bool octet =
false)
const;
498 std::ostream &csvPrint(std::ostream &os)
const;
499 std::ostream &maplePrint(std::ostream &os)
const;
500 std::ostream &matlabPrint(std::ostream &os)
const;
501 int print(std::ostream &s,
unsigned int length,
char const *intro = 0)
const;
556 static void add2WeightedMatrices(
const vpMatrix &A,
const double &wA,
const vpMatrix &B,
const double &wB,
558 static void computeHLM(
const vpMatrix &H,
const double &alpha,
vpMatrix &HLM);
654 const char *header =
"")
677 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) 726 vp_deprecated
void setIdentity(
const double &val = 1.0);
728 vp_deprecated
vpRowVector row(
const unsigned int i);
729 vp_deprecated
vpColVector column(
const unsigned int j);
735 #if defined(VISP_HAVE_LAPACK) && !defined(VISP_HAVE_LAPACK_BUILT_IN) 736 static void blas_dgemm(
char trans_a,
char trans_b,
const int M,
const int N,
const int K,
double alpha,
737 double *a_data,
const int lda,
double *b_data,
const int ldb,
double beta,
double *c_data,
739 static void blas_dgemv(
char trans,
const int M,
const int N,
double alpha,
double *a_data,
const int lda,
740 double *x_data,
const int incx,
double beta,
double *y_data,
const int incy);
749 #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.
vp_deprecated void stackMatrices(const vpMatrix &A)
Implementation of a generic 2D array used as vase class of matrices and vectors.
unsigned int getCols() const
vpMatrix(unsigned int r, unsigned int c, double val)
Implementation of a rotation matrix and operations on such kind of matrices.
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)
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
unsigned int getRows() const
vpArray2D< Type > hadamard(const vpArray2D< Type > &m) const
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)