Visual Servoing Platform
version 3.1.0
|
#include <visp3/core/vpMatrix.h>
Public Types | |
enum | vpDetMethod { LU_DECOMPOSITION } |
Public Member Functions | |
vpMatrix () | |
vpMatrix (unsigned int r, unsigned int c) | |
vpMatrix (unsigned int r, unsigned int c, double val) | |
vpMatrix (const vpMatrix &M, unsigned int r, unsigned int c, unsigned int nrows, unsigned int ncols) | |
vpMatrix (const vpArray2D< double > &A) | |
vpMatrix (const vpMatrix &A) | |
vpMatrix (vpMatrix &&A) | |
virtual | ~vpMatrix () |
void | clear () |
Setting a diagonal matrix | |
void | diag (const double &val=1.0) |
void | diag (const vpColVector &A) |
void | eye () |
void | eye (unsigned int n) |
void | eye (unsigned int m, unsigned int n) |
Assignment operators | |
vpMatrix & | operator<< (double *) |
vpMatrix & | operator= (const vpArray2D< double > &A) |
vpMatrix & | operator= (const vpMatrix &A) |
vpMatrix & | operator= (vpMatrix &&A) |
vpMatrix & | operator= (const double x) |
Stacking | |
void | stack (const vpMatrix &A) |
void | stack (const vpRowVector &r) |
void | stackColumns (vpColVector &out) |
vpColVector | stackColumns () |
void | stackRows (vpRowVector &out) |
vpRowVector | stackRows () |
Matrix insertion | |
void | insert (const vpMatrix &A, const unsigned int r, const unsigned int c) |
Columns, rows, sub-matrices extraction | |
vpMatrix | extract (unsigned int r, unsigned int c, unsigned int nrows, unsigned int ncols) const |
vpColVector | getCol (const unsigned int j) const |
vpColVector | getCol (const unsigned int j, const unsigned int i_begin, const unsigned int size) const |
vpRowVector | getRow (const unsigned int i) const |
vpRowVector | getRow (const unsigned int i, const unsigned int j_begin, const unsigned int size) const |
void | init (const vpMatrix &M, unsigned int r, unsigned int c, unsigned int nrows, unsigned int ncols) |
Matrix operations | |
double | det (vpDetMethod method=LU_DECOMPOSITION) const |
double | detByLU () const |
vpMatrix | expm () const |
vpMatrix & | operator+= (const vpMatrix &B) |
vpMatrix & | operator-= (const vpMatrix &B) |
vpMatrix | operator* (const vpMatrix &B) const |
vpMatrix | operator* (const vpRotationMatrix &R) const |
vpMatrix | operator* (const vpVelocityTwistMatrix &V) const |
vpMatrix | operator* (const vpForceTwistMatrix &V) const |
vpTranslationVector | operator* (const vpTranslationVector &tv) const |
vpColVector | operator* (const vpColVector &v) const |
vpMatrix | operator+ (const vpMatrix &B) const |
vpMatrix | operator- (const vpMatrix &B) const |
vpMatrix | operator- () const |
vpMatrix & | operator+= (const double x) |
vpMatrix & | operator-= (const double x) |
vpMatrix & | operator*= (const double x) |
vpMatrix & | operator/= (double x) |
vpMatrix | operator* (const double x) const |
vpMatrix | operator/ (const double x) const |
double | sum () const |
double | sumSquare () const |
Hadamard product | |
vpMatrix | hadamard (const vpMatrix &m) const |
Kronecker product | |
void | kron (const vpMatrix &m1, vpMatrix &out) const |
vpMatrix | kron (const vpMatrix &m1) const |
Transpose | |
vpMatrix | t () const |
vpMatrix | transpose () const |
void | transpose (vpMatrix &C) const |
vpMatrix | AAt () const |
void | AAt (vpMatrix &B) const |
vpMatrix | AtA () const |
void | AtA (vpMatrix &B) const |
Matrix inversion | |
vpMatrix | inverseByLU () const |
vpMatrix | inverseByCholesky () const |
vpMatrix | inverseByQR () const |
vpMatrix | pseudoInverse (double svThreshold=1e-6) const |
unsigned int | pseudoInverse (vpMatrix &Ap, double svThreshold=1e-6) const |
unsigned int | pseudoInverse (vpMatrix &Ap, vpColVector &sv, double svThreshold=1e-6) const |
unsigned int | pseudoInverse (vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt) const |
unsigned int | pseudoInverse (vpMatrix &Ap, vpColVector &sv, double svThreshold, vpMatrix &imA, vpMatrix &imAt, vpMatrix &kerAt) const |
SVD decomposition | |
double | cond () const |
unsigned int | kernel (vpMatrix &kerAt, double svThreshold=1e-6) const |
void | solveBySVD (const vpColVector &B, vpColVector &x) const |
vpColVector | solveBySVD (const vpColVector &B) const |
void | svd (vpColVector &w, vpMatrix &V) |
Eigen values | |
vpColVector | eigenValues () const |
void | eigenValues (vpColVector &evalue, vpMatrix &evector) const |
Norms | |
double | euclideanNorm () const |
double | infinityNorm () const |
Printing | |
std::ostream & | cppPrint (std::ostream &os, const std::string &matrixName="A", bool octet=false) const |
std::ostream & | csvPrint (std::ostream &os) const |
std::ostream & | maplePrint (std::ostream &os) const |
std::ostream & | matlabPrint (std::ostream &os) const |
int | print (std::ostream &s, unsigned int length, char const *intro=0) const |
void | printSize () const |
Inherited functionalities from vpArray2D | |
unsigned int | getCols () const |
double | getMaxValue () const |
double | getMinValue () const |
unsigned int | getRows () const |
unsigned int | size () const |
void | resize (const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true, const bool recopy_=true) |
double * | operator[] (unsigned int i) |
double * | operator[] (unsigned int i) const |
vpArray2D< double > | hadamard (const vpArray2D< double > &m) const |
Static Public Member Functions | |
Setting a diagonal matrix with Static Public Member Functions | |
static void | createDiagonalMatrix (const vpColVector &A, vpMatrix &DA) |
Matrix insertion with Static Public Member Functions | |
static vpMatrix | insert (const vpMatrix &A, const vpMatrix &B, const unsigned int r, const unsigned int c) |
static void | insert (const vpMatrix &A, const vpMatrix &B, vpMatrix &C, const unsigned int r, const unsigned int c) |
Stacking with Static Public Member Functions | |
static vpMatrix | juxtaposeMatrices (const vpMatrix &A, const vpMatrix &B) |
static void | juxtaposeMatrices (const vpMatrix &A, const vpMatrix &B, vpMatrix &C) |
static vpMatrix | stack (const vpMatrix &A, const vpMatrix &B) |
static vpMatrix | stack (const vpMatrix &A, const vpRowVector &r) |
static void | stack (const vpMatrix &A, const vpMatrix &B, vpMatrix &C) |
static void | stack (const vpMatrix &A, const vpRowVector &r, vpMatrix &C) |
Matrix operations with Static Public Member Functions | |
static void | add2Matrices (const vpMatrix &A, const vpMatrix &B, vpMatrix &C) |
static void | add2Matrices (const vpColVector &A, const vpColVector &B, vpColVector &C) |
static void | add2WeightedMatrices (const vpMatrix &A, const double &wA, const vpMatrix &B, const double &wB, vpMatrix &C) |
static void | computeHLM (const vpMatrix &H, const double &alpha, vpMatrix &HLM) |
static void | mult2Matrices (const vpMatrix &A, const vpMatrix &B, vpMatrix &C) |
static void | mult2Matrices (const vpMatrix &A, const vpMatrix &B, vpRotationMatrix &C) |
static void | mult2Matrices (const vpMatrix &A, const vpMatrix &B, vpHomogeneousMatrix &C) |
static void | mult2Matrices (const vpMatrix &A, const vpColVector &B, vpColVector &C) |
static void | multMatrixVector (const vpMatrix &A, const vpColVector &v, vpColVector &w) |
static void | negateMatrix (const vpMatrix &A, vpMatrix &C) |
static void | sub2Matrices (const vpMatrix &A, const vpMatrix &B, vpMatrix &C) |
static void | sub2Matrices (const vpColVector &A, const vpColVector &B, vpColVector &C) |
Kronecker product with Static Public Member Functions | |
static void | kron (const vpMatrix &m1, const vpMatrix &m2, vpMatrix &out) |
static vpMatrix | kron (const vpMatrix &m1, const vpMatrix &m2) |
Covariance computation with Static Public Member Functions | |
static vpMatrix | computeCovarianceMatrix (const vpMatrix &A, const vpColVector &x, const vpColVector &b) |
static vpMatrix | computeCovarianceMatrix (const vpMatrix &A, const vpColVector &x, const vpColVector &b, const vpMatrix &w) |
static vpMatrix | computeCovarianceMatrixVVS (const vpHomogeneousMatrix &cMo, const vpColVector &deltaS, const vpMatrix &Ls, const vpMatrix &W) |
static vpMatrix | computeCovarianceMatrixVVS (const vpHomogeneousMatrix &cMo, const vpColVector &deltaS, const vpMatrix &Ls) |
Matrix I/O with Static Public Member Functions | |
static bool | loadMatrix (const std::string &filename, vpArray2D< double > &M, const bool binary=false, char *header=NULL) |
static bool | loadMatrixYAML (const std::string &filename, vpArray2D< double > &M, char *header=NULL) |
static bool | saveMatrix (const std::string &filename, const vpArray2D< double > &M, const bool binary=false, const char *header="") |
static bool | saveMatrixYAML (const std::string &filename, const vpArray2D< double > &M, const char *header="") |
Inherited I/O from vpArray2D with Static Public Member Functions | |
static bool | load (const std::string &filename, vpArray2D< double > &A, const bool binary=false, char *header=NULL) |
static bool | loadYAML (const std::string &filename, vpArray2D< double > &A, char *header=NULL) |
static bool | save (const std::string &filename, const vpArray2D< double > &A, const bool binary=false, const char *header="") |
static bool | saveYAML (const std::string &filename, const vpArray2D< double > &A, const char *header="") |
Public Attributes | |
double * | data |
Protected Attributes | |
unsigned int | rowNum |
unsigned int | colNum |
double ** | rowPtrs |
unsigned int | dsize |
Related Functions | |
(Note that these are not member functions.) | |
vpMatrix | operator* (const double &x, const vpMatrix &B) |
enum | vpGEMMmethod |
void | vpGEMM (const vpArray2D< double > &A, const vpArray2D< double > &B, const double &alpha, const vpArray2D< double > &C, const double &beta, vpArray2D< double > &D, const unsigned int &ops=0) |
Deprecated functions | |
vp_deprecated void | init () |
vp_deprecated void | stackMatrices (const vpMatrix &A) |
vp_deprecated void | setIdentity (const double &val=1.0) |
vp_deprecated vpRowVector | row (const unsigned int i) |
vp_deprecated vpColVector | column (const unsigned int j) |
static vp_deprecated vpMatrix | stackMatrices (const vpMatrix &A, const vpMatrix &B) |
static vp_deprecated void | stackMatrices (const vpMatrix &A, const vpMatrix &B, vpMatrix &C) |
static vp_deprecated vpMatrix | stackMatrices (const vpMatrix &A, const vpRowVector &B) |
static vp_deprecated void | stackMatrices (const vpMatrix &A, const vpRowVector &B, vpMatrix &C) |
static vp_deprecated vpMatrix | stackMatrices (const vpColVector &A, const vpColVector &B) |
static vp_deprecated void | stackMatrices (const vpColVector &A, const vpColVector &B, vpColVector &C) |
Implementation of a matrix and operations on matrices.
This class needs one of the following third-party to compute matrix inverse, pseudo-inverse, singular value decomposition, determinant:
vpMatrix class provides a data structure for the matrices as well as a set of operations on these matrices.
The vpMatrix class is derived from vpArray2D<double>.
Definition at line 104 of file vpMatrix.h.
Method used to compute the determinant of a square matrix.
Enumerator | |
---|---|
LU_DECOMPOSITION | LU decomposition method. |
Definition at line 111 of file vpMatrix.h.
|
inline |
Basic constructor of a matrix of double. Number of columns and rows are zero.
Definition at line 120 of file vpMatrix.h.
|
inline |
Constructor that initialize a matrix of double with 0.
r | : Matrix number of rows. |
c | : Matrix number of columns. |
Definition at line 127 of file vpMatrix.h.
|
inline |
Constructor that initialize a matrix of double with val.
r | : Matrix number of rows. |
c | : Matrix number of columns. |
val | : Each element of the matrix is set to val. |
Definition at line 135 of file vpMatrix.h.
vpMatrix::vpMatrix | ( | const vpMatrix & | M, |
unsigned int | r, | ||
unsigned int | c, | ||
unsigned int | nrows, | ||
unsigned int | ncols | ||
) |
Construct a matrix as a sub-matrix of the input matrix M.
Definition at line 181 of file vpMatrix.cpp.
References vpArray2D< Type >::colNum, vpException::dimensionError, init(), and vpArray2D< Type >::rowNum.
|
inline |
Create a matrix from a 2D array that could be one of the following container that inherit from vpArray2D such as vpMatrix, vpRotationMatrix, vpHomogeneousMatrix, vpPoseVector, vpColVector, vpRowVector...
The following example shows how to create a matrix from an homogeneous matrix:
Definition at line 149 of file vpMatrix.h.
|
inline |
Definition at line 152 of file vpMatrix.h.
vpMatrix::vpMatrix | ( | vpMatrix && | A | ) |
Definition at line 196 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::data, vpArray2D< double >::dsize, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
|
inlinevirtual |
Destructor (Memory de-allocation)
Definition at line 158 of file vpMatrix.h.
vpMatrix vpMatrix::AAt | ( | ) | const |
Computes the operation
Definition at line 426 of file vpMatrix.cpp.
void vpMatrix::AAt | ( | vpMatrix & | B | ) | const |
Compute the AAt operation such as .
The result is placed in the parameter B and not returned.
A new matrix won't be allocated for every use of the function. This results in a speed gain if used many times with the same result matrix size.
Definition at line 446 of file vpMatrix.cpp.
References vpArray2D< Type >::colNum, vpArray2D< double >::colNum, vpArray2D< Type >::resize(), vpArray2D< double >::rowNum, vpArray2D< Type >::rowNum, and vpArray2D< double >::rowPtrs.
Operation C = A + B.
The result is placed in the third parameter C and not returned. A new matrix won't be allocated for every use of the function (speed gain if used many times with the same result matrix size).
Definition at line 1112 of file vpMatrix.cpp.
References vpArray2D< Type >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< Type >::resize(), vpArray2D< Type >::rowNum, and vpArray2D< Type >::rowPtrs.
Referenced by operator+().
|
static |
Operation C = A + B.
The result is placed in the third parameter C and not returned. A new vector won't be allocated for every use of the function (speed gain if used many times with the same result matrix size).
Definition at line 1145 of file vpMatrix.cpp.
References vpArray2D< Type >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpColVector::resize(), vpArray2D< Type >::rowNum, and vpArray2D< Type >::rowPtrs.
|
static |
Operation C = A*wA + B*wB
The result is placed in the third parameter C and not returned. A new matrix won't be allocated for every use of the function (Speed gain if used many times with the same result matrix size).
Definition at line 1083 of file vpMatrix.cpp.
References vpArray2D< Type >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< Type >::resize(), vpArray2D< Type >::rowNum, and vpArray2D< Type >::rowPtrs.
vpMatrix vpMatrix::AtA | ( | ) | const |
Compute the AtA operation such as
Definition at line 524 of file vpMatrix.cpp.
Referenced by vpCalibration::calibrationTsai(), vpMbDepthDenseTracker::computeVVS(), vpMbDepthNormalTracker::computeVVS(), vpMbGenericTracker::computeVVS(), vpMbEdgeMultiTracker::computeVVSFirstPhasePoseEstimation(), vpMbEdgeTracker::computeVVSFirstPhasePoseEstimation(), vpMbTracker::computeVVSPoseEstimation(), vpTemplateTrackerWarpHomographySL3::findWarp(), vpNurbs::globalCurveApprox(), vpMbGenericTracker::track(), and vpTemplateTrackerWarp::warp().
void vpMatrix::AtA | ( | vpMatrix & | B | ) | const |
Compute the AtA operation such as .
The result is placed in the parameter B and not returned.
A new matrix won't be allocated for every use of the function. This results in a speed gain if used many times with the same result matrix size.
Definition at line 480 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< Type >::colNum, vpArray2D< double >::data, vpArray2D< Type >::data, vpArray2D< Type >::resize(), vpArray2D< double >::rowNum, and vpArray2D< Type >::rowNum.
|
inline |
Removes all elements from the matrix (which are destroyed), leaving the container with a size of 0.
Definition at line 164 of file vpMatrix.h.
References vpArray2D< Type >::hadamard(), operator*(), vpArray2D< Type >::operator<<, and vpArray2D< Type >::operator=().
Referenced by vpPose::init().
vpColVector vpMatrix::column | ( | const unsigned int | j | ) |
Return the j-th columns of the matrix.
j | : Index of the column to extract. |
Definition at line 5132 of file vpMatrix.cpp.
References vpArray2D< double >::getRows().
|
static |
Compute the covariance matrix of the parameters x from a least squares minimisation defined as: Ax = b
A | : Matrix A from Ax = b. |
x | : Vector x from Ax = b corresponding to the parameters to estimate. |
b | : Vector b from Ax = b. |
Definition at line 59 of file vpMatrix_covariance.cpp.
References vpException::divideByZeroError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), pseudoInverse(), and t().
Referenced by computeCovarianceMatrixVVS(), vpPoseFeatures::computePose(), and vpPose::poseVirtualVSrobust().
|
static |
Compute the covariance matrix of the parameters x from a least squares minimisation defined as: WAx = Wb
A | : Matrix A from WAx = Wb. |
x | : Vector x from WAx = Wb corresponding to the parameters to estimate. |
b | : Vector b from WAx = Wb. |
W | : Diagonal weigths matrix from WAx = Wb. |
Definition at line 91 of file vpMatrix_covariance.cpp.
References vpException::divideByZeroError, vpArray2D< Type >::getCols(), and t().
|
static |
Compute the covariance matrix of an image-based virtual visual servoing. This assumes the optimization has been done via v = (W * Ls).pseudoInverse() W * DeltaS.
cMo | : Pose matrix that has been computed with the v. |
deltaS | : Error vector used in v = (W * Ls).pseudoInverse() * W * DeltaS. |
Ls | : interaction matrix used in v = (W * Ls).pseudoInverse() * W * DeltaS. |
W | : Weight matrix used in v = (W * Ls).pseudoInverse() * W * DeltaS. |
Definition at line 149 of file vpMatrix_covariance.cpp.
References computeCovarianceMatrix(), vpHomogeneousMatrix::extract(), eye(), vpArray2D< Type >::getRows(), pseudoInverse(), vpMath::sinc(), vpTranslationVector::skew(), vpColVector::skew(), vpMath::sqr(), and vpColVector::sumSquare().
Referenced by computeCovarianceMatrixVVS(), vpMbTracker::computeCovarianceMatrixVVS(), and vpPose::poseVirtualVS().
|
static |
Compute the covariance matrix of an image-based virtual visual servoing. This assumes the optimization has been done via v = Ls.pseudoInverse() * DeltaS.
cMo | : Pose matrix that has been computed with the v. |
deltaS | : Error vector used in v = Ls.pseudoInverse() * DeltaS |
Ls | : interaction matrix used in v = Ls.pseudoInverse() * DeltaS |
Definition at line 124 of file vpMatrix_covariance.cpp.
References computeCovarianceMatrix(), and computeCovarianceMatrixVVS().
Compute
H | : input Matrix . This matrix should be square. |
alpha | : Scalar |
HLM | : Resulting operation. |
Definition at line 5013 of file vpMatrix.cpp.
References vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), and vpArray2D< Type >::resize().
Referenced by vpTemplateTrackerWarpHomographySL3::findWarp(), vpTemplateTrackerSSDESM::initCompInverse(), vpTemplateTrackerSSDInverseCompositional::initCompInverse(), vpTemplateTrackerZNCCForwardAdditional::initHessienDesired(), vpTemplateTrackerMIForwardCompositional::initHessienDesired(), vpTemplateTrackerZNCCInverseCompositional::initHessienDesired(), vpTemplateTrackerMIESM::initHessienDesired(), vpTemplateTrackerMIForwardAdditional::initHessienDesired(), vpTemplateTrackerMIInverseCompositional::initHessienDesired(), vpTemplateTracker::setHDes(), vpTemplateTrackerSSDForwardCompositional::trackNoPyr(), vpTemplateTrackerMIForwardCompositional::trackNoPyr(), vpTemplateTrackerSSDESM::trackNoPyr(), vpTemplateTrackerSSDForwardAdditional::trackNoPyr(), vpTemplateTrackerMIESM::trackNoPyr(), vpTemplateTrackerMIForwardAdditional::trackNoPyr(), vpTemplateTrackerMIInverseCompositional::trackNoPyr(), and vpTemplateTrackerWarp::warp().
double vpMatrix::cond | ( | ) | const |
Definition at line 4987 of file vpMatrix.cpp.
References vpArray2D< Type >::getCols(), and svd().
Referenced by vpTemplateTrackerMIForwardCompositional::trackNoPyr(), vpTemplateTrackerMIESM::trackNoPyr(), vpTemplateTrackerMIForwardAdditional::trackNoPyr(), and vpTemplateTrackerMIInverseCompositional::trackNoPyr().
std::ostream & vpMatrix::cppPrint | ( | std::ostream & | os, |
const std::string & | matrixName = "A" , |
||
bool | octet = false |
||
) | const |
Print to be used as part of a C++ code later.
os | : the stream to be printed in. |
matrixName | : name of the matrix, "A" by default. |
octet | : if false, print using double, if true, print byte per byte each bytes of the double array. |
The following code shows how to use this function:
It produces the following output that could be copy/paste in a C++ code:
Definition at line 4423 of file vpMatrix.cpp.
References vpArray2D< double >::getCols(), and vpArray2D< double >::getRows().
Referenced by vpColVector::clear().
|
static |
Create a diagonal matrix with the element of a vector .
A | : Vector which element will be put in the diagonal. |
DA | : Diagonal matrix DA[i][i] = A[i] |
Definition at line 711 of file vpMatrix.cpp.
References vpArray2D< Type >::getRows(), and vpArray2D< Type >::resize().
std::ostream & vpMatrix::csvPrint | ( | std::ostream & | os | ) | const |
Print/save a matrix in csv format.
The following code
produces log.csv file that contains:
Definition at line 4374 of file vpMatrix.cpp.
References vpArray2D< double >::getCols(), and vpArray2D< double >::getRows().
Referenced by vpColVector::clear().
double vpMatrix::det | ( | vpDetMethod | method = LU_DECOMPOSITION | ) | const |
Compute the determinant of a n-by-n matrix.
method | : Method used to compute the determinant. Default LU decomposition method is faster than the method based on Gaussian elimination. |
Definition at line 4848 of file vpMatrix.cpp.
References detByLU(), and LU_DECOMPOSITION.
Referenced by vpTriangle::buildFrom(), vpHomography::computeDisplacement(), detByLU(), and vpTemplateTrackerTriangle::init().
double vpMatrix::detByLU | ( | ) | const |
Compute the determinant of a square matrix using the LU decomposition.
This function calls the first following function that is available:
If none of these previous 3rd parties is installed, we use by default detByLULapack() with a Lapack built-in version.
Definition at line 180 of file vpMatrix_lu.cpp.
References vpArray2D< double >::colNum, vpArray2D< Type >::data, vpArray2D< double >::data, det(), vpException::fatalError, vpArray2D< double >::getCols(), vpArray2D< double >::getRows(), and vpArray2D< double >::rowNum.
Referenced by det().
void vpMatrix::diag | ( | const double & | val = 1.0 | ) |
Set the matrix as a diagonal matrix where each element on the diagonal is set to val. Elements that are not on the diagonal are set to 0.
val | : Value to set. |
Matrix A is now equal to:
Definition at line 692 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, and vpArray2D< double >::rowNum.
Referenced by vpMbTracker::computeCovarianceMatrixVVS().
void vpMatrix::diag | ( | const vpColVector & | A | ) |
Create a diagonal matrix with the element of a vector.
A | : Vector which element will be put in the diagonal. |
Matrix A is now equal to:
Definition at line 652 of file vpMatrix.cpp.
References vpArray2D< Type >::getRows(), and vpArray2D< double >::resize().
vpColVector vpMatrix::eigenValues | ( | ) | const |
Compute the eigenvalues of a n-by-n real symmetric matrix.
vpException::dimensionError | If the matrix is not square. |
vpException::fatalError | If the matrix is not symmetric. |
vpException::functionNotImplementedError | If the GSL library is not detected. |
Here an example:
Definition at line 4566 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpException::dimensionError, vpException::fatalError, vpException::functionNotImplementedError, vpArray2D< double >::rowNum, and t().
void vpMatrix::eigenValues | ( | vpColVector & | evalue, |
vpMatrix & | evector | ||
) | const |
Compute the eigenvalues of a n-by-n real symmetric matrix.
evalue | : Eigenvalues of the matrix. |
evector | : Eigenvector of the matrix. |
vpException::dimensionError | If the matrix is not square. |
vpException::fatalError | If the matrix is not symmetric. |
vpException::functionNotImplementedError | If the GSL library is not detected. |
Here an example:
Definition at line 4677 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpException::dimensionError, vpException::fatalError, vpException::functionNotImplementedError, vpArray2D< Type >::resize(), vpArray2D< double >::rowNum, and t().
double vpMatrix::euclideanNorm | ( | ) | const |
Compute and return the Euclidean norm .
Definition at line 5038 of file vpMatrix.cpp.
References vpArray2D< double >::data, and vpArray2D< double >::dsize.
Referenced by vpColVector::deg2rad().
vpMatrix vpMatrix::expm | ( | ) | const |
Compute the exponential matrix of a square matrix.
Definition at line 4866 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::data, vpArray2D< Type >::data, vpException::dimensionError, eye(), vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), inverseByLU(), row(), vpArray2D< double >::rowNum, and sum().
Referenced by vpTemplateTrackerWarpHomographySL3::computeCoeff().
vpMatrix vpMatrix::extract | ( | unsigned int | r, |
unsigned int | c, | ||
unsigned int | nrows, | ||
unsigned int | ncols | ||
) | const |
Extract a sub matrix from a matrix M.
r | : row index in matrix M. |
c | : column index in matrix M. |
nrows | : Number of rows of the matrix that should be extracted. |
ncols | : Number of columns of the matrix that should be extracted. |
The following code shows how to use this function:
It produces the following output:
Definition at line 319 of file vpMatrix.cpp.
References vpException::dimensionError, vpArray2D< double >::getCols(), and vpArray2D< double >::getRows().
Referenced by vpVelocityTwistMatrix::~vpVelocityTwistMatrix().
void vpMatrix::eye | ( | ) |
Set an m-by-n matrix to identity with ones on the diagonal and zeros else where.
Definition at line 360 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, and vpArray2D< double >::rowNum.
Referenced by vpServo::computeControlLaw(), computeCovarianceMatrixVVS(), vpServo::computeProjectionOperators(), vpMbDepthDenseTracker::computeVVS(), vpMbDepthNormalTracker::computeVVS(), vpMbGenericTracker::computeVVS(), vpMbEdgeTracker::computeVVS(), vpMbEdgeMultiTracker::computeVVSFirstPhasePoseEstimation(), vpMbEdgeTracker::computeVVSFirstPhasePoseEstimation(), vpMbTracker::computeVVSPoseEstimation(), expm(), eye(), vpTemplateTrackerWarpHomographySL3::getdW0(), vpTemplateTrackerWarpHomographySL3::getdWdp0(), vpFeatureThetaU::interaction(), vpMeLine::leastSquare(), vpPose::poseFromRectangle(), vpMeEllipse::printParameters(), vpServo::setServo(), vpMbGenericTracker::track(), vpMbTracker::vpMbTracker(), vpRobotCamera::vpRobotCamera(), vpServo::vpServo(), vpSimulatorCamera::vpSimulatorCamera(), and vpVelocityTwistMatrix::~vpVelocityTwistMatrix().
void vpMatrix::eye | ( | unsigned int | n | ) |
Set an n-by-n matrix to identity with ones on the diagonal and zeros else where.
Definition at line 343 of file vpMatrix.cpp.
References eye().
void vpMatrix::eye | ( | unsigned int | m, |
unsigned int | n | ||
) |
Set an m-by-n matrix to identity with ones on the diagonal and zeros else where.
Definition at line 349 of file vpMatrix.cpp.
References eye(), and vpArray2D< double >::resize().
vpColVector vpMatrix::getCol | ( | const unsigned int | j | ) | const |
Extract a column vector from a matrix.
j | : Index of the column to extract. If j=0, the first column is extracted. |
The following example shows how to use this function:
It produces the following output:
Definition at line 3797 of file vpMatrix.cpp.
References vpException::dimensionError, vpArray2D< double >::getCols(), and vpArray2D< double >::getRows().
Referenced by vpHomography::DLT(), vpMbtFaceDepthNormal::estimatePlaneEquationSVD(), kernel(), vpPose::poseDementhonPlan(), vpPose::poseFromRectangle(), and vpServo::secondaryTaskJointLimitAvoidance().
vpColVector vpMatrix::getCol | ( | const unsigned int | j, |
const unsigned int | i_begin, | ||
const unsigned int | column_size | ||
) | const |
Extract a column vector from a matrix.
j | : Index of the column to extract. If col=0, the first column is extracted. |
i_begin | : Index of the row that gives the location of the first element of the column vector to extract. |
column_size | : Size of the column vector to extract. |
The following example shows how to use this function:
It produces the following output:
Definition at line 3748 of file vpMatrix.cpp.
References vpException::dimensionError, vpArray2D< double >::getCols(), and vpArray2D< double >::getRows().
|
inlineinherited |
Return the number of columns of the 2D array.
Definition at line 146 of file vpArray2D.h.
References vpArray2D< Type >::colNum, vpArray2D< Type >::getMaxValue(), and vpArray2D< Type >::getMinValue().
Referenced by vpRowVector::cppPrint(), cppPrint(), vpRowVector::csvPrint(), csvPrint(), detByLU(), extract(), vpRotationMatrix::getCol(), vpHomogeneousMatrix::getCol(), getCol(), getRow(), kernel(), vpRowVector::maplePrint(), maplePrint(), vpRowVector::matlabPrint(), matlabPrint(), vpRowVector::operator*(), vpRowVector::operator+(), vpRowVector::operator+=(), vpRowVector::operator-(), vpRowVector::operator-=(), vpForceTwistMatrix::print(), vpVelocityTwistMatrix::print(), vpRowVector::print(), print(), pseudoInverse(), and row().
|
inherited |
Return the array max value.
Definition at line 671 of file vpArray2D.h.
References vpArray2D< Type >::data, and vpArray2D< Type >::dsize.
|
inherited |
Return the array min value.
Definition at line 655 of file vpArray2D.h.
References vpArray2D< Type >::data, and vpArray2D< Type >::dsize.
vpRowVector vpMatrix::getRow | ( | const unsigned int | i | ) | const |
Extract a row vector from a matrix.
i | : Index of the row to extract. If i=0, the first row is extracted. |
The following example shows how to use this function:
It produces the following output:
Definition at line 3843 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< Type >::data, vpArray2D< double >::data, vpException::dimensionError, vpArray2D< double >::getRows(), and vpRowVector::resize().
vpRowVector vpMatrix::getRow | ( | const unsigned int | i, |
const unsigned int | j_begin, | ||
const unsigned int | row_size | ||
) | const |
Extract a row vector from a matrix.
i | : Index of the row to extract. If i=0, the first row is extracted. |
j_begin | : Index of the column that gives the location of the first element of the row vector to extract. |
row_size | : Size of the row vector to extract. |
The following example shows how to use this function:
It produces the following output:
Definition at line 3895 of file vpMatrix.cpp.
References vpException::dimensionError, vpArray2D< double >::getCols(), and vpArray2D< double >::getRows().
|
inlineinherited |
Return the number of rows of the 2D array.
Definition at line 156 of file vpArray2D.h.
References vpArray2D< Type >::rowNum.
Referenced by column(), vpColVector::cppPrint(), cppPrint(), vpColVector::csvPrint(), csvPrint(), detByLU(), extract(), vpRotationMatrix::getCol(), vpHomogeneousMatrix::getCol(), getCol(), getRow(), inverseByCholesky(), kernel(), vpColVector::maplePrint(), maplePrint(), vpColVector::matlabPrint(), matlabPrint(), vpColVector::operator+(), vpColVector::operator+=(), vpColVector::operator-(), vpColVector::operator-=(), vpForceTwistMatrix::print(), vpVelocityTwistMatrix::print(), vpPoseVector::print(), vpColVector::print(), print(), and pseudoInverse().
Compute the Hadamard product (element wise matrix multiplication).
m | : Second matrix; |
Definition at line 690 of file vpArray2D.h.
References vpArray2D< Type >::colNum, vpArray2D< Type >::data, vpException::dimensionError, vpArray2D< Type >::dsize, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< Type >::resize(), and vpArray2D< Type >::rowNum.
Compute the Hadamard product (element wise matrix multiplication).
m | : Second matrix; |
Definition at line 1512 of file vpMatrix.cpp.
References vpCPUFeatures::checkSSE2(), vpArray2D< double >::colNum, vpArray2D< double >::data, vpArray2D< Type >::data, vpException::dimensionError, vpArray2D< double >::dsize, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< Type >::resize(), and vpArray2D< double >::rowNum.
double vpMatrix::infinityNorm | ( | ) | const |
Compute and return the infinity norm with where is the matrix size.
Definition at line 5059 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
Referenced by vpColVector::extract().
void vpMatrix::init | ( | const vpMatrix & | M, |
unsigned int | r, | ||
unsigned int | c, | ||
unsigned int | nrows, | ||
unsigned int | ncols | ||
) |
Initialize the matrix from a part of an input matrix M.
M | : Input matrix used for initialization. |
r | : row index in matrix M. |
c | : column index in matrix M. |
nrows | : Number of rows of the matrix that should be initialized. |
ncols | : Number of columns of the matrix that should be initialized. |
The sub-matrix starting from M[r][c] element and ending on M[r+nrows-1][c+ncols-1] element is used to initialize the matrix.
The following code shows how to use this function:
It produces the following output:
Definition at line 258 of file vpMatrix.cpp.
References vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< double >::resize(), and vpArray2D< double >::rowPtrs.
|
inline |
Definition at line 673 of file vpMatrix.h.
Referenced by vpColVector::extract(), vpMatrix(), and vpSubMatrix::vpSubMatrix().
void vpMatrix::insert | ( | const vpMatrix & | A, |
const unsigned int | r, | ||
const unsigned int | c | ||
) |
Insert matrix A at the given position in the current matrix.
A | : The matrix to insert. |
r | : The index of the row to begin to insert data. |
c | : The index of the column to begin to insert data. |
Definition at line 4512 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< Type >::colNum, vpArray2D< double >::data, vpArray2D< Type >::data, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< double >::rowNum, and vpArray2D< Type >::size().
Referenced by vpMbEdgeKltTracker::computeVVS(), vpMbEdgeMultiTracker::computeVVS(), vpMbDepthDenseTracker::computeVVSInteractionMatrixAndResidu(), vpMbDepthNormalTracker::computeVVSInteractionMatrixAndResidu(), vpMbGenericTracker::computeVVSInteractionMatrixAndResidu(), vpMbKltMultiTracker::computeVVSInteractionMatrixAndResidu(), vpMbEdgeMultiTracker::computeVVSInteractionMatrixAndResidu(), vpMbEdgeKltMultiTracker::computeVVSInteractionMatrixAndResidu(), vpNurbs::curveKnotIns(), vpColVector::extract(), insert(), juxtaposeMatrices(), kernel(), pseudoInverse(), stack(), vpColVector::stackMatrices(), and vpMbGenericTracker::track().
|
static |
Insert matrix B in matrix A at the given position.
A | : Main matrix. |
B | : Matrix to insert. |
r | : Index of the row where to add the matrix. |
c | : Index of the column where to add the matrix. |
Definition at line 4046 of file vpMatrix.cpp.
References insert().
|
static |
Insert matrix B in matrix A at the given position.
A | : Main matrix. |
B | : Matrix to insert. |
C | : Result matrix. |
r | : Index of the row where to insert matrix B. |
c | : Index of the column where to insert matrix B. |
Definition at line 4068 of file vpMatrix.cpp.
References vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), and vpArray2D< Type >::resize().
vpMatrix vpMatrix::inverseByCholesky | ( | ) | const |
Compute the inverse of a n-by-n matrix using the Cholesky decomposition. The matrix must be real symmetric positive defined.
This function calls the first following function that is available:
If none of these 3rd parties is installed we use a Lapack built-in version.
Here an example:
Definition at line 105 of file vpMatrix_cholesky.cpp.
References vpException::badValue, vpArray2D< double >::colNum, vpArray2D< double >::data, vpArray2D< Type >::data, vpException::fatalError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< double >::getRows(), vpMatrixException::matrixError, and vpArray2D< double >::rowNum.
vpMatrix vpMatrix::inverseByLU | ( | ) | const |
Compute the inverse of a n-by-n matrix using the LU decomposition.
This function calls the first following function that is available:
If none of these previous 3rd parties is installed, we use by default inverseByLULapack() with a Lapack built-in version.
Here an example:
Definition at line 130 of file vpMatrix_lu.cpp.
References vpException::fatalError.
Referenced by vpTriangle::buildFrom(), expm(), vpKalmanFilter::filtering(), vpTemplateTrackerWarpHomographySL3::findWarp(), vpTemplateTrackerWarpAffine::getParamInverse(), vpTemplateTrackerTriangle::init(), vpTemplateTrackerSSDInverseCompositional::initCompInverse(), vpTemplateTrackerZNCCForwardAdditional::initHessienDesired(), vpTemplateTrackerMIForwardCompositional::initHessienDesired(), vpTemplateTrackerZNCCInverseCompositional::initHessienDesired(), vpTemplateTrackerMIESM::initHessienDesired(), vpTemplateTrackerMIForwardAdditional::initHessienDesired(), vpTemplateTrackerMIInverseCompositional::initHessienDesired(), vpTemplateTracker::setHDes(), vpTemplateTrackerSSDForwardCompositional::trackNoPyr(), vpTemplateTrackerMIForwardCompositional::trackNoPyr(), vpTemplateTrackerSSDForwardAdditional::trackNoPyr(), vpTemplateTrackerMIESM::trackNoPyr(), vpTemplateTrackerMIForwardAdditional::trackNoPyr(), vpTemplateTrackerMIInverseCompositional::trackNoPyr(), and vpTemplateTrackerWarp::warp().
vpMatrix vpMatrix::inverseByQR | ( | ) | const |
Compute the inverse of a n-by-n matrix using the QR decomposition. Only available if Lapack 3rd party is installed. If Lapack is not installed we use a Lapack built-in version.
Here an example:
Definition at line 271 of file vpMatrix_qr.cpp.
References vpException::fatalError.
Juxtapose to matrices C = [ A B ].
A | : Left matrix. |
B | : Right matrix. |
Definition at line 4099 of file vpMatrix.cpp.
Juxtapose to matrices C = [ A B ].
A | : Left matrix. |
B | : Right matrix. |
C | : Juxtaposed matrix C = [ A B ] |
Definition at line 4120 of file vpMatrix.cpp.
References vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), insert(), and vpArray2D< Type >::resize().
unsigned int vpMatrix::kernel | ( | vpMatrix & | kerAt, |
double | svThreshold = 1e-6 |
||
) | const |
Function to compute the null space (the kernel) of a m-by-n matrix .
The null space of a matrix is defined as .
kerAt | The matrix that contains the null space (kernel) of defined by the matrix . If matrix is full rank, the dimension of kerAt is (0, n), otherwise the dimension is (n-r, n). This matrix is thus the transpose of . |
svThreshold | Threshold used to test the singular values. If a singular value is lower than this threshold we consider that the matrix is not full rank. |
Definition at line 4763 of file vpMatrix.cpp.
References getCol(), vpArray2D< double >::getCols(), vpArray2D< double >::getRows(), vpArray2D< Type >::getRows(), insert(), vpArray2D< Type >::resize(), vpColVector::sumSquare(), and svd().
Compute Kronecker product matrix.
m | : vpMatrix. |
out | : If m1.kron(m2) out contains the kronecker product's result : . |
Definition at line 1578 of file vpMatrix.cpp.
Referenced by kron().
Compute Kronecker product matrix.
m | : vpMatrix; |
Definition at line 1616 of file vpMatrix.cpp.
References kron().
Compute Kronecker product matrix.
Definition at line 1545 of file vpMatrix.cpp.
References vpArray2D< Type >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< Type >::rowNum, and vpERROR_TRACE.
Compute Kronecker product matrix.
Definition at line 1586 of file vpMatrix.cpp.
References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().
|
inlinestaticinherited |
Load a matrix from a file.
filename | : Absolute file name. |
A | : Array to be loaded |
binary | : If true the matrix is loaded from a binary file, else from a text file. |
header | : Header of the file is loaded in this parameter. |
Definition at line 318 of file vpArray2D.h.
References vpException::badValue, and vpArray2D< Type >::resize().
|
inlinestatic |
Load a matrix from a file. This function overloads vpArray2D::load().
filename | : absolute file name. |
M | : matrix to be loaded. |
binary | :If true the matrix is loaded from a binary file, else from a text file. |
header | : Header of the file is loaded in this parameter |
Definition at line 605 of file vpMatrix.h.
References vpArray2D< Type >::load().
Referenced by vpDot2::defineDots().
|
inlinestatic |
Load a matrix from a YAML-formatted file. This function overloads vpArray2D::loadYAML().
filename | : absolute file name. |
M | : matrix to be loaded from the file. |
header | : Header of the file is loaded in this parameter. |
Definition at line 621 of file vpMatrix.h.
References vpArray2D< Type >::loadYAML().
|
inlinestaticinherited |
Load an array from a YAML-formatted file.
filename | : absolute file name. |
A | : array to be loaded from the file. |
header | : header of the file is loaded in this parameter. |
Definition at line 426 of file vpArray2D.h.
References vpArray2D< Type >::resize().
std::ostream & vpMatrix::maplePrint | ( | std::ostream & | os | ) | const |
Print using Maple syntax, to copy/paste in Maple later.
The following code
produces this output:
that could be copy/paste in Maple.
Definition at line 4333 of file vpMatrix.cpp.
References vpArray2D< double >::getCols(), and vpArray2D< double >::getRows().
Referenced by vpColVector::extract().
std::ostream & vpMatrix::matlabPrint | ( | std::ostream & | os | ) | const |
Print using Matlab syntax, to copy/paste in Matlab later.
The following code
produces this output:
that could be copy/paste in Matlab:
Definition at line 4289 of file vpMatrix.cpp.
References vpArray2D< double >::getCols(), and vpArray2D< double >::getRows().
Referenced by vpColVector::extract().
Operation C = A * B.
The result is placed in the third parameter C and not returned. A new matrix won't be allocated for every use of the function (speed gain if used many times with the same result matrix size).
Definition at line 805 of file vpMatrix.cpp.
References vpArray2D< Type >::colNum, vpArray2D< Type >::data, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< Type >::resize(), vpArray2D< Type >::rowNum, and vpArray2D< Type >::rowPtrs.
Referenced by operator*().
|
static |
Operation C = A * B.
The result is placed in the third parameter C and not returned. A new matrix won't be allocated for every use of the function (speed gain if used many times with the same result matrix size).
vpException::dimensionError | If matrices are not 3-by-3 dimension. |
Definition at line 854 of file vpMatrix.cpp.
References vpArray2D< Type >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< Type >::rowNum, and vpArray2D< Type >::rowPtrs.
|
static |
Operation C = A * B.
The result is placed in the third parameter C and not returned. A new matrix won't be allocated for every use of the function (speed gain if used many times with the same result matrix size).
vpException::dimensionError | If matrices are not 4-by-4 dimension. |
Definition at line 893 of file vpMatrix.cpp.
References vpArray2D< Type >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< Type >::rowNum, and vpArray2D< Type >::rowPtrs.
|
static |
Operation C = A * B.
The result is placed in the third parameter C and not returned. A new matrix won't be allocated for every use of the function (speed gain if used many times with the same result matrix size).
Definition at line 931 of file vpMatrix.cpp.
References multMatrixVector().
|
static |
Operation w = A * v (v and w are vectors).
A new matrix won't be allocated for every use of the function (Speed gain if used many times with the same result matrix size).
Definition at line 764 of file vpMatrix.cpp.
References vpArray2D< Type >::colNum, vpArray2D< Type >::data, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpColVector::resize(), vpArray2D< Type >::rowNum, and vpArray2D< Type >::rowPtrs.
Referenced by mult2Matrices(), and operator*().
Operation C = -A.
The result is placed in the second parameter C and not returned. A new matrix won't be allocated for every use of the function (Speed gain if used many times with the same result matrix size).
Definition at line 1300 of file vpMatrix.cpp.
References vpArray2D< Type >::colNum, vpArray2D< Type >::resize(), vpArray2D< Type >::rowNum, and vpArray2D< Type >::rowPtrs.
Referenced by operator-().
Operation C = A * B (A is unchanged).
Definition at line 940 of file vpMatrix.cpp.
References mult2Matrices().
Referenced by vpColVector::operator[](), vpColVector::stackMatrices(), and vpVelocityTwistMatrix::~vpVelocityTwistMatrix().
vpMatrix vpMatrix::operator* | ( | const vpRotationMatrix & | R | ) | const |
Operator that allow to multiply a matrix by a rotation matrix. The matrix should be of dimension m-by-3.
Definition at line 953 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
vpMatrix vpMatrix::operator* | ( | const vpVelocityTwistMatrix & | V | ) | const |
Operator that allow to multiply a matrix by a velocity twist matrix. The matrix should be of dimension m-by-6.
Definition at line 980 of file vpMatrix.cpp.
References vpCPUFeatures::checkSSE2(), vpArray2D< double >::colNum, vpArray2D< Type >::colNum, vpArray2D< double >::data, vpArray2D< Type >::data, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< Type >::resize(), vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
vpMatrix vpMatrix::operator* | ( | const vpForceTwistMatrix & | V | ) | const |
Operator that allow to multiply a matrix by a force/torque twist matrix. The matrix should be of dimension m-by-6.
Definition at line 1049 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
vpTranslationVector vpMatrix::operator* | ( | const vpTranslationVector & | tv | ) | const |
Operator that allows to multiply a matrix by a translation vector. The matrix should be of dimension (3x3)
Definition at line 724 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
vpColVector vpMatrix::operator* | ( | const vpColVector & | v | ) | const |
Operation w = A * v (matrix A is unchanged, v and w are column vectors).
Definition at line 749 of file vpMatrix.cpp.
References multMatrixVector().
vpMatrix vpMatrix::operator* | ( | const double | x | ) | const |
Operator that allows to multiply all the elements of a matrix by a scalar.
Definition at line 1367 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
vpMatrix & vpMatrix::operator*= | ( | const double | x | ) |
Multiply all the element of the matrix by x : Aij = Aij * x.
Operator that allows to multiply all the elements of a matrix by a scalar.
Definition at line 1423 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
Referenced by vpColVector::operator[]().
Operation C = A + B (A is unchanged).
Definition at line 1170 of file vpMatrix.cpp.
References add2Matrices().
Referenced by vpColVector::operator[]().
Operation A = A + B.
Definition at line 1259 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< double >::rowNum, vpArray2D< Type >::rowPtrs, and vpArray2D< double >::rowPtrs.
Referenced by vpColVector::operator[]().
vpMatrix & vpMatrix::operator+= | ( | const double | x | ) |
Add x to all the element of the matrix : Aij = Aij + x.
Definition at line 1400 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
Operation C = A - B (A is unchanged).
Definition at line 1250 of file vpMatrix.cpp.
References sub2Matrices().
vpMatrix vpMatrix::operator- | ( | void | ) | const |
Operation C = -A (A is unchanged).
Definition at line 1318 of file vpMatrix.cpp.
References negateMatrix().
Referenced by vpColVector::operator[]().
Operation A = A - B.
Definition at line 1276 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< double >::rowNum, vpArray2D< Type >::rowPtrs, and vpArray2D< double >::rowPtrs.
Referenced by vpColVector::operator[]().
vpMatrix & vpMatrix::operator-= | ( | const double | x | ) |
Substract x to all the element of the matrix : Aij = Aij - x.
Definition at line 1410 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
vpMatrix vpMatrix::operator/ | ( | const double | x | ) | const |
Cij = Aij / x (A is unchanged)
Definition at line 1379 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpException::divideByZeroError, vpArray2D< Type >::resize(), vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
Referenced by vpColVector::operator[]().
vpMatrix & vpMatrix::operator/= | ( | double | x | ) |
Divide all the element of the matrix by x : Aij = Aij / x.
Definition at line 1433 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpException::divideByZeroError, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
Referenced by vpColVector::operator[]().
vpMatrix & vpMatrix::operator<< | ( | double * | x | ) |
Assigment from an array of double. This method has to be used carefully since the array allocated behind x pointer should have the same dimension than the matrix.
Definition at line 606 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
Copy operator that allows to convert on of the following container that inherit from vpArray2D such as vpMatrix, vpRotationMatrix, vpHomogeneousMatrix, vpPoseVector, vpColVector, vpRowVector... into a vpMatrix.
A | : 2D array to be copied. |
The following example shows how to create a matrix from an homogeneous matrix:
Definition at line 549 of file vpMatrix.cpp.
References vpArray2D< double >::data, vpArray2D< Type >::data, vpArray2D< double >::dsize, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), and vpArray2D< double >::resize().
Definition at line 559 of file vpMatrix.cpp.
References vpArray2D< double >::data, vpArray2D< Type >::data, vpArray2D< double >::dsize, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), and vpArray2D< double >::resize().
Definition at line 568 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::data, vpArray2D< double >::dsize, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
vpMatrix & vpMatrix::operator= | ( | const double | x | ) |
Set all the element of the matrix A to x.
Definition at line 592 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
|
inlineinherited |
Set element using A[i][j] = x.
Definition at line 264 of file vpArray2D.h.
|
inlineinherited |
Get element using x = A[i][j].
Definition at line 266 of file vpArray2D.h.
int vpMatrix::print | ( | std::ostream & | s, |
unsigned int | length, | ||
char const * | intro = 0 |
||
) | const |
Pretty print a matrix. The data are tabulated. The common widths before and after the decimal point are set with respect to the parameter maxlen.
s | Stream used for the printing. |
length | The suggested width of each matrix element. The actual width grows in order to accomodate the whole integral part, and shrinks if the whole extent is not needed for all the numbers. |
intro | The introduction which is printed before the matrix. Can be set to zero (or omitted), in which case the introduction is not printed. |
Definition at line 4166 of file vpMatrix.cpp.
References vpArray2D< double >::getCols(), vpArray2D< double >::getRows(), and vpMath::maximum().
Referenced by vpServo::computeControlLaw(), vpColVector::operator[](), and vpVelocityTwistMatrix::~vpVelocityTwistMatrix().
|
inline |
Definition at line 498 of file vpMatrix.h.
References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().
vpMatrix vpMatrix::pseudoInverse | ( | double | svThreshold = 1e-6 | ) | const |
Compute and return the Moore-Penros pseudo inverse of a m-by-n matrix .
svThreshold | : Threshold used to test the singular values. If a singular value is lower than this threshold we consider that the matrix is not full rank. |
Here an example to compute the pseudo-inverse of a 2-by-3 matrix.
Once build, the previous example produces the following output:
Definition at line 1931 of file vpMatrix.cpp.
References vpException::fatalError, vpArray2D< double >::getCols(), vpArray2D< double >::getRows(), insert(), vpArray2D< Type >::resize(), vpColVector::resize(), vpArray2D< Type >::size(), and t().
Referenced by vpCalibration::calibrationTsai(), vpSimulatorAfma6::computeArticularVelocity(), vpSimulatorViper850::computeArticularVelocity(), vpServo::computeControlLaw(), computeCovarianceMatrix(), computeCovarianceMatrixVVS(), vpPoseFeatures::computePose(), vpMbEdgeMultiTracker::computeVVSFirstPhasePoseEstimation(), vpMbEdgeTracker::computeVVSFirstPhasePoseEstimation(), vpMbTracker::computeVVSPoseEstimation(), vpNurbs::globalCurveApprox(), vpNurbs::globalCurveInterp(), vpMeEllipse::initTracking(), vpHomography::inverse(), vpMeLine::leastSquare(), vpPose::poseDementhonNonPlan(), vpPose::poseFromRectangle(), vpPose::poseVirtualVS(), vpMeEllipse::printParameters(), pseudoInverse(), vpHomography::robust(), and solveBySVD().
unsigned int vpMatrix::pseudoInverse | ( | vpMatrix & | Ap, |
double | svThreshold = 1e-6 |
||
) | const |
Compute the Moore-Penros pseudo inverse of a m-by-n matrix and return the rank r of the matrix.
Ap | : The Moore-Penros pseudo inverse . |
svThreshold | : Threshold used to test the singular values. If a singular value is lower than this threshold we consider that the matrix is not full rank. |
Here an example to compute the pseudo-inverse of a 2-by-3 matrix.
Once build, the previous example produces the following output:
Definition at line 1862 of file vpMatrix.cpp.
References vpException::fatalError.
unsigned int vpMatrix::pseudoInverse | ( | vpMatrix & | Ap, |
vpColVector & | sv, | ||
double | svThreshold = 1e-6 |
||
) | const |
Compute the Moore-Penros pseudo inverse of a m-by-n matrix along with singular values and return the rank r of the matrix.
Ap | : The Moore-Penros pseudo inverse . |
sv | Vector corresponding to matrix singular values. The size of this vector is equal to min(m, n). |
svThreshold | : Threshold used to test the singular values. If a singular value is lower than this threshold we consider that the matrix is not full rank. |
Here an example to compute the pseudo-inverse of a 2-by-3 matrix.
Once build, the previous example produces the following output:
Definition at line 3449 of file vpMatrix.cpp.
References vpException::fatalError.
unsigned int vpMatrix::pseudoInverse | ( | vpMatrix & | Ap, |
vpColVector & | sv, | ||
double | svThreshold, | ||
vpMatrix & | imA, | ||
vpMatrix & | imAt | ||
) | const |
Compute the Moore-Penros pseudo inverse of a m-by-n matrix along with singular values, and and return the rank r of the matrix.
See pseudoInverse(vpMatrix &, vpColVector &, double, vpMatrix &, vpMatrix &, vpMatrix &) const for a complete description of this function.
Ap | : The Moore-Penros pseudo inverse . |
sv | Vector corresponding to matrix singular values. The size of this vector is equal to min(m, n). |
svThreshold | : Threshold used to test the singular values. If a singular value is lower than this threshold we consider that the matrix is not full rank. |
imA | that is a m-by-r matrix. |
imAt | that is n-by-r matrix. |
Here an example to compute the pseudo-inverse of a 2-by-3 matrix.
Once build, the previous example produces the following output:
Definition at line 3543 of file vpMatrix.cpp.
References pseudoInverse().
unsigned int vpMatrix::pseudoInverse | ( | vpMatrix & | Ap, |
vpColVector & | sv, | ||
double | svThreshold, | ||
vpMatrix & | imA, | ||
vpMatrix & | imAt, | ||
vpMatrix & | kerAt | ||
) | const |
Compute the Moore-Penros pseudo inverse of a m-by-n matrix along with singular values, , and and return the rank r of the matrix.
Using singular value decomposition, we have:
where the diagonal of corresponds to the matrix singular values.
This equation could be reformulated in a minimal way:
where the diagonal of corresponds to the matrix first r singular values.
The null space of a matrix is defined as .
Ap | The Moore-Penros pseudo inverse . |
sv | Vector corresponding to matrix singular values. The size of this vector is equal to min(m, n). |
svThreshold | Threshold used to test the singular values. If a singular value is lower than this threshold we consider that the matrix is not full rank. |
imA | that is a m-by-r matrix. |
imAt | that is n-by-r matrix. |
kerAt | The matrix that contains the null space (kernel) of defined by the matrix . If matrix is full rank, the dimension of kerAt is (0, n), otherwise the dimension is (n-r, n). This matrix is thus the transpose of . |
Here an example to compute the pseudo-inverse of a 2-by-3 matrix.
Once build, the previous example produces the following output:
Definition at line 3684 of file vpMatrix.cpp.
References vpException::fatalError.
|
inlineinherited |
Set the size of the array and initialize all the values to zero.
nrows | : number of rows. |
ncols | : number of column. |
flagNullify | : if true, then the array is re-initialized to 0 after resize. If false, the initial values from the common part of the array (common part between old and new version of the array) are kept. Default value is true. |
recopy_ | : if true, will perform an explicit recopy of the old data if needed and if flagNullify is set to false. |
Definition at line 171 of file vpArray2D.h.
References vpArray2D< Type >::colNum, vpArray2D< Type >::dsize, vpException::memoryAllocationError, vpArray2D< Type >::rowNum, and vpArray2D< Type >::rowPtrs.
Referenced by diag(), eye(), init(), operator=(), and stack().
vpRowVector vpMatrix::row | ( | const unsigned int | i | ) |
Return the i-th row of the matrix.
Definition at line 5116 of file vpMatrix.cpp.
References vpArray2D< double >::getCols().
Referenced by expm().
|
inlinestaticinherited |
Save a matrix to a file.
filename | : Absolute file name. |
A | : Array to be saved. |
binary | : If true the matrix is saved in a binary file, else a text file. |
header | : Optional line that will be saved at the beginning of the file. |
Warning : If you save the matrix as in a text file the precision is less than if you save it in a binary file.
Definition at line 508 of file vpArray2D.h.
References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().
|
inlinestatic |
Save a matrix to a file. This function overloads vpArray2D::load().
filename | : absolute file name. |
M | : matrix to be saved. |
binary | : If true the matrix is save in a binary file, else a text file. |
header | : optional line that will be saved at the beginning of the file. |
Warning : If you save the matrix as in a text file the precision is less than if you save it in a binary file.
Definition at line 640 of file vpMatrix.h.
References vpArray2D< Type >::save().
Referenced by vpDot2::defineDots().
|
inlinestatic |
Save a matrix in a YAML-formatted file. This function overloads vpArray2D::saveYAML().
filename | : absolute file name. |
M | : matrix to be saved in the file. |
header | : optional lines that will be saved at the beginning of the file. Should be YAML-formatted and will adapt to the indentation if any. |
Definition at line 658 of file vpMatrix.h.
References vpArray2D< Type >::saveYAML().
|
inlinestaticinherited |
Save an array in a YAML-formatted file.
filename | : absolute file name. |
A | : array to be saved in the file. |
header | : optional lines that will be saved at the beginning of the file. Should be YAML-formatted and will adapt to the indentation if any. |
Here is an example of outputs.
Content of matrix.yml:
Content of matrixIndent.yml:
Definition at line 597 of file vpArray2D.h.
References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().
void vpMatrix::setIdentity | ( | const double & | val = 1.0 | ) |
Set the matrix diagonal elements to val. More generally set M[i][i] = val.
Definition at line 5147 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, and vpArray2D< double >::rowNum.
Referenced by vpVelocityTwistMatrix::init(), vpColVector::rows(), and vpServo::secondaryTask().
|
inlineinherited |
Return the number of elements of the 2D array.
Definition at line 158 of file vpArray2D.h.
References vpArray2D< Type >::rowNum.
Referenced by vpRowVector::insert(), vpColVector::insert(), vpColVector::operator*(), and stack().
void vpMatrix::solveBySVD | ( | const vpColVector & | b, |
vpColVector & | x | ||
) | const |
Solve a linear system using Singular Value Decomposition (SVD).
Non destructive wrt. A and B.
b | : Vector . |
x | : Vector . |
Here an example:
Definition at line 1668 of file vpMatrix.cpp.
References pseudoInverse().
Referenced by solveBySVD().
vpColVector vpMatrix::solveBySVD | ( | const vpColVector & | B | ) | const |
Solve a linear system using Singular Value Decomposition (SVD).
Non destructive wrt. A and B.
B | : Vector . |
Here an example:
Definition at line 1719 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, and solveBySVD().
void vpMatrix::stack | ( | const vpMatrix & | A | ) |
Stack A at the end of the current matrix, or copy if the matrix has no dimensions : this = [ this A ]^T.
Definition at line 4447 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), insert(), vpArray2D< double >::resize(), and vpArray2D< double >::rowNum.
Referenced by vpPoseFeatures::addFeatureSegment(), vpCalibration::calibrationTsai(), vpColVector::cross(), vpFeatureVanishingPoint::interaction(), vpFeatureEllipse::interaction(), vpFeatureSegment::interaction(), vpGenericFeature::interaction(), vpFeaturePoint::interaction(), vpFeatureMoment::interaction(), vpFeatureLine::interaction(), vpFeaturePoint3D::interaction(), vpFeatureThetaU::interaction(), vpFeaturePointPolar::interaction(), vpFeatureTranslation::interaction(), vpColVector::resize(), stack(), vpColVector::stackMatrices(), and stackMatrices().
void vpMatrix::stack | ( | const vpRowVector & | r | ) |
Stack row vector r at the end of the current matrix, or copy if the matrix has no dimensions : this = [ this r ]^T.
Here an example for a robot velocity log :
Definition at line 4478 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::data, vpArray2D< Type >::data, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< double >::resize(), vpArray2D< double >::rowNum, vpArray2D< double >::size(), and vpArray2D< Type >::size().
Stack matrix B to the end of matrix A and return the resulting matrix [ A B ]^T
A | : Upper matrix. |
B | : Lower matrix. |
Definition at line 3915 of file vpMatrix.cpp.
References stack().
|
static |
Stack row vector r to matrix A and return the resulting matrix [ A r ]^T
A | : Upper matrix. |
r | : Lower matrix. |
Definition at line 3934 of file vpMatrix.cpp.
References stack().
Stack matrix B to the end of matrix A and return the resulting matrix in C.
A | : Upper matrix. |
B | : Lower matrix. |
C | : Stacked matrix C = [ A B ]^T |
Definition at line 3954 of file vpMatrix.cpp.
References vpArray2D< Type >::data, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< Type >::resize(), and vpArray2D< Type >::size().
|
static |
Stack row vector v to the end of matrix A and return the resulting matrix in C.
A | : Upper matrix. |
r | : Lower row vector. |
C | : Stacked matrix C = [ A r ]^T |
Definition at line 4000 of file vpMatrix.cpp.
References vpArray2D< Type >::data, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< Type >::resize(), and vpArray2D< Type >::size().
void vpMatrix::stackColumns | ( | vpColVector & | out | ) |
Stacks columns of a matrix in a vector.
out | : a vpColVector. |
Definition at line 1456 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< Type >::colNum, vpArray2D< Type >::data, vpColVector::resize(), vpArray2D< Type >::rowNum, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
vpColVector vpMatrix::stackColumns | ( | ) |
Stacks columns of a matrix in a vector.
Definition at line 1473 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, and vpArray2D< double >::rowNum.
|
inline |
Definition at line 678 of file vpMatrix.h.
|
inlinestatic |
Definition at line 683 of file vpMatrix.h.
|
inlinestatic |
Definition at line 688 of file vpMatrix.h.
References operator*().
|
static |
Definition at line 5106 of file vpMatrix.cpp.
References stack().
|
static |
Definition at line 5108 of file vpMatrix.cpp.
References stack().
|
static |
Definition at line 5096 of file vpMatrix.cpp.
References vpColVector::stack().
|
static |
Definition at line 5101 of file vpMatrix.cpp.
References vpColVector::stack().
void vpMatrix::stackRows | ( | vpRowVector & | out | ) |
Stacks rows of a matrix in a vector
out | : a vpRowVector. |
Definition at line 1484 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::data, vpArray2D< Type >::data, vpArray2D< double >::dsize, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpRowVector::resize(), and vpArray2D< double >::rowNum.
vpRowVector vpMatrix::stackRows | ( | ) |
Stacks rows of a matrix in a vector.
Definition at line 1499 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, and vpArray2D< double >::rowNum.
Operation C = A - B.
The result is placed in the third parameter C and not returned. A new matrix won't be allocated for every use of the function (speed gain if used many times with the same result matrix size).
vpException::dimensionError | If A and B matrices have not the same size. |
Definition at line 1225 of file vpMatrix.cpp.
References vpArray2D< Type >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpArray2D< Type >::resize(), vpArray2D< Type >::rowNum, and vpArray2D< Type >::rowPtrs.
Referenced by operator-().
|
static |
Operation C = A - B on column vectors.
The result is placed in the third parameter C and not returned. A new vector won't be allocated for every use of the function (speed gain if used many times with the same result matrix size).
vpException::dimensionError | If A and B vectors have not the same size. |
Definition at line 1192 of file vpMatrix.cpp.
References vpArray2D< Type >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), vpColVector::resize(), vpArray2D< Type >::rowNum, and vpArray2D< Type >::rowPtrs.
double vpMatrix::sum | ( | ) | const |
Return the sum of all the elements of the matrix.
Definition at line 1325 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
Referenced by expm(), and vpColVector::resize().
double vpMatrix::sumSquare | ( | ) | const |
Return the sum square of all the elements of the matrix .
Definition at line 5080 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
Referenced by vpColVector::resize().
void vpMatrix::svd | ( | vpColVector & | w, |
vpMatrix & | V | ||
) |
Matrix singular value decomposition (SVD).
This function calls the first following function that is available:
If none of these previous 3rd parties is installed, we use by default svdLapack() with a Lapack built-in version.
Given matrix , this function computes it singular value decomposition such as
w | : Vector of singular values: . |
V | : Matrix . |
Here an example of SVD decomposition of a non square Matrix M.
Definition at line 1791 of file vpMatrix.cpp.
References vpException::fatalError.
Referenced by vpHomography::computeDisplacement(), cond(), vpHomography::DLT(), vpMbtFaceDepthNormal::estimatePlaneEquationSVD(), kernel(), and vpPose::poseDementhonPlan().
vpMatrix vpMatrix::t | ( | ) | const |
Compute and return the transpose of the matrix.
Definition at line 375 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< Type >::resize(), and vpArray2D< double >::rowNum.
Referenced by vpCalibration::calibrationTsai(), vpServo::computeControlLaw(), computeCovarianceMatrix(), vpTemplateTracker::computeOptimalBrentGain(), eigenValues(), vpMbtFaceDepthNormal::estimatePlaneEquationSVD(), vpKalmanFilter::filtering(), vpTemplateTrackerWarpHomographySL3::findWarp(), vpPose::poseDementhonNonPlan(), vpPose::poseDementhonPlan(), vpKalmanFilter::prediction(), pseudoInverse(), vpColVector::resize(), vpColVector::vpColVector(), vpTemplateTrackerWarp::warp(), and vpVelocityTwistMatrix::~vpVelocityTwistMatrix().
vpMatrix vpMatrix::transpose | ( | ) | const |
Compute and return the transpose of the matrix.
Definition at line 394 of file vpMatrix.cpp.
Referenced by vpServo::computeProjectionOperators(), vpTemplateTrackerWarpRT::getParamInverse(), vpTemplateTrackerWarpSRT::getParamInverse(), and vpColVector::resize().
void vpMatrix::transpose | ( | vpMatrix & | At | ) | const |
Compute At the transpose of the matrix.
At | (output) : Resulting transpose matrix. |
Definition at line 406 of file vpMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< Type >::resize(), vpArray2D< double >::rowNum, vpArray2D< Type >::rowPtrs, and vpArray2D< double >::rowPtrs.
Allow to multiply a scalar by a matrix.
Definition at line 1349 of file vpMatrix.cpp.
References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().
|
related |
This function performs generalized matrix multiplication: D = alpha*op(A)*op(B) + beta*op(C), where op(X) is X or X^T. Operation on A, B and C matrices is described by enumeration vpGEMMmethod().
For example, to compute D = alpha*A^T*B^T+beta*C we need to call :
If C is not used, vpGEMM must be called using an empty array null. Thus to compute D = alpha*A^T*B, we have to call:
vpException::incorrectMatrixSizeError | if the sizes of the matrices do not allow the operations. |
A | : An array that could be a vpMatrix. |
B | : An array that could be a vpMatrix. |
alpha | : A scalar. |
C | : An array that could be a vpMatrix. |
beta | : A scalar. |
D | : The resulting array that could be a vpMatrix. |
ops | : A scalar describing operation applied on the matrices. Possible values are the one defined in vpGEMMmethod(): VP_GEMM_A_T, VP_GEMM_B_T, VP_GEMM_C_T. |
Definition at line 393 of file vpGEMM.h.
References vpException::functionNotImplementedError.
|
related |
Enumeration of the operations applied on matrices in vpGEMM() function.
Operations are :
|
protectedinherited |
Number of columns in the array.
Definition at line 76 of file vpArray2D.h.
Referenced by AAt(), AtA(), vpColVector::clear(), detByLU(), diag(), eigenValues(), expm(), eye(), getRow(), vpColVector::hadamard(), hadamard(), infinityNorm(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpRowVector::insert(), insert(), inverseByCholesky(), vpRotationMatrix::operator*(), vpRowVector::operator*(), operator*(), vpRotationMatrix::operator*=(), vpRowVector::operator*=(), operator*=(), vpRowVector::operator+(), vpRowVector::operator+=(), operator+=(), vpRowVector::operator-(), vpRowVector::operator-=(), operator-=(), vpRowVector::operator/(), operator/(), vpRowVector::operator/=(), operator/=(), operator<<(), vpColVector::operator<<(), vpSubRowVector::operator=(), vpSubMatrix::operator=(), vpRowVector::operator=(), vpColVector::operator=(), operator=(), vpRowVector::reshape(), setIdentity(), solveBySVD(), stack(), vpRowVector::stack(), stackColumns(), stackRows(), vpRowVector::sum(), sum(), vpRowVector::sumSquare(), sumSquare(), vpRowVector::t(), t(), transpose(), vpColVector::vpColVector(), and vpMatrix().
|
inherited |
Address of the first element of the data array.
Definition at line 84 of file vpArray2D.h.
Referenced by AtA(), vpHomogeneousMatrix::buildFrom(), vpThetaUVector::buildFrom(), vpRzyzVector::buildFrom(), vpRxyzVector::buildFrom(), vpRzyxVector::buildFrom(), vpSubColVector::checkParentStatus(), vpSubRowVector::checkParentStatus(), vpSubMatrix::checkParentStatus(), vpColVector::clear(), vpHomogeneousMatrix::convert(), detByLU(), vpTranslationVector::euclideanNorm(), vpRowVector::euclideanNorm(), euclideanNorm(), expm(), vpThetaUVector::extract(), getRow(), vpThetaUVector::getTheta(), vpThetaUVector::getU(), vpColVector::hadamard(), hadamard(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpColVector::insert(), insert(), inverseByCholesky(), vpTranslationVector::operator*(), vpRowVector::operator*(), vpColVector::operator*(), vpHomography::operator*(), operator*(), vpTranslationVector::operator-(), vpRowVector::operator-(), vpColVector::operator-(), vpTranslationVector::operator/(), vpRowVector::operator/(), vpColVector::operator/(), vpHomography::operator/(), vpHomography::operator/=(), vpSubColVector::operator=(), vpSubRowVector::operator=(), vpQuaternionVector::operator=(), vpTranslationVector::operator=(), vpRowVector::operator=(), vpRzyzVector::operator=(), vpRxyzVector::operator=(), vpRzyxVector::operator=(), vpColVector::operator=(), vpThetaUVector::operator=(), operator=(), vpColVector::operator[](), vpRowVector::reshape(), vpColVector::reshape(), vpQuaternionVector::set(), stack(), stackRows(), vpColVector::sum(), vpColVector::sumSquare(), vpRotationVector::t(), vpTranslationVector::t(), vpPoseVector::t(), vpRowVector::t(), vpColVector::t(), vpColVector::vpColVector(), vpMatrix(), vpQuaternionVector::vpQuaternionVector(), vpRxyzVector::vpRxyzVector(), vpRzyxVector::vpRzyxVector(), vpRzyzVector::vpRzyzVector(), vpThetaUVector::vpThetaUVector(), vpQuaternionVector::w(), vpQuaternionVector::x(), vpQuaternionVector::y(), vpQuaternionVector::z(), vpSubColVector::~vpSubColVector(), vpSubMatrix::~vpSubMatrix(), and vpSubRowVector::~vpSubRowVector().
|
protectedinherited |
Current array size (rowNum * colNum)
Definition at line 80 of file vpArray2D.h.
Referenced by vpColVector::clear(), vpTranslationVector::euclideanNorm(), vpRowVector::euclideanNorm(), euclideanNorm(), vpColVector::hadamard(), hadamard(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpTranslationVector::operator*(), vpRotationVector::operator*(), vpTranslationVector::operator-(), vpTranslationVector::operator/(), vpRzyzVector::operator=(), vpRxyzVector::operator=(), vpRzyxVector::operator=(), vpThetaUVector::operator=(), vpColVector::operator=(), operator=(), vpRowVector::reshape(), vpColVector::reshape(), stackRows(), vpRotationVector::t(), vpColVector::vpColVector(), and vpMatrix().
|
protectedinherited |
Number of rows in the array.
Definition at line 74 of file vpArray2D.h.
Referenced by AAt(), AtA(), vpColVector::clear(), detByLU(), diag(), eigenValues(), expm(), vpColVector::extract(), eye(), vpColVector::hadamard(), hadamard(), vpColVector::infinityNorm(), infinityNorm(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), insert(), inverseByCholesky(), vpRotationMatrix::operator*(), vpTranslationVector::operator*(), vpHomogeneousMatrix::operator*(), vpColVector::operator*(), operator*(), vpRotationMatrix::operator*=(), vpTranslationVector::operator*=(), vpColVector::operator*=(), operator*=(), vpColVector::operator+(), vpColVector::operator+=(), operator+=(), vpColVector::operator-(), vpColVector::operator-=(), operator-=(), vpColVector::operator/(), operator/(), vpTranslationVector::operator/=(), vpColVector::operator/=(), operator/=(), operator<<(), vpColVector::operator<<(), vpSubColVector::operator=(), vpSubRowVector::operator=(), vpSubMatrix::operator=(), vpTranslationVector::operator=(), vpRowVector::operator=(), vpColVector::operator=(), operator=(), vpColVector::reshape(), setIdentity(), stack(), vpColVector::stack(), stackColumns(), stackRows(), vpColVector::sum(), sum(), vpRotationVector::sumSquare(), vpTranslationVector::sumSquare(), vpColVector::sumSquare(), sumSquare(), vpTranslationVector::t(), vpPoseVector::t(), vpColVector::t(), t(), transpose(), vpColVector::vpColVector(), and vpMatrix().
|
protectedinherited |
Address of the first element of each rows.
Definition at line 78 of file vpArray2D.h.
Referenced by AAt(), vpColVector::clear(), infinityNorm(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpRowVector::init(), vpColVector::init(), init(), vpRotationMatrix::operator*(), vpForceTwistMatrix::operator*(), vpVelocityTwistMatrix::operator*(), vpHomogeneousMatrix::operator*(), operator*(), vpRotationMatrix::operator*=(), operator*=(), operator+=(), operator-=(), operator/(), operator/=(), operator<<(), vpColVector::operator<<(), vpSubMatrix::operator=(), vpRotationMatrix::operator=(), vpHomogeneousMatrix::operator=(), vpForceTwistMatrix::operator=(), vpVelocityTwistMatrix::operator=(), vpRowVector::operator=(), vpColVector::operator=(), operator=(), stackColumns(), vpRowVector::sum(), sum(), vpRotationVector::sumSquare(), vpTranslationVector::sumSquare(), vpRowVector::sumSquare(), sumSquare(), transpose(), vpColVector::vpColVector(), and vpMatrix().