![]() |
Visual Servoing Platform
version 3.3.0
|
#include <vpArray2D.h>
Public Member Functions | |
vpArray2D () | |
vpArray2D (const vpArray2D< Type > &A) | |
vpArray2D (unsigned int r, unsigned int c) | |
vpArray2D (unsigned int r, unsigned int c, Type val) | |
vpArray2D (vpArray2D< Type > &&A) | |
vpArray2D (const std::initializer_list< Type > &list) | |
vpArray2D (unsigned int nrows, unsigned int ncols, const std::initializer_list< Type > &list) | |
vpArray2D (const std::initializer_list< std::initializer_list< Type > > &lists) | |
virtual | ~vpArray2D () |
template<> | |
bool | operator== (const vpArray2D< float > &A) const |
Static Public Member Functions | |
Inherited I/O from vpArray2D with Static Public Member Functions | |
static bool | load (const std::string &filename, vpArray2D< Type > &A, bool binary=false, char *header=NULL) |
static bool | loadYAML (const std::string &filename, vpArray2D< Type > &A, char *header=NULL) |
static bool | save (const std::string &filename, const vpArray2D< Type > &A, bool binary=false, const char *header="") |
static bool | saveYAML (const std::string &filename, const vpArray2D< Type > &A, const char *header="") |
Public Attributes | |
Type * | data |
Protected Attributes | |
unsigned int | rowNum |
unsigned int | colNum |
Type ** | rowPtrs |
unsigned int | dsize |
Related Functions | |
(Note that these are not member functions.) | |
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) |
Inherited functionalities from vpArray2D | |
std::ostream & | operator<< (std::ostream &s, const vpArray2D< Type > &A) |
unsigned int | getCols () const |
Type | getMaxValue () const |
Type | getMinValue () const |
unsigned int | getRows () const |
unsigned int | size () const |
void | resize (unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true) |
void | reshape (unsigned int nrows, unsigned int ncols) |
bool | operator== (const vpArray2D< Type > &A) const |
bool | operator!= (const vpArray2D< Type > &A) const |
vpArray2D< Type > & | operator= (Type x) |
vpArray2D< Type > & | operator= (const vpArray2D< Type > &A) |
vpArray2D< Type > & | operator= (vpArray2D< Type > &&other) |
vpArray2D< Type > & | operator= (const std::initializer_list< Type > &list) |
vpArray2D< Type > & | operator= (const std::initializer_list< std::initializer_list< Type > > &lists) |
Type * | operator[] (unsigned int i) |
Type * | operator[] (unsigned int i) const |
vpArray2D< Type > | hadamard (const vpArray2D< Type > &m) const |
Implementation of a generic 2D array used as base class for matrices and vectors.
This class implements a 2D array as a template class and all the basic functionalities common to matrices and vectors. More precisely:
The code below shows how to create a 2-by-3 array of doubles, set the element values and access them:
Once build, this previous code produces the following output:
If ViSP is build with c++11 enabled, you can do the same using:
The array could also be initialized using operator=(const std::initializer_list< std::initializer_list< Type > > &)
You can also use reshape() function:
Definition at line 130 of file vpArray2D.h.
Basic constructor of a 2D array. Number of columns and rows are set to zero.
Definition at line 151 of file vpArray2D.h.
Copy constructor of a 2D array.
Definition at line 156 of file vpArray2D.h.
Constructor that initializes a 2D array with 0.
r | : Array number of rows. |
c | : Array number of columns. |
Definition at line 173 of file vpArray2D.h.
|
inline |
Constructor that initialize a 2D array with val.
r | : Array number of rows. |
c | : Array number of columns. |
val | : Each element of the array is set to val. |
Definition at line 190 of file vpArray2D.h.
Definition at line 202 of file vpArray2D.h.
|
inlineexplicit |
Definition at line 217 of file vpArray2D.h.
|
inlineexplicit |
Definition at line 223 of file vpArray2D.h.
|
inlineexplicit |
Definition at line 237 of file vpArray2D.h.
Destructor that desallocate memory.
Definition at line 257 of file vpArray2D.h.
|
inline |
Return the number of columns of the 2D array.
Definition at line 278 of file vpArray2D.h.
Referenced by vpServo::computeProjectionOperators(), vpMbGenericTracker::computeVVS(), vpMbTracker::computeVVSPoseEstimation(), vpQuadProg::fromCanonicalCost(), vpMatrix::operator+=(), vpMatrix::operator=(), vpIoTools::readConfigVar(), and vpImageTools::warpImage().
Type vpArray2D< Type >::getMaxValue | ( | ) | const |
Return the array max value.
Definition at line 912 of file vpArray2D.h.
Type vpArray2D< Type >::getMinValue | ( | ) | const |
Return the array min value.
Definition at line 895 of file vpArray2D.h.
|
inline |
Return the number of rows of the 2D array.
Definition at line 288 of file vpArray2D.h.
Referenced by vpMbDepthDenseTracker::computeVVS(), vpMbDepthNormalTracker::computeVVS(), vpMbKltMultiTracker::computeVVS(), vpMbEdgeKltMultiTracker::computeVVS(), vpMbEdgeMultiTracker::computeVVS(), vpMbGenericTracker::computeVVS(), vpMbTracker::computeVVSCheckLevenbergMarquardt(), vpMbEdgeMultiTracker::computeVVSFirstPhasePoseEstimation(), vpMbEdgeTracker::computeVVSFirstPhasePoseEstimation(), vpMbEdgeMultiTracker::computeVVSInit(), vpMbKltMultiTracker::computeVVSInteractionMatrixAndResidu(), vpMbEdgeMultiTracker::computeVVSInteractionMatrixAndResidu(), vpMbEdgeKltMultiTracker::computeVVSInteractionMatrixAndResidu(), vpMbTracker::computeVVSPoseEstimation(), vpMbKltMultiTracker::computeVVSWeights(), vpMbEdgeMultiTracker::computeVVSWeights(), vpMbEdgeKltMultiTracker::computeVVSWeights(), vpMbEdgeTracker::computeVVSWeights(), vpProjectionDisplay::display(), vpQuadProg::fromCanonicalCost(), vpMbEdgeKltMultiTracker::initMbtTracking(), vpRobust::MEstimator(), vpMatrix::operator+=(), vpMatrix::operator=(), vpIoTools::readConfigVar(), vpSimulatorAfma6::setJointLimit(), vpSimulatorAfma6::setVelocity(), vpRobust::simultMEstimator(), and vpImageTools::warpImage().
vpArray2D< Type > vpArray2D< Type >::hadamard | ( | const vpArray2D< Type > & | m | ) | const |
Compute the Hadamard product (element wise matrix multiplication).
m | : Second matrix; |
Definition at line 932 of file vpArray2D.h.
|
inlinestatic |
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 540 of file vpArray2D.h.
|
inlinestatic |
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 652 of file vpArray2D.h.
Not equal to comparison operator of a 2D array.
Definition at line 993 of file vpArray2D.h.
|
inline |
Definition at line 464 of file vpArray2D.h.
|
inline |
Definition at line 454 of file vpArray2D.h.
|
inline |
Copy operator of a 2D array.
Definition at line 422 of file vpArray2D.h.
Set all the elements of the array to x.
Definition at line 413 of file vpArray2D.h.
|
inline |
Definition at line 432 of file vpArray2D.h.
Definition at line 978 of file vpArray2D.h.
Equal to comparison operator of a 2D array.
Definition at line 948 of file vpArray2D.h.
|
inline |
Set element using A[i][j] = x.
Definition at line 484 of file vpArray2D.h.
|
inline |
Get element using x = A[i][j].
Definition at line 486 of file vpArray2D.h.
|
inline |
Definition at line 379 of file vpArray2D.h.
|
inline |
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 304 of file vpArray2D.h.
Referenced by vpServo::computeProjectionOperators(), vpMbDepthDenseTracker::computeVVSInit(), vpMbDepthNormalTracker::computeVVSInit(), vpMbKltMultiTracker::computeVVSInit(), vpMbEdgeKltMultiTracker::computeVVSInit(), vpMbEdgeMultiTracker::computeVVSInit(), vpMbGenericTracker::computeVVSInit(), vpMbKltTracker::computeVVSInit(), vpMbEdgeTracker::computeVVSInit(), vpProjectionDisplay::display(), vpMatrix::eigenValues(), vpProjectionDisplay::init(), vpTemplateTrackerSSDInverseCompositional::initCompInverse(), vpTemplateTrackerMIESM::initCompInverse(), vpMbEdgeKltMultiTracker::initMbtTracking(), vpTemplateTracker::initTracking(), vpArray2D< double >::operator=(), vpIoTools::readConfigVar(), vpArray2D< double >::reshape(), vpArray2D< double >::vpArray2D(), vpTemplateTrackerMI::vpTemplateTrackerMI(), vpTemplateTrackerSSD::vpTemplateTrackerSSD(), vpTemplateTrackerSSDESM::vpTemplateTrackerSSDESM(), vpTemplateTrackerSSDInverseCompositional::vpTemplateTrackerSSDInverseCompositional(), vpTemplateTrackerWarpAffine::vpTemplateTrackerWarpAffine(), vpTemplateTrackerWarpHomography::vpTemplateTrackerWarpHomography(), vpTemplateTrackerWarpHomographySL3::vpTemplateTrackerWarpHomographySL3(), vpTemplateTrackerWarpRT::vpTemplateTrackerWarpRT(), vpTemplateTrackerWarpSRT::vpTemplateTrackerWarpSRT(), vpTemplateTrackerWarpTranslation::vpTemplateTrackerWarpTranslation(), and vpTemplateTrackerZNCC::vpTemplateTrackerZNCC().
|
inlinestatic |
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 737 of file vpArray2D.h.
|
inlinestatic |
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 830 of file vpArray2D.h.
|
inline |
Return the number of elements of the 2D array.
Definition at line 290 of file vpArray2D.h.
Referenced by vpMbtFaceDepthNormal::computeNormalVisibility(), vpMbtFaceDepthNormal::estimatePlaneEquationSVD(), vpArray2D< double >::operator==(), vpRobotFranka::setForceTorque(), vpColVector::vpColVector(), and vpTemplateTrackerWarp::warpTriangle().
|
friend |
Writes the given array to the output stream and returns a reference to the output stream.
Definition at line 493 of file vpArray2D.h.
|
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. |
|
related |
Enumeration of the operations applied on matrices in vpGEMM() function.
Operations are :
|
protected |
Number of columns in the array.
Definition at line 136 of file vpArray2D.h.
Referenced by vpArray2D< double >::operator=(), vpRowVector::operator==(), vpColVector::operator==(), vpArray2D< double >::operator==(), vpArray2D< double >::reshape(), and vpArray2D< double >::vpArray2D().
Type* vpArray2D< Type >::data |
Address of the first element of the data array.
Definition at line 144 of file vpArray2D.h.
Referenced by vpTemplateTrackerMIESM::initHessienDesired(), vpColVector::operator=(), vpMatrix::operator=(), vpArray2D< double >::operator=(), vpRowVector::operator==(), vpColVector::operator==(), vpArray2D< double >::operator==(), vpArray2D< double >::reshape(), vpPoseVector::t(), vpTemplateTrackerMIESM::trackNoPyr(), and vpArray2D< double >::vpArray2D().
|
protected |
Current array size (rowNum * colNum)
Definition at line 140 of file vpArray2D.h.
Referenced by vpArray2D< double >::operator=(), vpArray2D< double >::reshape(), and vpArray2D< double >::vpArray2D().
|
protected |
Number of rows in the array.
Definition at line 134 of file vpArray2D.h.
Referenced by vpColVector::operator=(), vpArray2D< double >::operator=(), vpRowVector::operator==(), vpColVector::operator==(), vpArray2D< double >::operator==(), vpArray2D< double >::reshape(), and vpArray2D< double >::vpArray2D().
|
protected |
Address of the first element of each rows.
Definition at line 138 of file vpArray2D.h.
Referenced by vpMatrix::operator+=(), vpArray2D< double >::operator=(), vpArray2D< double >::reshape(), and vpArray2D< double >::vpArray2D().