47 #include <visp/vpConfig.h>
48 #include <visp/vpException.h>
49 #include <visp/vpTime.h>
52 # include <gsl/gsl_math.h>
53 # include <gsl/gsl_eigen.h>
132 vpMatrix(
unsigned int r,
unsigned int c) ;
133 vpMatrix(
unsigned int r,
unsigned int c,
double val);
136 unsigned int nrows,
unsigned int ncols) ;
150 void eye(
unsigned int n) ;
152 void eye(
unsigned int m,
unsigned int n) ;
153 void setIdentity(
const double & val=1.0) ;
160 inline unsigned int getRows()
const {
return rowNum ;}
163 inline unsigned int getCols()
const {
return colNum; }
165 inline unsigned int size()
const {
return colNum*rowNum; }
168 void resize(
const unsigned int nrows,
const unsigned int ncols,
169 const bool nullify =
true);
171 double getMinValue()
const;
173 double getMaxValue()
const;
180 friend VISP_EXPORT std::ostream &operator << (std::ostream &s,
const vpMatrix &m);
184 int print(std::ostream& s,
unsigned int length,
char const* intro=0);
185 std::ostream & matlabPrint(std::ostream & os)
const;
186 std::ostream & maplePrint(std::ostream & os)
const;
187 std::ostream & csvPrint(std::ostream & os)
const;
188 std::ostream & cppPrint(std::ostream & os,
const char * matrixName = NULL,
bool octet =
false)
const;
190 void printSize() { std::cout << getRows() <<
" x " << getCols() <<
" " ; }
210 vpMatrix &operator=(
const double x);
219 inline double *operator[](
unsigned int i) {
return rowPtrs[i]; }
222 inline double *
operator[](
unsigned int i)
const {
return rowPtrs[i];}
230 static void add2WeightedMatrices(
const vpMatrix &A,
const double &wA,
const vpMatrix &B,
const double &wB,
vpMatrix &C);
233 static void computeHLM(
const vpMatrix &H,
const double &alpha,
vpMatrix &HLM);
238 void insert(
const vpMatrix&A,
const unsigned int r,
const unsigned int c);
265 const bool binary =
false,
char *Header = NULL)
269 static bool loadMatrix(
const char *filename,
vpMatrix &M,
const bool binary =
false,
char *Header = NULL);
286 const bool binary =
false,
287 const char *Header =
"")
291 static bool saveMatrix(
const char *filename,
const vpMatrix &M,
const bool binary =
false,
const char *Header =
"");
307 static bool saveMatrixYAML(
const char *filename,
const vpMatrix &M,
const char *header =
"");
321 static bool loadMatrixYAML(
const char *filename,
vpMatrix &M,
char *header = NULL);
325 void stackMatrices(
const vpMatrix &A);
361 vpMatrix &operator+=(
const double x);
363 vpMatrix &operator-=(
const double x);
365 vpMatrix &operator*=(
const double x);
370 vpMatrix operator*(
const double x)
const;
372 vpMatrix operator/(
const double x)
const;
385 double sumSquare()
const;
388 double det(vpDetMethod method = LU_DECOMPOSITION)
const;
399 vpRowVector getRow(
const unsigned int i,
const unsigned int j_begin,
const unsigned int size)
const;
401 vpColVector getCol(
const unsigned int j,
const unsigned int i_begin,
const unsigned int size)
const;
402 void init(
const vpMatrix &M,
unsigned int r,
unsigned int c,
unsigned int nrows,
unsigned int ncols);
455 #ifndef DOXYGEN_SHOULD_SKIP_THIS
456 void LUDcmp(
unsigned int* perm,
int& d);
461 #endif // doxygen should skip this
464 #if defined(VISP_HAVE_LAPACK)
468 vpMatrix inverseByCholeskyLapack()
const;
474 vpMatrix pseudoInverse(
double svThreshold=1e-6)
const;
478 unsigned int pseudoInverse(
vpMatrix &Ap,
double svThreshold=1e-6)
const;
484 unsigned int pseudoInverse(
vpMatrix &Ap,
490 unsigned int pseudoInverse(
vpMatrix &Ap,
501 #ifndef DOXYGEN_SHOULD_SKIP_THIS
507 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1
510 #ifdef VISP_HAVE_LAPACK
530 unsigned int kernel(
vpMatrix &KerA,
double svThreshold=1e-6);
552 double euclideanNorm ()
const;
554 double infinityNorm ()
const;
557 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
561 vp_deprecated
vpRowVector row(
const unsigned int i);
562 vp_deprecated
vpColVector column(
const unsigned int j);
566 double detByLU()
const;
unsigned int size() const
Return the number of elements of the matrix.
Definition of the vpMatrix class.
static bool loadMatrix(std::string filename, vpMatrix &M, const bool binary=false, char *Header=NULL)
static bool saveMatrixYAML(std::string filename, const vpMatrix &M, const char *header="")
Definition of the row vector class.
vpColVector operator*(const double &x, const vpColVector &B)
multiplication by a scalar Ci = x*Bi
double * data
address of the first element of the data array
unsigned int trsize
Total row space.
This class aims to compute the homography wrt.two images.
double ** rowPtrs
address of the first element of each rows
static bool loadMatrixYAML(std::string filename, vpMatrix &M, char *header=NULL)
double * operator[](unsigned int i) const
read elements Aij (usage : x = A[i][j] )
unsigned int rowNum
number of rows
Class that provides a data structure for the column vectors as well as a set of operations on these v...
unsigned int getCols() const
Return the number of columns of the matrix.
unsigned int dsize
Current size (rowNum * colNum)
unsigned int colNum
number of columns
Class that consider the case of a translation vector.
static bool saveMatrix(std::string filename, const vpMatrix &M, const bool binary=false, const char *Header="")