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>
186 vpMatrix(
const vpMatrix &M,
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols);
204#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
206 explicit vpMatrix(
const std::initializer_list<double> &list);
207 explicit vpMatrix(
unsigned int nrows,
unsigned int ncols,
const std::initializer_list<double> &list);
208 explicit vpMatrix(
const std::initializer_list<std::initializer_list<double> > &lists);
225 if (rowPtrs != NULL) {
229 rowNum = colNum = dsize = 0;
267 void diag(
const double &val = 1.0);
271 void eye(
unsigned int n);
273 void eye(
unsigned int m,
unsigned int n);
285#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
290 vpMatrix &
operator=(
const std::initializer_list<std::initializer_list<double> > &lists);
332 vpMatrix extract(
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols)
const;
334 vpColVector getCol(
unsigned int j,
unsigned int i_begin,
unsigned int size)
const;
336 vpRowVector getRow(
unsigned int i,
unsigned int j_begin,
unsigned int size)
const;
338 void init(
const vpMatrix &M,
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols);
347 double det(vpDetMethod method = LU_DECOMPOSITION)
const;
348 double detByLU()
const;
349#if defined(VISP_HAVE_EIGEN3)
350 double detByLUEigen3()
const;
352#if defined(VISP_HAVE_LAPACK)
353 double detByLULapack()
const;
355#if defined(VISP_HAVE_OPENCV)
356 double detByLUOpenCV()
const;
399 double sumSquare()
const;
446#if defined(VISP_HAVE_EIGEN3)
449#if defined(VISP_HAVE_LAPACK)
452#if defined(VISP_HAVE_OPENCV)
460#if defined(VISP_HAVE_LAPACK)
461 vpMatrix inverseByCholeskyLapack()
const;
463#if defined(VISP_HAVE_OPENCV)
464 vpMatrix inverseByCholeskyOpenCV()
const;
469#if defined(VISP_HAVE_LAPACK)
474 vpMatrix inverseTriangular(
bool upper =
true)
const;
476 vpMatrix pseudoInverse(
double svThreshold = 1e-6)
const;
477 unsigned int pseudoInverse(
vpMatrix &Ap,
double svThreshold = 1e-6)
const;
478 unsigned int pseudoInverse(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const;
482 vpMatrix pseudoInverse(
int rank_in)
const;
483 int pseudoInverse(
vpMatrix &Ap,
int rank_in)
const;
488#if defined(VISP_HAVE_LAPACK)
500#if defined(VISP_HAVE_EIGEN3)
512#if defined(VISP_HAVE_OPENCV)
532 double cond(
double svThreshold = 1e-6)
const;
533 unsigned int kernel(
vpMatrix &kerAt,
double svThreshold = 1e-6)
const;
534 unsigned int nullSpace(
vpMatrix &kerA,
double svThreshold = 1e-6)
const;
535 unsigned int nullSpace(
vpMatrix &kerA,
int dim)
const;
544#ifdef VISP_HAVE_EIGEN3
547#if defined(VISP_HAVE_LAPACK)
550#if defined(VISP_HAVE_OPENCV)
561 unsigned int qr(
vpMatrix &Q,
vpMatrix &R,
bool full =
false,
bool squareR =
false,
double tol = 1e-6)
const;
563 double tol = 1e-6)
const;
584 double frobeniusNorm()
const;
585 double inducedL2Norm()
const;
586 double infinityNorm()
const;
594 std::ostream &cppPrint(std::ostream &os,
const std::string &matrixName =
"A",
bool octet =
false)
const;
595 std::ostream &csvPrint(std::ostream &os)
const;
596 std::ostream &maplePrint(std::ostream &os)
const;
597 std::ostream &matlabPrint(std::ostream &os)
const;
598 int print(std::ostream &s,
unsigned int length,
const std::string &intro =
"")
const;
653 static void add2WeightedMatrices(
const vpMatrix &A,
const double &wA,
const vpMatrix &B,
const double &wB,
655 static void computeHLM(
const vpMatrix &H,
const double &alpha,
vpMatrix &HLM);
912 const char *header =
"")
993#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
994 vp_deprecated
double euclideanNorm()
const;
1044 vp_deprecated
void setIdentity(
const double &val = 1.0);
1050#ifndef DOXYGEN_SHOULD_SKIP_THIS
1054 vp_deprecated
double detByLUGsl()
const
1056#if defined(VISP_HAVE_LAPACK)
1057 return detByLULapack();
1066 vp_deprecated
vpMatrix inverseByLUGsl()
const
1068#if defined(VISP_HAVE_LAPACK)
1069 return inverseByLULapack();
1078 vpMatrix inverseByCholeskyGsl()
const
1080#if defined(VISP_HAVE_LAPACK)
1081 return inverseByCholeskyLapack();
1092#if defined(VISP_HAVE_LAPACK)
1093 return inverseByQRLapack();
1102 vpMatrix pseudoInverseGsl(
double svThreshold = 1e-6)
const
1104#if defined(VISP_HAVE_LAPACK)
1105 return pseudoInverseLapack(svThreshold);
1115 unsigned int pseudoInverseGsl(
vpMatrix &Ap,
double svThreshold = 1e-6)
const
1117#if defined(VISP_HAVE_LAPACK)
1118 return pseudoInverseLapack(Ap, svThreshold);
1129 unsigned int pseudoInverseGsl(
vpMatrix &Ap,
vpColVector &sv,
double svThreshold = 1e-6)
const
1131#if defined(VISP_HAVE_LAPACK)
1132 return pseudoInverseLapack(Ap, sv, svThreshold);
1147#if defined(VISP_HAVE_LAPACK)
1148 return pseudoInverseLapack(Ap, sv, svThreshold, imA, imAt, kerAt);
1165#if defined(VISP_HAVE_LAPACK)
1179 static unsigned int m_lapack_min_size;
1180 static const unsigned int m_lapack_min_size_default;
1182#if defined(VISP_HAVE_LAPACK)
1183 static void blas_dgemm(
char trans_a,
char trans_b,
unsigned int M_,
unsigned int N_,
unsigned int K_,
double alpha,
1184 double *a_data,
unsigned int lda_,
double *b_data,
unsigned int ldb_,
double beta,
1185 double *c_data,
unsigned int ldc_);
1186 static void blas_dgemv(
char trans,
unsigned int M_,
unsigned int N_,
double alpha,
double *a_data,
unsigned int lda_,
1187 double *x_data,
int incx_,
double beta,
double *y_data,
int incy_);
1188 static void blas_dsyev(
char jobz,
char uplo,
unsigned int n_,
double *a_data,
unsigned int lda_,
double *w_data,
1189 double *work_data,
int lwork_,
int &info_);
1197#if defined(VISP_USE_MSVC) && defined(visp_EXPORTS)
1198const __declspec(selectany)
unsigned int vpMatrix::m_lapack_min_size_default = 0;
1199__declspec(selectany)
unsigned int vpMatrix::m_lapack_min_size = vpMatrix::m_lapack_min_size_default;
1202#ifndef DOXYGEN_SHOULD_SKIP_THIS
Implementation of a generic 2D array used as base class for matrices and vectors.
static bool load(const std::string &filename, vpArray2D< Type > &A, bool binary=false, char *header=NULL)
unsigned int getCols() const
vpArray2D< Type > & operator=(Type x)
Set all the elements of the array to x.
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)
vpArray2D< Type > t() const
Compute the transpose of the array.
static bool loadYAML(const std::string &filename, vpArray2D< Type > &A, char *header=NULL)
unsigned int getRows() const
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.
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 bool loadMatrixYAML(const std::string &filename, vpArray2D< double > &M, char *header=NULL)
static bool loadMatrix(const std::string &filename, vpArray2D< double > &M, bool binary=false, char *header=NULL)
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
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
virtual ~vpMatrix()
Destructor (Memory de-allocation)
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 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.
vpColVector operator*(const double &x, const vpColVector &v)