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> 198 vpMatrix(
const vpMatrix &M,
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols);
216 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) 218 explicit vpMatrix(
const std::initializer_list<double> &list);
219 explicit vpMatrix(
unsigned int nrows,
unsigned int ncols,
const std::initializer_list<double> &list);
220 explicit vpMatrix(
const std::initializer_list<std::initializer_list<double> > &lists);
237 if (rowPtrs != NULL) {
241 rowNum = colNum = dsize = 0;
249 void diag(
const double &val = 1.0);
253 void eye(
unsigned int n);
255 void eye(
unsigned int m,
unsigned int n);
267 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) 272 vpMatrix&
operator=(
const std::initializer_list<std::initializer_list<double> > &lists);
306 void insert(
const vpMatrix &A,
unsigned int r,
unsigned int c);
314 vpMatrix extract(
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols)
const;
316 vpColVector getCol(
unsigned int j,
unsigned int i_begin,
unsigned int size)
const;
318 vpRowVector getRow(
unsigned int i,
unsigned int j_begin,
unsigned int size)
const;
320 void init(
const vpMatrix &M,
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols);
329 double det(vpDetMethod method = LU_DECOMPOSITION)
const;
330 double detByLU()
const;
331 #ifdef VISP_HAVE_EIGEN3 332 double detByLUEigen3()
const;
335 double detByLUGsl()
const;
337 #if defined(VISP_HAVE_LAPACK) 338 double detByLULapack()
const;
340 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 341 double detByLUOpenCV()
const;
383 double sumSquare()
const;
430 #if defined(VISP_HAVE_EIGEN3) 433 #if defined(VISP_HAVE_GSL) 436 #if defined(VISP_HAVE_LAPACK) 439 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 447 #if defined(VISP_HAVE_LAPACK) 448 vpMatrix inverseByCholeskyLapack()
const;
450 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 451 vpMatrix inverseByCholeskyOpenCV()
const;
456 #if defined(VISP_HAVE_LAPACK) 461 vpMatrix inverseTriangular(
bool upper =
true)
const;
464 vpMatrix pseudoInverse(
double svThreshold = 1e-6)
const;
465 unsigned int pseudoInverse(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
466 unsigned int pseudoInverse(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
471 #if defined(VISP_HAVE_LAPACK) 472 vpMatrix pseudoInverseLapack(
double svThreshold = 1e-6)
const;
473 unsigned int pseudoInverseLapack(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
474 unsigned int pseudoInverseLapack(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
478 #if defined(VISP_HAVE_EIGEN3) 479 vpMatrix pseudoInverseEigen3(
double svThreshold = 1e-6)
const;
480 unsigned int pseudoInverseEigen3(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
481 unsigned int pseudoInverseEigen3(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
485 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) 486 vpMatrix pseudoInverseOpenCV(
double svThreshold = 1e-6)
const;
487 unsigned int pseudoInverseOpenCV(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
488 unsigned int pseudoInverseOpenCV(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
492 #if defined(VISP_HAVE_GSL) 493 vpMatrix pseudoInverseGsl(
double svThreshold = 1e-6)
const;
494 unsigned int pseudoInverseGsl(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
495 unsigned int pseudoInverseGsl(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
508 double cond(
double svThreshold = 1e-6)
const;
509 unsigned int kernel(
vpMatrix &kerAt,
double svThreshold = 1e-6)
const;
518 #ifdef VISP_HAVE_EIGEN3 524 #if defined(VISP_HAVE_LAPACK) 527 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1 538 unsigned int qr(
vpMatrix &Q,
vpMatrix &R,
bool full =
false,
bool squareR =
false,
double tol = 1e-6)
const;
539 unsigned int qrPivot(
vpMatrix &Q,
vpMatrix &R,
vpMatrix &P,
bool full =
false,
bool squareR =
false,
double tol = 1e-6)
const;
560 double euclideanNorm()
const;
561 double frobeniusNorm()
const;
562 double inducedL2Norm()
const;
563 double infinityNorm()
const;
571 std::ostream &cppPrint(std::ostream &os,
const std::string &matrixName =
"A",
bool octet =
false)
const;
572 std::ostream &csvPrint(std::ostream &os)
const;
573 std::ostream &maplePrint(std::ostream &os)
const;
574 std::ostream &matlabPrint(std::ostream &os)
const;
575 int print(std::ostream &s,
unsigned int length,
const std::string &intro =
"")
const;
630 static void add2WeightedMatrices(
const vpMatrix &A,
const double &wA,
const vpMatrix &B,
const double &wB,
632 static void computeHLM(
const vpMatrix &H,
const double &alpha,
vpMatrix &HLM);
728 const char *header =
"")
751 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) 800 vp_deprecated
void setIdentity(
const double &val = 1.0);
809 #if defined(VISP_HAVE_LAPACK) && !defined(VISP_HAVE_LAPACK_BUILT_IN) 810 static void blas_dgemm(
char trans_a,
char trans_b,
int M,
int N,
int K,
double alpha,
811 double *a_data,
int lda,
double *b_data,
int ldb,
double beta,
double *c_data,
813 static void blas_dgemv(
char trans,
int M,
int N,
double alpha,
double *a_data,
int lda,
814 double *x_data,
int incx,
double beta,
double *y_data,
int incy);
823 #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="")
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
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 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)