Visual Servoing Platform  version 3.1.0
vpMatrix.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See http://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Matrix manipulation.
33  *
34  * Authors:
35  * Eric Marchand
36  *
37  *****************************************************************************/
38 
39 #ifndef vpMatrix_H
40 #define vpMatrix_H
41 
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>
50 
51 #ifdef VISP_HAVE_GSL
52 #include <gsl/gsl_eigen.h>
53 #include <gsl/gsl_math.h>
54 #endif
55 
56 #include <iostream>
57 #include <math.h>
58 
59 class vpRowVector;
60 class vpColVector;
64 class vpForceTwistMatrix;
65 
104 class VISP_EXPORT vpMatrix : public vpArray2D<double>
105 {
106 public:
111  typedef enum {
112  LU_DECOMPOSITION
113  } vpDetMethod;
114 
115 public:
120  vpMatrix() : vpArray2D<double>(0, 0) {}
127  vpMatrix(unsigned int r, unsigned int c) : vpArray2D<double>(r, c) {}
135  vpMatrix(unsigned int r, unsigned int c, double val) : vpArray2D<double>(r, c, val) {}
136  vpMatrix(const vpMatrix &M, unsigned int r, unsigned int c, unsigned int nrows, unsigned int ncols);
149  vpMatrix(const vpArray2D<double> &A) : vpArray2D<double>(A) {}
150 
151 #ifdef VISP_HAVE_CPP11_COMPATIBILITY
152  vpMatrix(const vpMatrix &A) : vpArray2D<double>(A) {}
153 
154  vpMatrix(vpMatrix &&A);
155 #endif
156 
158  virtual ~vpMatrix() {}
159 
164  void clear()
165  {
166  if (data != NULL) {
167  free(data);
168  data = NULL;
169  }
170 
171  if (rowPtrs != NULL) {
172  free(rowPtrs);
173  rowPtrs = NULL;
174  }
175  rowNum = colNum = dsize = 0;
176  }
177 
178  //-------------------------------------------------
179  // Setting a diagonal matrix
180  //-------------------------------------------------
183  void diag(const double &val = 1.0);
184  void diag(const vpColVector &A);
185  // Initialize an identity matrix n-by-n
186  void eye();
187  void eye(unsigned int n);
188  // Initialize an identity matrix m-by-n
189  void eye(unsigned int m, unsigned int n);
191 
192  //---------------------------------
193  // Assignment
194  //---------------------------------
197  vpMatrix &operator<<(double *);
199 #ifdef VISP_HAVE_CPP11_COMPATIBILITY
200  vpMatrix &operator=(const vpMatrix &A);
202 #endif
203  vpMatrix &operator=(const double x);
205 
206  //-------------------------------------------------
207  // Stacking
208  //-------------------------------------------------
211  // Stack the matrix A below the current one, copy if not initialized this =
212  // [ this A ]^T
213  void stack(const vpMatrix &A);
214  void stack(const vpRowVector &r);
215  // Stacks columns of a matrix in a vector
216  void stackColumns(vpColVector &out);
217 
218  // Stacks columns of a matrix in a vector
219  vpColVector stackColumns();
220 
221  // Stacks columns of a matrix in a vector
222  void stackRows(vpRowVector &out);
223 
224  // Stacks columns of a matrix in a vector
225  vpRowVector stackRows();
227 
228  //---------------------------------
229  // Matrix insertion
230  //---------------------------------
233  // Insert matrix A in the current matrix at the given position (r, c).
234  void insert(const vpMatrix &A, const unsigned int r, const unsigned int c);
236 
237  //-------------------------------------------------
238  // Columns, Rows extraction, SubMatrix
239  //-------------------------------------------------
242  vpMatrix extract(unsigned int r, unsigned int c, unsigned int nrows, unsigned int ncols) const;
243  vpColVector getCol(const unsigned int j) const;
244  vpColVector getCol(const unsigned int j, const unsigned int i_begin, const unsigned int size) const;
245  vpRowVector getRow(const unsigned int i) const;
246  vpRowVector getRow(const unsigned int i, const unsigned int j_begin, const unsigned int size) const;
247  void init(const vpMatrix &M, unsigned int r, unsigned int c, unsigned int nrows, unsigned int ncols);
249 
250  //---------------------------------
251  // Matrix operations.
252  //---------------------------------
255  // return the determinant of the matrix.
256  double det(vpDetMethod method = LU_DECOMPOSITION) const;
257  double detByLU() const;
258 #ifndef DOXYGEN_SHOULD_SKIP_THIS
259 #ifdef VISP_HAVE_EIGEN3
260  double detByLUEigen3() const;
261 #endif
262 #ifdef VISP_HAVE_GSL
263  double detByLUGsl() const;
264 #endif
265 #ifdef VISP_HAVE_LAPACK
266  double detByLULapack() const;
267 #endif
268 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101)
269  double detByLUOpenCV() const;
270 #endif
271 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
272 
273  // Compute the exponential matrix of a square matrix
274  vpMatrix expm() const;
275 
276  // operation A = A + B
277  vpMatrix &operator+=(const vpMatrix &B);
278  // operation A = A - B
279  vpMatrix &operator-=(const vpMatrix &B);
280  vpMatrix operator*(const vpMatrix &B) const;
281  vpMatrix operator*(const vpRotationMatrix &R) const;
282  vpMatrix operator*(const vpVelocityTwistMatrix &V) const;
283  vpMatrix operator*(const vpForceTwistMatrix &V) const;
284  // operation t_out = A * t (A is unchanged, t and t_out are translation
285  // vectors)
286  vpTranslationVector operator*(const vpTranslationVector &tv) const;
287  vpColVector operator*(const vpColVector &v) const;
288  vpMatrix operator+(const vpMatrix &B) const;
289  vpMatrix operator-(const vpMatrix &B) const;
290  vpMatrix operator-() const;
291 
293  vpMatrix &operator+=(const double x);
295  vpMatrix &operator-=(const double x);
297  vpMatrix &operator*=(const double x);
299  vpMatrix &operator/=(double x);
300 
301  // Cij = Aij * x (A is unchanged)
302  vpMatrix operator*(const double x) const;
303  // Cij = Aij / x (A is unchanged)
304  vpMatrix operator/(const double x) const;
305 
311  double sum() const;
312  double sumSquare() const;
313 
314  //-------------------------------------------------
315  // Hadamard product
316  //-------------------------------------------------
318  vpMatrix hadamard(const vpMatrix &m) const;
319 
320  //-------------------------------------------------
321  // Kronecker product
322  //-------------------------------------------------
325  // Compute Kronecker product matrix
326  void kron(const vpMatrix &m1, vpMatrix &out) const;
327 
328  // Compute Kronecker product matrix
329  vpMatrix kron(const vpMatrix &m1) const;
331 
332  //-------------------------------------------------
333  // Transpose
334  //-------------------------------------------------
337  // Compute the transpose C = A^T
338  vpMatrix t() const;
339 
340  // Compute the transpose C = A^T
341  vpMatrix transpose() const;
342  void transpose(vpMatrix &C) const;
343 
344  vpMatrix AAt() const;
345  void AAt(vpMatrix &B) const;
346 
347  vpMatrix AtA() const;
348  void AtA(vpMatrix &B) const;
350 
351  //-------------------------------------------------
352  // Matrix inversion
353  //-------------------------------------------------
356  // inverse matrix A using the LU decomposition
357  vpMatrix inverseByLU() const;
358 
359 #ifndef DOXYGEN_SHOULD_SKIP_THIS
360 #if defined(VISP_HAVE_EIGEN3)
361  vpMatrix inverseByLUEigen3() const;
362 #endif
363 #if defined(VISP_HAVE_GSL)
364  vpMatrix inverseByLUGsl() const;
365 #endif
366 #if defined(VISP_HAVE_LAPACK)
367  vpMatrix inverseByLULapack() const;
368 #endif
369 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101)
370  vpMatrix inverseByLUOpenCV() const;
371 #endif
372 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
373 
374  // inverse matrix A using the Cholesky decomposition (only for real
375  // symmetric matrices)
376  vpMatrix inverseByCholesky() const;
377 
378 #ifndef DOXYGEN_SHOULD_SKIP_THIS
379 #if defined(VISP_HAVE_LAPACK)
380  vpMatrix inverseByCholeskyLapack() const;
381 #endif
382 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101)
383  vpMatrix inverseByCholeskyOpenCV() const;
384 #endif
385 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
386 
387  // inverse matrix A using the QR decomposition
388  vpMatrix inverseByQR() const;
389 
390 #ifndef DOXYGEN_SHOULD_SKIP_THIS
391 #if defined(VISP_HAVE_LAPACK)
392  vpMatrix inverseByQRLapack() const;
393 #endif
394 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
395 
396  vpMatrix pseudoInverse(double svThreshold = 1e-6) const;
397  unsigned int pseudoInverse(vpMatrix &Ap, double svThreshold = 1e-6) const;
398  unsigned int pseudoInverse(vpMatrix &Ap, vpColVector &sv, double svThreshold = 1e-6) const;
399  unsigned int pseudoInverse(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt) const;
400  unsigned int pseudoInverse(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt,
401  vpMatrix &kerAt) const;
402 
403 #ifndef DOXYGEN_SHOULD_SKIP_THIS
404 #if defined(VISP_HAVE_LAPACK)
405  vpMatrix pseudoInverseLapack(double svThreshold = 1e-6) const;
406  unsigned int pseudoInverseLapack(vpMatrix &Ap, double svThreshold = 1e-6) const;
407  unsigned int pseudoInverseLapack(vpMatrix &Ap, vpColVector &sv, double svThreshold = 1e-6) const;
408  unsigned int pseudoInverseLapack(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt,
409  vpMatrix &kerAt) const;
410 #endif
411 #if defined(VISP_HAVE_EIGEN3)
412  vpMatrix pseudoInverseEigen3(double svThreshold = 1e-6) const;
413  unsigned int pseudoInverseEigen3(vpMatrix &Ap, double svThreshold = 1e-6) const;
414  unsigned int pseudoInverseEigen3(vpMatrix &Ap, vpColVector &sv, double svThreshold = 1e-6) const;
415  unsigned int pseudoInverseEigen3(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt,
416  vpMatrix &kerAt) const;
417 #endif
418 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101)
419  vpMatrix pseudoInverseOpenCV(double svThreshold = 1e-6) const;
420  unsigned int pseudoInverseOpenCV(vpMatrix &Ap, double svThreshold = 1e-6) const;
421  unsigned int pseudoInverseOpenCV(vpMatrix &Ap, vpColVector &sv, double svThreshold = 1e-6) const;
422  unsigned int pseudoInverseOpenCV(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt,
423  vpMatrix &kerAt) const;
424 #endif
425 #if defined(VISP_HAVE_GSL)
426  vpMatrix pseudoInverseGsl(double svThreshold = 1e-6) const;
427  unsigned int pseudoInverseGsl(vpMatrix &Ap, double svThreshold = 1e-6) const;
428  unsigned int pseudoInverseGsl(vpMatrix &Ap, vpColVector &sv, double svThreshold = 1e-6) const;
429  unsigned int pseudoInverseGsl(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt,
430  vpMatrix &kerAt) const;
431 #endif
432 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
433 
435 
436  //-------------------------------------------------
437  // SVD decomposition
438  //-------------------------------------------------
439 
442  double cond() const;
443  unsigned int kernel(vpMatrix &kerAt, double svThreshold = 1e-6) const;
444 
445  // solve Ax=B using the SVD decomposition (usage A = solveBySVD(B,x) )
446  void solveBySVD(const vpColVector &B, vpColVector &x) const;
447  // solve Ax=B using the SVD decomposition (usage x=A.solveBySVD(B))
448  vpColVector solveBySVD(const vpColVector &B) const;
449 
450  // singular value decomposition SVD
451  void svd(vpColVector &w, vpMatrix &V);
452 #ifndef DOXYGEN_SHOULD_SKIP_THIS
453 #ifdef VISP_HAVE_EIGEN3
454  void svdEigen3(vpColVector &w, vpMatrix &V);
455 #endif
456 #ifdef VISP_HAVE_GSL
457  void svdGsl(vpColVector &w, vpMatrix &V);
458 #endif
459 #ifdef VISP_HAVE_LAPACK
460  void svdLapack(vpColVector &w, vpMatrix &V);
461 #endif
462 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1
463  void svdOpenCV(vpColVector &w, vpMatrix &V);
464 #endif
465 #endif
466 
467 
468  //-------------------------------------------------
469  // Eigen values and vectors
470  //-------------------------------------------------
474  // compute the eigen values using the Gnu Scientific library
475  vpColVector eigenValues() const;
476  void eigenValues(vpColVector &evalue, vpMatrix &evector) const;
478 
479  //-------------------------------------------------
480  // Norms
481  //-------------------------------------------------
484  double euclideanNorm() const;
485  double infinityNorm() const;
487 
488  //---------------------------------
489  // Printing
490  //---------------------------------
493  std::ostream &cppPrint(std::ostream &os, const std::string &matrixName = "A", bool octet = false) const;
494  std::ostream &csvPrint(std::ostream &os) const;
495  std::ostream &maplePrint(std::ostream &os) const;
496  std::ostream &matlabPrint(std::ostream &os) const;
497  int print(std::ostream &s, unsigned int length, char const *intro = 0) const;
498  void printSize() const { std::cout << getRows() << " x " << getCols() << " "; }
500 
501  //------------------------------------------------------------------
502  // Static functionalities
503  //------------------------------------------------------------------
504 
505  //---------------------------------
506  // Setting a diagonal matrix with Static Public Member Functions
507  //---------------------------------
510  // Create a diagonal matrix with the element of a vector DAii = Ai
511  static void createDiagonalMatrix(const vpColVector &A, vpMatrix &DA);
513 
514  //---------------------------------
515  // Matrix insertion with Static Public Member Functions
516  //---------------------------------
519  // Insert matrix B in matrix A at the given position (r, c).
520  static vpMatrix insert(const vpMatrix &A, const vpMatrix &B, const unsigned int r, const unsigned int c);
521  // Insert matrix B in matrix A (not modified) at the given position (r, c),
522  // the result is given in matrix C.
523  static void insert(const vpMatrix &A, const vpMatrix &B, vpMatrix &C, const unsigned int r, const unsigned int c);
524 
525  //---------------------------------
526  // Stacking with Static Public Member Functions
527  //---------------------------------
530  // Juxtapose to matrices C = [ A B ]
531  static vpMatrix juxtaposeMatrices(const vpMatrix &A, const vpMatrix &B);
532  // Juxtapose to matrices C = [ A B ]
533  static void juxtaposeMatrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C);
534  // Stack two matrices C = [ A B ]^T
535  static vpMatrix stack(const vpMatrix &A, const vpMatrix &B);
536  static vpMatrix stack(const vpMatrix &A, const vpRowVector &r);
537 
538  // Stack two matrices C = [ A B ]^T
539  static void stack(const vpMatrix &A, const vpMatrix &B, vpMatrix &C);
540  static void stack(const vpMatrix &A, const vpRowVector &r, vpMatrix &C);
542 
543  //---------------------------------
544  // Matrix operations Static Public Member Functions
545  //---------------------------------
548  static void add2Matrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C);
549  static void add2Matrices(const vpColVector &A, const vpColVector &B, vpColVector &C);
550  static void add2WeightedMatrices(const vpMatrix &A, const double &wA, const vpMatrix &B, const double &wB,
551  vpMatrix &C);
552  static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM);
553  static void mult2Matrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C);
554  static void mult2Matrices(const vpMatrix &A, const vpMatrix &B, vpRotationMatrix &C);
555  static void mult2Matrices(const vpMatrix &A, const vpMatrix &B, vpHomogeneousMatrix &C);
556  static void mult2Matrices(const vpMatrix &A, const vpColVector &B, vpColVector &C);
557  static void multMatrixVector(const vpMatrix &A, const vpColVector &v, vpColVector &w);
558  static void negateMatrix(const vpMatrix &A, vpMatrix &C);
559  static void sub2Matrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C);
560  static void sub2Matrices(const vpColVector &A, const vpColVector &B, vpColVector &C);
562 
563  //---------------------------------
564  // Kronecker product Static Public Member Functions
565  //---------------------------------
568  // Compute Kronecker product matrix
569  static void kron(const vpMatrix &m1, const vpMatrix &m2, vpMatrix &out);
570 
571  // Compute Kronecker product matrix
572  static vpMatrix kron(const vpMatrix &m1, const vpMatrix &m2);
574 
575  //---------------------------------
576  // Covariance computation Static Public Member Functions
577  //---------------------------------
580  static vpMatrix computeCovarianceMatrix(const vpMatrix &A, const vpColVector &x, const vpColVector &b);
581  static vpMatrix computeCovarianceMatrix(const vpMatrix &A, const vpColVector &x, const vpColVector &b,
582  const vpMatrix &w);
583  static vpMatrix computeCovarianceMatrixVVS(const vpHomogeneousMatrix &cMo, const vpColVector &deltaS,
584  const vpMatrix &Ls, const vpMatrix &W);
585  static vpMatrix computeCovarianceMatrixVVS(const vpHomogeneousMatrix &cMo, const vpColVector &deltaS,
586  const vpMatrix &Ls);
588 
589  //---------------------------------
590  // Matrix I/O Static Public Member Functions
591  //---------------------------------
605  static inline bool loadMatrix(const std::string &filename, vpArray2D<double> &M, const bool binary = false,
606  char *header = NULL)
607  {
608  return vpArray2D<double>::load(filename, M, binary, header);
609  }
610 
621  static inline bool loadMatrixYAML(const std::string &filename, vpArray2D<double> &M, char *header = NULL)
622  {
623  return vpArray2D<double>::loadYAML(filename, M, header);
624  }
625 
640  static inline bool saveMatrix(const std::string &filename, const vpArray2D<double> &M, const bool binary = false,
641  const char *header = "")
642  {
643  return vpArray2D<double>::save(filename, M, binary, header);
644  }
645 
658  static inline bool saveMatrixYAML(const std::string &filename, const vpArray2D<double> &M, const char *header = "")
659  {
660  return vpArray2D<double>::saveYAML(filename, M, header);
661  }
663 
664 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
665 
673  vp_deprecated void init() {}
674 
678  vp_deprecated void stackMatrices(const vpMatrix &A) { stack(A); }
683  vp_deprecated static vpMatrix stackMatrices(const vpMatrix &A, const vpMatrix &B) { return stack(A, B); }
688  vp_deprecated static void stackMatrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C) { stack(A, B, C); }
693  vp_deprecated static vpMatrix stackMatrices(const vpMatrix &A, const vpRowVector &B);
698  vp_deprecated static void stackMatrices(const vpMatrix &A, const vpRowVector &B, vpMatrix &C);
703  vp_deprecated static vpMatrix stackMatrices(const vpColVector &A, const vpColVector &B);
708  vp_deprecated static void stackMatrices(const vpColVector &A, const vpColVector &B, vpColVector &C);
709 
713  vp_deprecated void setIdentity(const double &val = 1.0);
714 
715  vp_deprecated vpRowVector row(const unsigned int i);
716  vp_deprecated vpColVector column(const unsigned int j);
717 
719 #endif
720 
721 private:
722 #if defined(VISP_HAVE_LAPACK) && !defined(VISP_HAVE_LAPACK_BUILT_IN)
723  static void blas_dgemm(char trans_a, char trans_b, const int M, const int N, const int K, double alpha,
724  double *a_data, const int lda, double *b_data, const int ldb, double beta, double *c_data,
725  const int ldc);
726  static void blas_dgemv(char trans, const int M, const int N, double alpha, double *a_data, const int lda,
727  double *x_data, const int incx, double beta, double *y_data, const int incy);
728 #endif
729 
730  static void computeCovarianceMatrixVVS(const vpHomogeneousMatrix &cMo, const vpColVector &deltaS, const vpMatrix &Ls,
731  vpMatrix &Js, vpColVector &deltaP);
732 };
733 
735 
736 #ifndef DOXYGEN_SHOULD_SKIP_THIS
737 VISP_EXPORT
738 #endif
739 vpMatrix operator*(const double &x, const vpMatrix &A);
740 
741 #endif
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:104
static bool save(const std::string &filename, const vpArray2D< Type > &A, const bool binary=false, const char *header="")
Definition: vpArray2D.h:508
static bool saveYAML(const std::string &filename, const vpArray2D< Type > &A, const char *header="")
Definition: vpArray2D.h:597
static bool loadMatrix(const std::string &filename, vpArray2D< double > &M, const bool binary=false, char *header=NULL)
Definition: vpMatrix.h:605
vpArray2D< Type > & operator=(Type x)
Set all the elements of the array to x.
Definition: vpArray2D.h:244
static bool loadYAML(const std::string &filename, vpArray2D< Type > &A, char *header=NULL)
Definition: vpArray2D.h:426
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of row vector and the associated operations.
Definition: vpRowVector.h:72
unsigned int getRows() const
Definition: vpArray2D.h:156
vp_deprecated void stackMatrices(const vpMatrix &A)
Definition: vpMatrix.h:678
Implementation of a generic 2D array used as vase class of matrices and vectors.
Definition: vpArray2D.h:70
vpMatrix(unsigned int r, unsigned int c, double val)
Definition: vpMatrix.h:135
vpMatrix()
Definition: vpMatrix.h:120
Implementation of a rotation matrix and operations on such kind of matrices.
unsigned int getCols() const
Definition: vpArray2D.h:146
vpColVector operator*(const double &x, const vpColVector &v)
static vp_deprecated void stackMatrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C)
Definition: vpMatrix.h:688
vpMatrix(const vpMatrix &A)
Definition: vpMatrix.h:152
vp_deprecated void init()
Definition: vpMatrix.h:673
static bool load(const std::string &filename, vpArray2D< Type > &A, const bool binary=false, char *header=NULL)
Definition: vpArray2D.h:318
void clear()
Definition: vpMatrix.h:164
vpArray2D< Type > hadamard(const vpArray2D< Type > &m) const
Definition: vpArray2D.h:690
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
Definition: vpArray2D.h:273
static vp_deprecated vpMatrix stackMatrices(const vpMatrix &A, const vpMatrix &B)
Definition: vpMatrix.h:683
vpMatrix(unsigned int r, unsigned int c)
Definition: vpMatrix.h:127
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
virtual ~vpMatrix()
Destructor (Memory de-allocation)
Definition: vpMatrix.h:158
void printSize() const
Definition: vpMatrix.h:498
static bool saveMatrixYAML(const std::string &filename, const vpArray2D< double > &M, const char *header="")
Definition: vpMatrix.h:658
static bool saveMatrix(const std::string &filename, const vpArray2D< double > &M, const bool binary=false, const char *header="")
Definition: vpMatrix.h:640
vpMatrix(const vpArray2D< double > &A)
Definition: vpMatrix.h:149
Class that consider the case of a translation vector.
static bool loadMatrixYAML(const std::string &filename, vpArray2D< double > &M, char *header=NULL)
Definition: vpMatrix.h:621