Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
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 
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  void stack(const vpColVector &c);
216  // Stacks columns of a matrix in a vector
217  void stackColumns(vpColVector &out);
218 
219  // Stacks columns of a matrix in a vector
220  vpColVector stackColumns();
221 
222  // Stacks columns of a matrix in a vector
223  void stackRows(vpRowVector &out);
224 
225  // Stacks columns of a matrix in a vector
226  vpRowVector stackRows();
228 
229  //---------------------------------
230  // Matrix insertion
231  //---------------------------------
234  // Insert matrix A in the current matrix at the given position (r, c).
235  void insert(const vpMatrix &A, const unsigned int r, const unsigned int c);
237 
238  //-------------------------------------------------
239  // Columns, Rows extraction, SubMatrix
240  //-------------------------------------------------
243  vpMatrix extract(unsigned int r, unsigned int c, unsigned int nrows, unsigned int ncols) const;
244  vpColVector getCol(const unsigned int j) const;
245  vpColVector getCol(const unsigned int j, const unsigned int i_begin, const unsigned int size) const;
246  vpRowVector getRow(const unsigned int i) const;
247  vpRowVector getRow(const unsigned int i, const unsigned int j_begin, const unsigned int size) const;
248  void init(const vpMatrix &M, unsigned int r, unsigned int c, unsigned int nrows, unsigned int ncols);
250 
251  //---------------------------------
252  // Matrix operations.
253  //---------------------------------
256  // return the determinant of the matrix.
257  double det(vpDetMethod method = LU_DECOMPOSITION) const;
258  double detByLU() const;
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 
272  // Compute the exponential matrix of a square matrix
273  vpMatrix expm() const;
274 
275  // operation A = A + B
276  vpMatrix &operator+=(const vpMatrix &B);
277  // operation A = A - B
278  vpMatrix &operator-=(const vpMatrix &B);
279  vpMatrix operator*(const vpMatrix &B) const;
280  vpMatrix operator*(const vpRotationMatrix &R) const;
281  vpMatrix operator*(const vpVelocityTwistMatrix &V) const;
282  vpMatrix operator*(const vpForceTwistMatrix &V) const;
283  // operation t_out = A * t (A is unchanged, t and t_out are translation
284  // vectors)
285  vpTranslationVector operator*(const vpTranslationVector &tv) const;
286  vpColVector operator*(const vpColVector &v) const;
287  vpMatrix operator+(const vpMatrix &B) const;
288  vpMatrix operator-(const vpMatrix &B) const;
289  vpMatrix operator-() const;
290 
292  vpMatrix &operator+=(const double x);
294  vpMatrix &operator-=(const double x);
296  vpMatrix &operator*=(const double x);
298  vpMatrix &operator/=(double x);
299 
300  // Cij = Aij * x (A is unchanged)
301  vpMatrix operator*(const double x) const;
302  // Cij = Aij / x (A is unchanged)
303  vpMatrix operator/(const double x) const;
304 
310  double sum() const;
311  double sumSquare() const;
312 
313  //-------------------------------------------------
314  // Hadamard product
315  //-------------------------------------------------
317  vpMatrix hadamard(const vpMatrix &m) const;
318 
319  //-------------------------------------------------
320  // Kronecker product
321  //-------------------------------------------------
324  // Compute Kronecker product matrix
325  void kron(const vpMatrix &m1, vpMatrix &out) const;
326 
327  // Compute Kronecker product matrix
328  vpMatrix kron(const vpMatrix &m1) const;
330 
331  //-------------------------------------------------
332  // Transpose
333  //-------------------------------------------------
336  // Compute the transpose C = A^T
337  vpMatrix t() const;
338 
339  // Compute the transpose C = A^T
340  vpMatrix transpose() const;
341  void transpose(vpMatrix &C) const;
342 
343  vpMatrix AAt() const;
344  void AAt(vpMatrix &B) const;
345 
346  vpMatrix AtA() const;
347  void AtA(vpMatrix &B) const;
349 
350  //-------------------------------------------------
351  // Matrix inversion
352  //-------------------------------------------------
355  // inverse matrix A using the LU decomposition
356  vpMatrix inverseByLU() const;
357 
358 #if defined(VISP_HAVE_EIGEN3)
359  vpMatrix inverseByLUEigen3() const;
360 #endif
361 #if defined(VISP_HAVE_GSL)
362  vpMatrix inverseByLUGsl() const;
363 #endif
364 #if defined(VISP_HAVE_LAPACK)
365  vpMatrix inverseByLULapack() const;
366 #endif
367 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101)
368  vpMatrix inverseByLUOpenCV() const;
369 #endif
370 
371  // inverse matrix A using the Cholesky decomposition (only for real
372  // symmetric matrices)
373  vpMatrix inverseByCholesky() const;
374 
375 #if defined(VISP_HAVE_LAPACK)
376  vpMatrix inverseByCholeskyLapack() const;
377 #endif
378 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101)
379  vpMatrix inverseByCholeskyOpenCV() const;
380 #endif
381 
382  // inverse matrix A using the QR decomposition
383  vpMatrix inverseByQR() const;
384 #if defined(VISP_HAVE_LAPACK)
385  vpMatrix inverseByQRLapack() const;
386 #endif
387 
388  // inverse triangular matrix
389  vpMatrix inverseTriangular(bool upper = true) const;
390 
391 
392  vpMatrix pseudoInverse(double svThreshold = 1e-6) const;
393  unsigned int pseudoInverse(vpMatrix &Ap, double svThreshold = 1e-6) const;
394  unsigned int pseudoInverse(vpMatrix &Ap, vpColVector &sv, double svThreshold = 1e-6) const;
395  unsigned int pseudoInverse(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt) const;
396  unsigned int pseudoInverse(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt,
397  vpMatrix &kerAt) const;
398 
399 #if defined(VISP_HAVE_LAPACK)
400  vpMatrix pseudoInverseLapack(double svThreshold = 1e-6) const;
401  unsigned int pseudoInverseLapack(vpMatrix &Ap, double svThreshold = 1e-6) const;
402  unsigned int pseudoInverseLapack(vpMatrix &Ap, vpColVector &sv, double svThreshold = 1e-6) const;
403  unsigned int pseudoInverseLapack(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt,
404  vpMatrix &kerAt) const;
405 #endif
406 #if defined(VISP_HAVE_EIGEN3)
407  vpMatrix pseudoInverseEigen3(double svThreshold = 1e-6) const;
408  unsigned int pseudoInverseEigen3(vpMatrix &Ap, double svThreshold = 1e-6) const;
409  unsigned int pseudoInverseEigen3(vpMatrix &Ap, vpColVector &sv, double svThreshold = 1e-6) const;
410  unsigned int pseudoInverseEigen3(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt,
411  vpMatrix &kerAt) const;
412 #endif
413 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101)
414  vpMatrix pseudoInverseOpenCV(double svThreshold = 1e-6) const;
415  unsigned int pseudoInverseOpenCV(vpMatrix &Ap, double svThreshold = 1e-6) const;
416  unsigned int pseudoInverseOpenCV(vpMatrix &Ap, vpColVector &sv, double svThreshold = 1e-6) const;
417  unsigned int pseudoInverseOpenCV(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt,
418  vpMatrix &kerAt) const;
419 #endif
420 #if defined(VISP_HAVE_GSL)
421  vpMatrix pseudoInverseGsl(double svThreshold = 1e-6) const;
422  unsigned int pseudoInverseGsl(vpMatrix &Ap, double svThreshold = 1e-6) const;
423  unsigned int pseudoInverseGsl(vpMatrix &Ap, vpColVector &sv, double svThreshold = 1e-6) const;
424  unsigned int pseudoInverseGsl(vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt,
425  vpMatrix &kerAt) const;
426 #endif
427 
429 
430  //-------------------------------------------------
431  // SVD decomposition
432  //-------------------------------------------------
433 
436  double cond() const;
437  unsigned int kernel(vpMatrix &kerAt, double svThreshold = 1e-6) const;
438 
439  // solve Ax=B using the SVD decomposition (usage A = solveBySVD(B,x) )
440  void solveBySVD(const vpColVector &B, vpColVector &x) const;
441  // solve Ax=B using the SVD decomposition (usage x=A.solveBySVD(B))
442  vpColVector solveBySVD(const vpColVector &B) const;
443 
444  // singular value decomposition SVD
445  void svd(vpColVector &w, vpMatrix &V);
446 #ifdef VISP_HAVE_EIGEN3
447  void svdEigen3(vpColVector &w, vpMatrix &V);
448 #endif
449 #ifdef VISP_HAVE_GSL
450  void svdGsl(vpColVector &w, vpMatrix &V);
451 #endif
452 #ifdef VISP_HAVE_LAPACK
453  void svdLapack(vpColVector &w, vpMatrix &V);
454 #endif
455 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1
456  void svdOpenCV(vpColVector &w, vpMatrix &V);
457 #endif
458 
459 
460  //-------------------------------------------------
461  // QR decomposition
462  //-------------------------------------------------
463 
466  unsigned int qr(vpMatrix &Q, vpMatrix &R, bool full = false, bool squareR = false, double tol = 1e-6) const;
467  unsigned int qrPivot(vpMatrix &Q, vpMatrix &R, vpMatrix &P, bool full = false, bool squareR = false, double tol = 1e-6) const;
468  void solveByQR(const vpColVector &b, vpColVector &x) const;
469  vpColVector solveByQR(const vpColVector &b) const;
471 
472  //-------------------------------------------------
473  // Eigen values and vectors
474  //-------------------------------------------------
478  // compute the eigen values using the Gnu Scientific library
479  vpColVector eigenValues() const;
480  void eigenValues(vpColVector &evalue, vpMatrix &evector) const;
482 
483  //-------------------------------------------------
484  // Norms
485  //-------------------------------------------------
488  double euclideanNorm() const;
489  double infinityNorm() const;
491 
492  //---------------------------------
493  // Printing
494  //---------------------------------
497  std::ostream &cppPrint(std::ostream &os, const std::string &matrixName = "A", bool octet = false) const;
498  std::ostream &csvPrint(std::ostream &os) const;
499  std::ostream &maplePrint(std::ostream &os) const;
500  std::ostream &matlabPrint(std::ostream &os) const;
501  int print(std::ostream &s, unsigned int length, char const *intro = 0) const;
502  void printSize() const { std::cout << getRows() << " x " << getCols() << " "; }
504 
505  //------------------------------------------------------------------
506  // Static functionalities
507  //------------------------------------------------------------------
508 
509  //---------------------------------
510  // Setting a diagonal matrix with Static Public Member Functions
511  //---------------------------------
514  // Create a diagonal matrix with the element of a vector DAii = Ai
515  static void createDiagonalMatrix(const vpColVector &A, vpMatrix &DA);
517 
518  //---------------------------------
519  // Matrix insertion with Static Public Member Functions
520  //---------------------------------
523  // Insert matrix B in matrix A at the given position (r, c).
524  static vpMatrix insert(const vpMatrix &A, const vpMatrix &B, const unsigned int r, const unsigned int c);
525  // Insert matrix B in matrix A (not modified) at the given position (r, c),
526  // the result is given in matrix C.
527  static void insert(const vpMatrix &A, const vpMatrix &B, vpMatrix &C, const unsigned int r, const unsigned int c);
528 
529  //---------------------------------
530  // Stacking with Static Public Member Functions
531  //---------------------------------
534  // Juxtapose to matrices C = [ A B ]
535  static vpMatrix juxtaposeMatrices(const vpMatrix &A, const vpMatrix &B);
536  // Juxtapose to matrices C = [ A B ]
537  static void juxtaposeMatrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C);
538  // Stack two matrices C = [ A B ]^T
539  static vpMatrix stack(const vpMatrix &A, const vpMatrix &B);
540  static vpMatrix stack(const vpMatrix &A, const vpRowVector &r);
541  static vpMatrix stack(const vpMatrix &A, const vpColVector &c);
542 
543  // Stack two matrices C = [ A B ]^T
544  static void stack(const vpMatrix &A, const vpMatrix &B, vpMatrix &C);
545  static void stack(const vpMatrix &A, const vpRowVector &r, vpMatrix &C);
546  static void stack(const vpMatrix &A, const vpColVector &c, vpMatrix &C);
548 
549  //---------------------------------
550  // Matrix operations Static Public Member Functions
551  //---------------------------------
554  static void add2Matrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C);
555  static void add2Matrices(const vpColVector &A, const vpColVector &B, vpColVector &C);
556  static void add2WeightedMatrices(const vpMatrix &A, const double &wA, const vpMatrix &B, const double &wB,
557  vpMatrix &C);
558  static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM);
559  static void mult2Matrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C);
560  static void mult2Matrices(const vpMatrix &A, const vpMatrix &B, vpRotationMatrix &C);
561  static void mult2Matrices(const vpMatrix &A, const vpMatrix &B, vpHomogeneousMatrix &C);
562  static void mult2Matrices(const vpMatrix &A, const vpColVector &B, vpColVector &C);
563  static void multMatrixVector(const vpMatrix &A, const vpColVector &v, vpColVector &w);
564  static void negateMatrix(const vpMatrix &A, vpMatrix &C);
565  static void sub2Matrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C);
566  static void sub2Matrices(const vpColVector &A, const vpColVector &B, vpColVector &C);
568 
569  //---------------------------------
570  // Kronecker product Static Public Member Functions
571  //---------------------------------
574  // Compute Kronecker product matrix
575  static void kron(const vpMatrix &m1, const vpMatrix &m2, vpMatrix &out);
576 
577  // Compute Kronecker product matrix
578  static vpMatrix kron(const vpMatrix &m1, const vpMatrix &m2);
580 
581  //-------------------------------------------------
582  // 2D Convolution Static Public Member Functions
583  //-------------------------------------------------
585  static vpMatrix conv2(const vpMatrix &M, const vpMatrix &kernel, const std::string &mode="full");
586  static void conv2(const vpMatrix &M, const vpMatrix &kernel, vpMatrix &res, const std::string &mode="full");
587 
588  //---------------------------------
589  // Covariance computation Static Public Member Functions
590  //---------------------------------
593  static vpMatrix computeCovarianceMatrix(const vpMatrix &A, const vpColVector &x, const vpColVector &b);
594  static vpMatrix computeCovarianceMatrix(const vpMatrix &A, const vpColVector &x, const vpColVector &b,
595  const vpMatrix &w);
596  static vpMatrix computeCovarianceMatrixVVS(const vpHomogeneousMatrix &cMo, const vpColVector &deltaS,
597  const vpMatrix &Ls, const vpMatrix &W);
598  static vpMatrix computeCovarianceMatrixVVS(const vpHomogeneousMatrix &cMo, const vpColVector &deltaS,
599  const vpMatrix &Ls);
601 
602  //---------------------------------
603  // Matrix I/O Static Public Member Functions
604  //---------------------------------
618  static inline bool loadMatrix(const std::string &filename, vpArray2D<double> &M, const bool binary = false,
619  char *header = NULL)
620  {
621  return vpArray2D<double>::load(filename, M, binary, header);
622  }
623 
634  static inline bool loadMatrixYAML(const std::string &filename, vpArray2D<double> &M, char *header = NULL)
635  {
636  return vpArray2D<double>::loadYAML(filename, M, header);
637  }
638 
653  static inline bool saveMatrix(const std::string &filename, const vpArray2D<double> &M, const bool binary = false,
654  const char *header = "")
655  {
656  return vpArray2D<double>::save(filename, M, binary, header);
657  }
658 
671  static inline bool saveMatrixYAML(const std::string &filename, const vpArray2D<double> &M, const char *header = "")
672  {
673  return vpArray2D<double>::saveYAML(filename, M, header);
674  }
676 
677 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
678 
686  vp_deprecated void init() {}
687 
691  vp_deprecated void stackMatrices(const vpMatrix &A) { stack(A); }
696  vp_deprecated static vpMatrix stackMatrices(const vpMatrix &A, const vpMatrix &B) { return stack(A, B); }
701  vp_deprecated static void stackMatrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C) { stack(A, B, C); }
706  vp_deprecated static vpMatrix stackMatrices(const vpMatrix &A, const vpRowVector &B);
711  vp_deprecated static void stackMatrices(const vpMatrix &A, const vpRowVector &B, vpMatrix &C);
716  vp_deprecated static vpMatrix stackMatrices(const vpColVector &A, const vpColVector &B);
721  vp_deprecated static void stackMatrices(const vpColVector &A, const vpColVector &B, vpColVector &C);
722 
726  vp_deprecated void setIdentity(const double &val = 1.0);
727 
728  vp_deprecated vpRowVector row(const unsigned int i);
729  vp_deprecated vpColVector column(const unsigned int j);
730 
732 #endif
733 
734 private:
735 #if defined(VISP_HAVE_LAPACK) && !defined(VISP_HAVE_LAPACK_BUILT_IN)
736  static void blas_dgemm(char trans_a, char trans_b, const int M, const int N, const int K, double alpha,
737  double *a_data, const int lda, double *b_data, const int ldb, double beta, double *c_data,
738  const int ldc);
739  static void blas_dgemv(char trans, const int M, const int N, double alpha, double *a_data, const int lda,
740  double *x_data, const int incx, double beta, double *y_data, const int incy);
741 #endif
742 
743  static void computeCovarianceMatrixVVS(const vpHomogeneousMatrix &cMo, const vpColVector &deltaS, const vpMatrix &Ls,
744  vpMatrix &Js, vpColVector &deltaP);
745 };
746 
748 
749 #ifndef DOXYGEN_SHOULD_SKIP_THIS
750 VISP_EXPORT
751 #endif
752 vpMatrix operator*(const double &x, const vpMatrix &A);
753 
754 #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:519
static bool saveYAML(const std::string &filename, const vpArray2D< Type > &A, const char *header="")
Definition: vpArray2D.h:612
static bool loadMatrix(const std::string &filename, vpArray2D< double > &M, const bool binary=false, char *header=NULL)
Definition: vpMatrix.h:618
vpArray2D< Type > & operator=(Type x)
Set all the elements of the array to x.
Definition: vpArray2D.h:247
static bool loadYAML(const std::string &filename, vpArray2D< Type > &A, char *header=NULL)
Definition: vpArray2D.h:434
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of row vector and the associated operations.
Definition: vpRowVector.h:72
vp_deprecated void stackMatrices(const vpMatrix &A)
Definition: vpMatrix.h:691
Implementation of a generic 2D array used as vase class of matrices and vectors.
Definition: vpArray2D.h:70
unsigned int getCols() const
Definition: vpArray2D.h:146
void printSize() const
Definition: vpMatrix.h:502
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.
vpColVector operator*(const double &x, const vpColVector &v)
static vp_deprecated void stackMatrices(const vpMatrix &A, const vpMatrix &B, vpMatrix &C)
Definition: vpMatrix.h:701
vpMatrix(const vpMatrix &A)
Definition: vpMatrix.h:152
vp_deprecated void init()
Definition: vpMatrix.h:686
static bool load(const std::string &filename, vpArray2D< Type > &A, const bool binary=false, char *header=NULL)
Definition: vpArray2D.h:322
void clear()
Definition: vpMatrix.h:164
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
Definition: vpArray2D.h:275
unsigned int getRows() const
Definition: vpArray2D.h:156
vpArray2D< Type > hadamard(const vpArray2D< Type > &m) const
Definition: vpArray2D.h:714
static vp_deprecated vpMatrix stackMatrices(const vpMatrix &A, const vpMatrix &B)
Definition: vpMatrix.h:696
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
static bool saveMatrixYAML(const std::string &filename, const vpArray2D< double > &M, const char *header="")
Definition: vpMatrix.h:671
static bool saveMatrix(const std::string &filename, const vpArray2D< double > &M, const bool binary=false, const char *header="")
Definition: vpMatrix.h:653
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:634