47 #include <visp/vpConfig.h>
48 #include <visp/vpTime.h>
51 # include <gsl/gsl_math.h>
52 # include <gsl/gsl_eigen.h>
130 vpMatrix(
unsigned int r,
unsigned int c) ;
134 unsigned int nrows,
unsigned int ncols) ;
146 void eye(
unsigned int n) ;
148 void eye(
unsigned int m,
unsigned int n) ;
149 void setIdentity(
const double & val=1.0) ;
156 inline unsigned int getRows()
const {
return rowNum ;}
159 inline unsigned int getCols()
const {
return colNum; }
162 void resize(
const unsigned int nrows,
const unsigned int ncols,
163 const bool nullify =
true);
165 double getMinValue()
const;
167 double getMaxValue()
const;
174 friend VISP_EXPORT std::ostream &operator << (std::ostream &s,
const vpMatrix &m);
178 int print(std::ostream& s,
unsigned int length,
char const* intro=0);
179 std::ostream & matlabPrint(std::ostream & os);
180 std::ostream & maplePrint(std::ostream & os);
181 std::ostream & cppPrint(std::ostream & os,
const char * matrixName = NULL,
bool octet =
false);
183 void printSize() { std::cout << getRows() <<
" x " << getCols() <<
" " ; }
186 static bool saveMatrix(
const char *filename,
const vpMatrix &M,
const bool binary =
false,
const char *Header =
"");
187 static bool loadMatrix(
const char *filename,
vpMatrix &M,
const bool binary =
false,
char *Header = NULL);
202 const bool binary =
false,
203 const char *Header =
"")
219 const bool binary =
false,
char *Header = NULL)
238 vpMatrix &operator=(
const double x);
247 inline double *operator[](
unsigned int n) {
return rowPtrs[n]; }
250 inline double *
operator[](
unsigned int n)
const {
return rowPtrs[n];}
259 static void add2WeightedMatrices(
const vpMatrix &A,
const double &wA,
const vpMatrix &B,
const double &wB,
vpMatrix &C);
294 vpMatrix &operator+=(
const double x);
296 vpMatrix &operator-=(
const double x);
298 vpMatrix &operator*=(
const double x);
303 vpMatrix operator*(
const double x)
const;
305 vpMatrix operator/(
const double x)
const;
308 double sumSquare()
const;
311 double det(vpDetMethod method = LU_DECOMPOSITION)
const;
326 void init(
const vpMatrix &m,
unsigned int r,
unsigned int c,
327 unsigned int nrows,
unsigned int ncols);
387 #ifndef DOXYGEN_SHOULD_SKIP_THIS
388 void LUDcmp(
unsigned int* perm,
int& d);
393 #endif // doxygen should skip this
396 #if defined(VISP_HAVE_LAPACK)
400 vpMatrix inverseByCholeskyLapack()
const;
406 vpMatrix pseudoInverse(
double svThreshold=1e-6)
const;
410 unsigned int pseudoInverse(
vpMatrix &Ap,
double svThreshold=1e-6)
const;
416 unsigned int pseudoInverse(
vpMatrix &Ap,
422 unsigned int pseudoInverse(
vpMatrix &Ap,
433 #ifndef DOXYGEN_SHOULD_SKIP_THIS
439 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1
442 #ifdef VISP_HAVE_LAPACK
462 unsigned int kernel(
vpMatrix &KerA,
double svThreshold=1e-6);
490 void stackMatrices(
const vpMatrix &A);
493 void insert(
const vpMatrix&A,
const unsigned int r,
const unsigned int c);
505 double euclideanNorm ()
const;
507 double infinityNorm ()
const;
511 double detByLU()
const;
Definition of the vpMatrix class.
static bool loadMatrix(std::string filename, vpMatrix &M, const bool binary=false, char *Header=NULL)
Definition of the row vector class.
static bool saveMatrix(const char *filename, const vpMatrix &M, const bool binary=false, const char *Header="")
VISP_EXPORT vpImagePoint operator*(const vpImagePoint &ip1, const double scale)
double * data
address of the first element of the data array
unsigned int trsize
Total row space.
double ** rowPtrs
address of the first element of each rows
static bool loadMatrix(const char *filename, vpMatrix &M, const bool binary=false, char *Header=NULL)
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.
double * operator[](unsigned int n) const
read elements Aij (usage : x = A[i][j] )
static bool saveMatrix(std::string filename, const vpMatrix &M, const bool binary=false, const char *Header="")