Visual Servoing Platform  version 3.3.0 under development (2020-02-17)
vpMatrix.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2019 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 
164 class VISP_EXPORT vpMatrix : public vpArray2D<double>
165 {
166 public:
171  typedef enum {
172  LU_DECOMPOSITION
173  } vpDetMethod;
174 
175 public:
180  vpMatrix() : vpArray2D<double>(0, 0) {}
181 
188  vpMatrix(unsigned int r, unsigned int c) : vpArray2D<double>(r, c) {}
189 
197  vpMatrix(unsigned int r, unsigned int c, double val) : vpArray2D<double>(r, c, val) {}
198  vpMatrix(const vpMatrix &M, unsigned int r, unsigned int c, unsigned int nrows, unsigned int ncols);
199 
212  vpMatrix(const vpArray2D<double> &A) : vpArray2D<double>(A) {}
213 
214  vpMatrix(const vpMatrix &A) : vpArray2D<double>(A) {}
215 
216 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
217  vpMatrix(vpMatrix &&A);
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);
221 #endif
222 
224  virtual ~vpMatrix() {}
225 
230  void clear()
231  {
232  if (data != NULL) {
233  free(data);
234  data = NULL;
235  }
236 
237  if (rowPtrs != NULL) {
238  free(rowPtrs);
239  rowPtrs = NULL;
240  }
241  rowNum = colNum = dsize = 0;
242  }
243 
244  //-------------------------------------------------
245  // Setting a diagonal matrix
246  //-------------------------------------------------
249  void diag(const double &val = 1.0);
250  void diag(const vpColVector &A);
251  // Initialize an identity matrix n-by-n
252  void eye();
253  void eye(unsigned int n);
254  // Initialize an identity matrix m-by-n
255  void eye(unsigned int m, unsigned int n);
257 
258  //---------------------------------
259  // Assignment
260  //---------------------------------
263  vpMatrix &operator<<(double *);
264  vpMatrix& operator<<(double val);
265  vpMatrix& operator,(double val);
267 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
268  vpMatrix &operator=(const vpMatrix &A);
270 
271  vpMatrix& operator=(const std::initializer_list<double> &list);
272  vpMatrix& operator=(const std::initializer_list<std::initializer_list<double> > &lists);
273 #endif
274  vpMatrix &operator=(double x);
276 
277  //-------------------------------------------------
278  // Stacking
279  //-------------------------------------------------
282  // Stack the matrix A below the current one, copy if not initialized this =
283  // [ this A ]^T
284  void stack(const vpMatrix &A);
285  void stack(const vpRowVector &r);
286  void stack(const vpColVector &c);
287  // Stacks columns of a matrix in a vector
288  void stackColumns(vpColVector &out);
289 
290  // Stacks columns of a matrix in a vector
291  vpColVector stackColumns();
292 
293  // Stacks columns of a matrix in a vector
294  void stackRows(vpRowVector &out);
295 
296  // Stacks columns of a matrix in a vector
297  vpRowVector stackRows();
299 
300  //---------------------------------
301  // Matrix insertion
302  //---------------------------------
305  // Insert matrix A in the current matrix at the given position (r, c).
306  void insert(const vpMatrix &A, unsigned int r, unsigned int c);
308 
309  //-------------------------------------------------
310  // Columns, Rows, Diag extraction, SubMatrix
311  //-------------------------------------------------
314  vpMatrix extract(unsigned int r, unsigned int c, unsigned int nrows, unsigned int ncols) const;
315  vpColVector getCol(unsigned int j) const;
316  vpColVector getCol(unsigned int j, unsigned int i_begin, unsigned int size) const;
317  vpRowVector getRow(unsigned int i) const;
318  vpRowVector getRow(unsigned int i, unsigned int j_begin, unsigned int size) const;
319  vpColVector getDiag() const;
320  void init(const vpMatrix &M, unsigned int r, unsigned int c, unsigned int nrows, unsigned int ncols);
322 
323  //---------------------------------
324  // Matrix operations.
325  //---------------------------------
328  // return the determinant of the matrix.
329  double det(vpDetMethod method = LU_DECOMPOSITION) const;
330  double detByLU() const;
331 #ifdef VISP_HAVE_EIGEN3
332  double detByLUEigen3() const;
333 #endif
334 #ifdef VISP_HAVE_GSL
335  double detByLUGsl() const;
336 #endif
337 #if defined(VISP_HAVE_LAPACK)
338  double detByLULapack() const;
339 #endif
340 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101)
341  double detByLUOpenCV() const;
342 #endif
343 
344  // Compute the exponential matrix of a square matrix
345  vpMatrix expm() const;
346 
347  // operation A = A + B
348  vpMatrix &operator+=(const vpMatrix &B);
349  // operation A = A - B
350  vpMatrix &operator-=(const vpMatrix &B);
351  vpMatrix operator*(const vpMatrix &B) const;
352  vpMatrix operator*(const vpRotationMatrix &R) const;
353  vpMatrix operator*(const vpVelocityTwistMatrix &V) const;
354  vpMatrix operator*(const vpForceTwistMatrix &V) const;
355  // operation t_out = A * t (A is unchanged, t and t_out are translation
356  // vectors)
357  vpTranslationVector operator*(const vpTranslationVector &tv) const;
358  vpColVector operator*(const vpColVector &v) const;
359  vpMatrix operator+(const vpMatrix &B) const;
360  vpMatrix operator-(const vpMatrix &B) const;
361  vpMatrix operator-() const;
362 
364  vpMatrix &operator+=(double x);
366  vpMatrix &operator-=(double x);
368  vpMatrix &operator*=(double x);
370  vpMatrix &operator/=(double x);
371 
372  // Cij = Aij * x (A is unchanged)
373  vpMatrix operator*(double x) const;
374  // Cij = Aij / x (A is unchanged)
375  vpMatrix operator/(double x) const;
376 
382  double sum() const;
383  double sumSquare() const;
384 
385  //-------------------------------------------------
386  // Hadamard product
387  //-------------------------------------------------
389  vpMatrix hadamard(const vpMatrix &m) const;
390 
391  //-------------------------------------------------
392  // Kronecker product
393  //-------------------------------------------------
396  // Compute Kronecker product matrix
397  void kron(const vpMatrix &m1, vpMatrix &out) const;
398 
399  // Compute Kronecker product matrix
400  vpMatrix kron(const vpMatrix &m1) const;
402 
403  //-------------------------------------------------
404  // Transpose
405  //-------------------------------------------------
408  // Compute the transpose C = A^T
409  vpMatrix t() const;
410 
411  // Compute the transpose C = A^T
412  vpMatrix transpose() const;
413  void transpose(vpMatrix &At) const;
414 
415  vpMatrix AAt() const;
416  void AAt(vpMatrix &B) const;
417 
418  vpMatrix AtA() const;
419  void AtA(vpMatrix &B) const;
421 
422  //-------------------------------------------------
423  // Matrix inversion
424  //-------------------------------------------------
427  // inverse matrix A using the LU decomposition
428  vpMatrix inverseByLU() const;
429 
430 #if defined(VISP_HAVE_EIGEN3)
431  vpMatrix inverseByLUEigen3() const;
432 #endif
433 #if defined(VISP_HAVE_GSL)
434  vpMatrix inverseByLUGsl() const;
435 #endif
436 #if defined(VISP_HAVE_LAPACK)
437  vpMatrix inverseByLULapack() const;
438 #endif
439 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101)
440  vpMatrix inverseByLUOpenCV() const;
441 #endif
442 
443  // inverse matrix A using the Cholesky decomposition (only for real
444  // symmetric matrices)
445  vpMatrix inverseByCholesky() const;
446 
447 #if defined(VISP_HAVE_LAPACK)
448  vpMatrix inverseByCholeskyLapack() const;
449 #endif
450 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101)
451  vpMatrix inverseByCholeskyOpenCV() const;
452 #endif
453 
454  // inverse matrix A using the QR decomposition
455  vpMatrix inverseByQR() const;
456 #if defined(VISP_HAVE_LAPACK)
457  vpMatrix inverseByQRLapack() const;
458 #endif
459 
460  // inverse triangular matrix
461  vpMatrix inverseTriangular(bool upper = true) const;
462 
463 
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;
467  unsigned int pseudoInverse(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt) const;
468  unsigned int pseudoInverse(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt,
469  vpMatrix &kerAt) const;
470 
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;
475  unsigned int pseudoInverseLapack(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt,
476  vpMatrix &kerAt) const;
477 #endif
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;
482  unsigned int pseudoInverseEigen3(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt,
483  vpMatrix &kerAt) const;
484 #endif
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;
489  unsigned int pseudoInverseOpenCV(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt,
490  vpMatrix &kerAt) const;
491 #endif
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;
496  unsigned int pseudoInverseGsl(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt,
497  vpMatrix &kerAt) const;
498 #endif
499 
501 
502  //-------------------------------------------------
503  // SVD decomposition
504  //-------------------------------------------------
505 
508  double cond(double svThreshold = 1e-6) const;
509  unsigned int kernel(vpMatrix &kerAt, double svThreshold = 1e-6) const;
510 
511  // solve Ax=B using the SVD decomposition (usage A = solveBySVD(B,x) )
512  void solveBySVD(const vpColVector &B, vpColVector &x) const;
513  // solve Ax=B using the SVD decomposition (usage x=A.solveBySVD(B))
514  vpColVector solveBySVD(const vpColVector &B) const;
515 
516  // singular value decomposition SVD
517  void svd(vpColVector &w, vpMatrix &V);
518 #ifdef VISP_HAVE_EIGEN3
519  void svdEigen3(vpColVector &w, vpMatrix &V);
520 #endif
521 #ifdef VISP_HAVE_GSL
522  void svdGsl(vpColVector &w, vpMatrix &V);
523 #endif
524 #if defined(VISP_HAVE_LAPACK)
525  void svdLapack(vpColVector &w, vpMatrix &V);
526 #endif
527 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1
528  void svdOpenCV(vpColVector &w, vpMatrix &V);
529 #endif
530 
531 
532  //-------------------------------------------------
533  // QR decomposition
534  //-------------------------------------------------
535 
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;
540  void solveByQR(const vpColVector &b, vpColVector &x) const;
541  vpColVector solveByQR(const vpColVector &b) const;
543 
544  //-------------------------------------------------
545  // Eigen values and vectors
546  //-------------------------------------------------
550  // compute the eigen values using the Gnu Scientific library
551  vpColVector eigenValues() const;
552  void eigenValues(vpColVector &evalue, vpMatrix &evector) const;
554 
555  //-------------------------------------------------
556  // Norms
557  //-------------------------------------------------
560  double euclideanNorm() const;
561  double frobeniusNorm() const;
562  double inducedL2Norm() const;
563  double infinityNorm() const;
565 
566  //---------------------------------
567  // Printing
568  //---------------------------------
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;
576  void printSize() const { std::cout << getRows() << " x " << getCols() << " "; }
578 
579  //------------------------------------------------------------------
580  // Static functionalities
581  //------------------------------------------------------------------
582 
583  //---------------------------------
584  // Setting a diagonal matrix with Static Public Member Functions
585  //---------------------------------
588  // Create a diagonal matrix with the element of a vector DAii = Ai
589  static void createDiagonalMatrix(const vpColVector &A, vpMatrix &DA);
591 
592  //---------------------------------
593  // Matrix insertion with Static Public Member Functions
594  //---------------------------------
597  // Insert matrix B in matrix A at the given position (r, c).
598  static vpMatrix insert(const vpMatrix &A, const vpMatrix &B, unsigned int r, unsigned int c);
599  // Insert matrix B in matrix A (not modified) at the given position (r, c),
600  // the result is given in matrix C.
601  static void insert(const vpMatrix &A, const vpMatrix &B, vpMatrix &C, unsigned int r, unsigned int c);
602 
603  //---------------------------------
604  // Stacking with Static Public Member Functions
605  //---------------------------------
608  // Juxtapose to matrices C = [ A B ]
609  static vpMatrix juxtaposeMatrices(const vpMatrix &A, const vpMatrix &B);
610  // Juxtapose to matrices C = [ A B ]
611  static void juxtaposeMatrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C);
612  // Stack two matrices C = [ A B ]^T
613  static vpMatrix stack(const vpMatrix &A, const vpMatrix &B);
614  static vpMatrix stack(const vpMatrix &A, const vpRowVector &r);
615  static vpMatrix stack(const vpMatrix &A, const vpColVector &c);
616 
617  // Stack two matrices C = [ A B ]^T
618  static void stack(const vpMatrix &A, const vpMatrix &B, vpMatrix &C);
619  static void stack(const vpMatrix &A, const vpRowVector &r, vpMatrix &C);
620  static void stack(const vpMatrix &A, const vpColVector &c, vpMatrix &C);
622 
623  //---------------------------------
624  // Matrix operations Static Public Member Functions
625  //---------------------------------
628  static void add2Matrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C);
629  static void add2Matrices(const vpColVector &A, const vpColVector &B, vpColVector &C);
630  static void add2WeightedMatrices(const vpMatrix &A, const double &wA, const vpMatrix &B, const double &wB,
631  vpMatrix &C);
632  static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM);
633  static void mult2Matrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C);
634  static void mult2Matrices(const vpMatrix &A, const vpMatrix &B, vpRotationMatrix &C);
635  static void mult2Matrices(const vpMatrix &A, const vpMatrix &B, vpHomogeneousMatrix &C);
636  static void mult2Matrices(const vpMatrix &A, const vpColVector &B, vpColVector &C);
637  static void multMatrixVector(const vpMatrix &A, const vpColVector &v, vpColVector &w);
638  static void negateMatrix(const vpMatrix &A, vpMatrix &C);
639  static void sub2Matrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C);
640  static void sub2Matrices(const vpColVector &A, const vpColVector &B, vpColVector &C);
642 
643  //---------------------------------
644  // Kronecker product Static Public Member Functions
645  //---------------------------------
648  // Compute Kronecker product matrix
649  static void kron(const vpMatrix &m1, const vpMatrix &m2, vpMatrix &out);
650 
651  // Compute Kronecker product matrix
652  static vpMatrix kron(const vpMatrix &m1, const vpMatrix &m2);
654 
655  //-------------------------------------------------
656  // 2D Convolution Static Public Member Functions
657  //-------------------------------------------------
659  static vpMatrix conv2(const vpMatrix &M, const vpMatrix &kernel, const std::string &mode="full");
660  static void conv2(const vpMatrix &M, const vpMatrix &kernel, vpMatrix &res, const std::string &mode="full");
661 
662  //---------------------------------
663  // Covariance computation Static Public Member Functions
664  //---------------------------------
667  static vpMatrix computeCovarianceMatrix(const vpMatrix &A, const vpColVector &x, const vpColVector &b);
668  static vpMatrix computeCovarianceMatrix(const vpMatrix &A, const vpColVector &x, const vpColVector &b,
669  const vpMatrix &w);
670  static vpMatrix computeCovarianceMatrixVVS(const vpHomogeneousMatrix &cMo, const vpColVector &deltaS,
671  const vpMatrix &Ls, const vpMatrix &W);
672  static vpMatrix computeCovarianceMatrixVVS(const vpHomogeneousMatrix &cMo, const vpColVector &deltaS,
673  const vpMatrix &Ls);
675 
676  //---------------------------------
677  // Matrix I/O Static Public Member Functions
678  //---------------------------------
692  static inline bool loadMatrix(const std::string &filename, vpArray2D<double> &M, bool binary = false,
693  char *header = NULL)
694  {
695  return vpArray2D<double>::load(filename, M, binary, header);
696  }
697 
708  static inline bool loadMatrixYAML(const std::string &filename, vpArray2D<double> &M, char *header = NULL)
709  {
710  return vpArray2D<double>::loadYAML(filename, M, header);
711  }
712 
727  static inline bool saveMatrix(const std::string &filename, const vpArray2D<double> &M, bool binary = false,
728  const char *header = "")
729  {
730  return vpArray2D<double>::save(filename, M, binary, header);
731  }
732 
745  static inline bool saveMatrixYAML(const std::string &filename, const vpArray2D<double> &M, const char *header = "")
746  {
747  return vpArray2D<double>::saveYAML(filename, M, header);
748  }
750 
751 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
752 
760  vp_deprecated void init() {}
761 
765  vp_deprecated void stackMatrices(const vpMatrix &A) { stack(A); }
770  vp_deprecated static vpMatrix stackMatrices(const vpMatrix &A, const vpMatrix &B) { return stack(A, B); }
775  vp_deprecated static void stackMatrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C) { stack(A, B, C); }
780  vp_deprecated static vpMatrix stackMatrices(const vpMatrix &A, const vpRowVector &B);
785  vp_deprecated static void stackMatrices(const vpMatrix &A, const vpRowVector &B, vpMatrix &C);
790  vp_deprecated static vpMatrix stackMatrices(const vpColVector &A, const vpColVector &B);
795  vp_deprecated static void stackMatrices(const vpColVector &A, const vpColVector &B, vpColVector &C);
796 
800  vp_deprecated void setIdentity(const double &val = 1.0);
801 
802  vp_deprecated vpRowVector row(unsigned int i);
803  vp_deprecated vpColVector column(unsigned int j);
804 
806 #endif
807 
808 private:
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,
812  int ldc);
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);
815 #endif
816 
817  static void computeCovarianceMatrixVVS(const vpHomogeneousMatrix &cMo, const vpColVector &deltaS, const vpMatrix &Ls,
818  vpMatrix &Js, vpColVector &deltaP);
819 };
820 
822 
823 #ifndef DOXYGEN_SHOULD_SKIP_THIS
824 VISP_EXPORT
825 #endif
826 vpMatrix operator*(const double &x, const vpMatrix &A);
827 
828 #endif
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:164
static bool saveYAML(const std::string &filename, const vpArray2D< Type > &A, const char *header="")
Definition: vpArray2D.h:831
vpArray2D< Type > & operator=(Type x)
Set all the elements of the array to x.
Definition: vpArray2D.h:414
static bool loadYAML(const std::string &filename, vpArray2D< Type > &A, char *header=NULL)
Definition: vpArray2D.h:653
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of row vector and the associated operations.
Definition: vpRowVector.h:115
static bool save(const std::string &filename, const vpArray2D< Type > &A, bool binary=false, const char *header="")
Definition: vpArray2D.h:738
unsigned int getRows() const
Definition: vpArray2D.h:289
vp_deprecated void stackMatrices(const vpMatrix &A)
Definition: vpMatrix.h:765
Implementation of a generic 2D array used as base class for matrices and vectors. ...
Definition: vpArray2D.h:131
static bool saveMatrix(const std::string &filename, const vpArray2D< double > &M, bool binary=false, const char *header="")
Definition: vpMatrix.h:727
vpMatrix(unsigned int r, unsigned int c, double val)
Definition: vpMatrix.h:197
vpMatrix()
Definition: vpMatrix.h:180
Implementation of a rotation matrix and operations on such kind of matrices.
unsigned int getCols() const
Definition: vpArray2D.h:279
vpColVector operator*(const double &x, const vpColVector &v)
static vp_deprecated void stackMatrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C)
Definition: vpMatrix.h:775
vpMatrix(const vpMatrix &A)
Definition: vpMatrix.h:214
vp_deprecated void init()
Definition: vpMatrix.h:760
void clear()
Definition: vpMatrix.h:230
vpArray2D< Type > hadamard(const vpArray2D< Type > &m) const
Definition: vpArray2D.h:933
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
Definition: vpArray2D.h:494
static vp_deprecated vpMatrix stackMatrices(const vpMatrix &A, const vpMatrix &B)
Definition: vpMatrix.h:770
vpMatrix(unsigned int r, unsigned int c)
Definition: vpMatrix.h:188
Implementation of column vector and the associated operations.
Definition: vpColVector.h:130
virtual ~vpMatrix()
Destructor (Memory de-allocation)
Definition: vpMatrix.h:224
void printSize() const
Definition: vpMatrix.h:576
static bool saveMatrixYAML(const std::string &filename, const vpArray2D< double > &M, const char *header="")
Definition: vpMatrix.h:745
vpMatrix(const vpArray2D< double > &A)
Definition: vpMatrix.h:212
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)
Definition: vpMatrix.h:692
static bool load(const std::string &filename, vpArray2D< Type > &A, bool binary=false, char *header=NULL)
Definition: vpArray2D.h:541
static bool loadMatrixYAML(const std::string &filename, vpArray2D< double > &M, char *header=NULL)
Definition: vpMatrix.h:708