Visual Servoing Platform
version 3.3.0 under development (2020-02-17)
|
#include <visp3/core/vpRowVector.h>
Public Member Functions | |
vpRowVector () | |
vpRowVector (unsigned int n) | |
vpRowVector (unsigned int n, double val) | |
vpRowVector (const vpRowVector &v) | |
vpRowVector (const vpRowVector &v, unsigned int c, unsigned int ncols) | |
vpRowVector (const vpMatrix &M) | |
vpRowVector (const vpMatrix &M, unsigned int i) | |
vpRowVector (const std::vector< double > &v) | |
vpRowVector (const std::vector< float > &v) | |
vpRowVector (vpRowVector &&v) | |
vpRowVector (const std::initializer_list< double > &list) | |
virtual | ~vpRowVector () |
void | clear () |
std::ostream & | cppPrint (std::ostream &os, const std::string &matrixName="A", bool octet=false) const |
std::ostream & | csvPrint (std::ostream &os) const |
void | deg2rad () |
vp_deprecated double | euclideanNorm () const |
vpRowVector | extract (unsigned int c, unsigned int rowsize) const |
double | frobeniusNorm () const |
void | init (const vpRowVector &v, unsigned int c, unsigned int ncols) |
void | insert (unsigned int i, const vpRowVector &v) |
std::ostream & | maplePrint (std::ostream &os) const |
std::ostream & | matlabPrint (std::ostream &os) const |
vpRowVector & | normalize () |
vpRowVector & | normalize (vpRowVector &x) const |
double & | operator[] (unsigned int n) |
const double & | operator[] (unsigned int n) const |
vpRowVector & | operator= (const vpRowVector &v) |
vpRowVector & | operator= (const vpMatrix &M) |
vpRowVector & | operator= (const std::vector< double > &v) |
vpRowVector & | operator= (const std::vector< float > &v) |
vpRowVector & | operator= (double x) |
vpRowVector & | operator= (vpRowVector &&v) |
vpRowVector & | operator= (const std::initializer_list< double > &list) |
bool | operator== (const vpRowVector &v) const |
bool | operator!= (const vpRowVector &v) const |
double | operator* (const vpColVector &x) const |
vpRowVector | operator* (const vpMatrix &M) const |
vpRowVector | operator* (double x) const |
vpRowVector & | operator*= (double x) |
vpRowVector | operator/ (double x) const |
vpRowVector & | operator/= (double x) |
vpRowVector | operator+ (const vpRowVector &v) const |
vpRowVector & | operator+= (vpRowVector v) |
vpRowVector | operator- (const vpRowVector &v) const |
vpRowVector & | operator-= (vpRowVector v) |
vpRowVector | operator- () const |
vpRowVector & | operator<< (const vpRowVector &v) |
vpRowVector & | operator<< (double val) |
vpRowVector & | operator, (double val) |
int | print (std::ostream &s, unsigned int length, char const *intro=0) const |
void | rad2deg () |
void | reshape (vpMatrix &M, const unsigned int &nrows, const unsigned int &ncols) |
vpMatrix | reshape (unsigned int nrows, unsigned int ncols) |
void | resize (unsigned int i, bool flagNullify=true) |
void | resize (unsigned int nrows, unsigned int ncols, bool flagNullify) |
void | stack (double d) |
void | stack (const vpRowVector &v) |
double | sum () const |
double | sumSquare () const |
vpColVector | t () const |
std::vector< double > | toStdVector () |
vpColVector | transpose () const |
void | transpose (vpColVector &v) const |
bool | operator== (const vpArray2D< float > &A) 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 (unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true) |
bool | operator== (const vpArray2D< double > &A) const |
bool | operator!= (const vpArray2D< double > &A) const |
vpArray2D< double > | hadamard (const vpArray2D< double > &m) const |
Static Public Member Functions | |
static double | mean (const vpRowVector &v) |
static double | median (const vpRowVector &v) |
static vpRowVector | stack (const vpRowVector &A, const vpRowVector &B) |
static void | stack (const vpRowVector &A, const vpRowVector &B, vpRowVector &C) |
static double | stdev (const vpRowVector &v, bool useBesselCorrection=false) |
Inherited I/O from vpArray2D with Static Public Member Functions | |
static bool | load (const std::string &filename, vpArray2D< double > &A, 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, 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.) | |
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 vpRowVector &r) |
vp_deprecated void | setIdentity (const double &val=1.0) |
static vp_deprecated vpRowVector | stackMatrices (const vpRowVector &A, const vpRowVector &B) |
static vp_deprecated void | stackMatrices (const vpRowVector &A, const vpRowVector &B, vpRowVector &C) |
Implementation of row vector and the associated operations.
This class provides a data structure for a row vector that contains values of double. It contains also some functions to achieve a set of operations on these vectors.
The vpRowVector class is derived from vpArray2D<double>.
The code below shows how to create a 3-element row vector 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 vector could also be initialized using operator=(const std::initializer_list< double > &)
Definition at line 115 of file vpRowVector.h.
|
inline |
Basic constructor that creates an empty 0-size row vector.
Definition at line 119 of file vpRowVector.h.
|
inlineexplicit |
Construct a row vector of size n. All the elements are initialized to zero.
Definition at line 122 of file vpRowVector.h.
|
inline |
Construct a row vector of size n. Each element is set to val.
Definition at line 124 of file vpRowVector.h.
|
inline |
Copy constructor that allows to construct a row vector from an other one.
Definition at line 127 of file vpRowVector.h.
vpRowVector::vpRowVector | ( | const vpRowVector & | v, |
unsigned int | c, | ||
unsigned int | ncols | ||
) |
Construct a row vector from a part of an input row vector v.
v | : Input row vector used for initialization. |
c | : column index in v that corresponds to the first element of the row vector to contruct. |
ncols | : Number of columns of the constructed row vector. |
The sub-vector starting from v[c] element and ending on v[c+ncols-1] element is used to initialize the contructed row vector.
Definition at line 581 of file vpRowVector.cpp.
References init().
vpRowVector::vpRowVector | ( | const vpMatrix & | M | ) |
Constructor that creates a row vector from a 1-by-n matrix M.
vpException::dimensionError | If the matrix is not a 1-by-n matrix. |
Definition at line 540 of file vpRowVector.cpp.
References vpException::dimensionError, vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().
vpRowVector::vpRowVector | ( | const vpMatrix & | M, |
unsigned int | i | ||
) |
Constructor that creates a row vector corresponding to row i of matrix M.
Definition at line 529 of file vpRowVector.cpp.
References vpArray2D< Type >::getCols().
vpRowVector::vpRowVector | ( | const std::vector< double > & | v | ) |
Constructor that creates a row vector from a std vector of double.
Definition at line 554 of file vpRowVector.cpp.
vpRowVector::vpRowVector | ( | const std::vector< float > & | v | ) |
Constructor that creates a row vector from a std vector of float.
Definition at line 562 of file vpRowVector.cpp.
vpRowVector::vpRowVector | ( | vpRowVector && | v | ) |
Definition at line 587 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::data, vpArray2D< double >::dsize, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
|
inline |
Definition at line 135 of file vpRowVector.h.
|
inlinevirtual |
Destructor.
Definition at line 140 of file vpRowVector.h.
|
inline |
Removes all elements from the vector (which are destroyed), leaving the container with a size of 0.
Definition at line 146 of file vpRowVector.h.
std::ostream & vpRowVector::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 row vector, "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 1196 of file vpRowVector.cpp.
References vpArray2D< double >::getCols().
std::ostream & vpRowVector::csvPrint | ( | std::ostream & | os | ) | const |
Print/save a row vector in csv format.
The following code
produces log.csv file that contains:
Definition at line 1238 of file vpRowVector.cpp.
References vpArray2D< double >::getCols().
|
inline |
Convert a column vector containing angles in degrees into radians.
Definition at line 167 of file vpRowVector.h.
double vpRowVector::euclideanNorm | ( | ) | const |
Compute and return the Euclidean norm also called Fronebius norm .
Definition at line 1100 of file vpRowVector.cpp.
References frobeniusNorm().
|
inline |
Extract a sub-row vector from a row vector.
c | : Index of the column corresponding to the first element of the vector to extract. |
rowsize | : Size of the vector to extract. |
vpException::fatalError | If the vector to extract is not contained in the original one. |
Definition at line 191 of file vpRowVector.h.
References vpException::fatalError.
double vpRowVector::frobeniusNorm | ( | ) | const |
Compute and return the Fronebius norm .
Definition at line 1110 of file vpRowVector.cpp.
References sumSquare().
Referenced by euclideanNorm().
|
inlineinherited |
Return the number of columns of the 2D array.
Definition at line 279 of file vpArray2D.h.
References vpArray2D< Type >::colNum, vpArray2D< Type >::getMaxValue(), and vpArray2D< Type >::getMinValue().
Referenced by vpMatrix::cond(), cppPrint(), vpMatrix::cppPrint(), csvPrint(), vpMatrix::csvPrint(), vpMatrix::detByLUEigen3(), vpMatrix::extract(), vpRotationMatrix::getCol(), vpHomogeneousMatrix::getCol(), vpMatrix::getCol(), vpMatrix::inducedL2Norm(), vpMatrix::inverseByLUEigen3(), vpMatrix::inverseByQRLapack(), vpRotationMatrix::isARotationMatrix(), vpMatrix::kernel(), maplePrint(), vpMatrix::maplePrint(), matlabPrint(), vpMatrix::matlabPrint(), operator*(), operator+(), operator+=(), operator-(), operator-=(), vpForceTwistMatrix::print(), vpVelocityTwistMatrix::print(), print(), vpMatrix::print(), vpMatrix::pseudoInverse(), vpMatrix::row(), vpMatrix::svdEigen3(), vpMatrix::svdGsl(), vpMatrix::svdLapack(), and vpMatrix::svdOpenCV().
|
inherited |
Return the array max value.
Definition at line 913 of file vpArray2D.h.
References vpArray2D< Type >::data.
|
inherited |
Return the array min value.
Definition at line 896 of file vpArray2D.h.
References vpArray2D< Type >::data.
|
inlineinherited |
Return the number of rows of the 2D array.
Definition at line 289 of file vpArray2D.h.
References vpArray2D< Type >::rowNum.
Referenced by vpMatrix::column(), vpMatrix::cond(), vpColVector::cppPrint(), vpMatrix::cppPrint(), vpColVector::csvPrint(), vpMatrix::csvPrint(), vpMatrix::detByLUEigen3(), vpMatrix::extract(), vpRotationMatrix::getCol(), vpHomogeneousMatrix::getCol(), vpMatrix::getCol(), vpMatrix::inducedL2Norm(), vpMatrix::inverseByCholeskyLapack(), vpMatrix::inverseByLUEigen3(), vpMatrix::inverseByQRLapack(), vpRotationMatrix::isARotationMatrix(), vpMatrix::kernel(), vpColVector::maplePrint(), vpMatrix::maplePrint(), vpColVector::matlabPrint(), vpMatrix::matlabPrint(), vpColVector::operator+(), vpColVector::operator+=(), vpColVector::operator-(), vpColVector::operator-=(), vpForceTwistMatrix::print(), vpVelocityTwistMatrix::print(), vpPoseVector::print(), vpColVector::print(), vpMatrix::print(), vpMatrix::pseudoInverse(), vpMatrix::svdEigen3(), vpMatrix::svdGsl(), vpMatrix::svdLapack(), and vpMatrix::svdOpenCV().
Compute the Hadamard product (element wise matrix multiplication).
m | : Second matrix; |
Definition at line 933 of file vpArray2D.h.
References vpArray2D< Type >::colNum, vpArray2D< Type >::data, vpException::dimensionError, vpArray2D< Type >::dsize, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), and vpArray2D< Type >::resize().
void vpRowVector::init | ( | const vpRowVector & | v, |
unsigned int | c, | ||
unsigned int | ncols | ||
) |
Initialize the row vector from a part of an input row vector v.
v | : Input row vector used for initialization. |
c | : column index in v that corresponds to the first element of the row vector to contruct. |
ncols | : Number of columns of the constructed row vector. |
The sub-vector starting from v[c] element and ending on v[c+ncols-1] element is used to initialize the contructed row vector.
The following code shows how to use this function:
It produces the following output:
Definition at line 1152 of file vpRowVector.cpp.
References vpException::dimensionError, vpArray2D< Type >::getCols(), resize(), and vpArray2D< double >::rowPtrs.
|
inline |
Definition at line 321 of file vpRowVector.h.
Referenced by vpRowVector(), and vpSubRowVector::vpSubRowVector().
void vpRowVector::insert | ( | unsigned int | i, |
const vpRowVector & | v | ||
) |
Insert a row vector.
i | : Index of the first element to introduce. This index starts from 0. |
v | : Row vector to insert. |
The following example shows how to use this function:
It produces the following output:
Definition at line 747 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::size(), and vpArray2D< double >::size().
|
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 541 of file vpArray2D.h.
References vpException::badValue, and vpArray2D< Type >::resize().
|
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 653 of file vpArray2D.h.
References vpArray2D< Type >::resize().
std::ostream & vpRowVector::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 1272 of file vpRowVector.cpp.
References vpArray2D< double >::getCols().
std::ostream & vpRowVector::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 1314 of file vpRowVector.cpp.
References vpArray2D< double >::getCols().
|
static |
Compute the mean value of all the elements of the vector.
Definition at line 894 of file vpRowVector.cpp.
References vpArray2D< Type >::data, vpException::dimensionError, vpArray2D< Type >::getCols(), and vpArray2D< Type >::size().
Referenced by stdev().
|
static |
Compute the median value of all the elements of the vector.
Definition at line 911 of file vpRowVector.cpp.
References vpArray2D< Type >::colNum, vpArray2D< Type >::data, vpException::dimensionError, vpMath::getMedian(), and vpArray2D< Type >::size().
vpRowVector & vpRowVector::normalize | ( | ) |
Normalise the vector modifying the vector as:
where is an element of the row vector .
Definition at line 627 of file vpRowVector.cpp.
References sumSquare().
Referenced by vpPolygon3D::computePolygonClipped().
vpRowVector & vpRowVector::normalize | ( | vpRowVector & | x | ) | const |
Normalise the vector given as input parameter and return the normalized vector:
where is an element of the row vector .
Definition at line 612 of file vpRowVector.cpp.
References sumSquare().
bool vpRowVector::operator!= | ( | const vpRowVector & | v | ) | const |
Definition at line 190 of file vpRowVector.cpp.
Not equal to comparison operator of a 2D array.
Definition at line 994 of file vpArray2D.h.
double vpRowVector::operator* | ( | const vpColVector & | x | ) | const |
Multiply a row vector by a column vector.
x | : Column vector. |
vpException::dimensionError | : If the number of elements of the two vectors is not the same. |
Definition at line 208 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< double >::getCols(), and vpArray2D< Type >::getRows().
Referenced by print().
vpRowVector vpRowVector::operator* | ( | const vpMatrix & | M | ) | const |
Multiply a row vector by a matrix.
M | : Matrix. |
vpException::dimensionError | If the number of elements of the row vector is not equal to the number of rows of the matrix. |
Definition at line 238 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::data, vpException::dimensionError, vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().
vpRowVector vpRowVector::operator* | ( | double | x | ) | const |
Operator that allows to multiply each element of a row vector by a scalar.
x | : The scalar. |
Definition at line 278 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::data, and vpArray2D< Type >::data.
vpRowVector & vpRowVector::operator*= | ( | double | x | ) |
Operator that allows to multiply each element of a row vector by a scalar.
x | : The scalar. |
Definition at line 307 of file vpRowVector.cpp.
References vpArray2D< double >::colNum.
vpRowVector vpRowVector::operator+ | ( | const vpRowVector & | v | ) | const |
Operator that allows to add to row vectors that have the same size.
vpException::dimensionError | If the vectors size differ. |
Definition at line 415 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< double >::getCols(), and vpArray2D< Type >::getCols().
vpRowVector & vpRowVector::operator+= | ( | vpRowVector | v | ) |
Operator that allows to add two row vectors that have the same size.
vpException::dimensionError | If the size of the two vectors differ. |
Definition at line 434 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< double >::getCols(), and vpArray2D< Type >::getCols().
vpRowVector & vpRowVector::operator, | ( | double | val | ) |
Definition at line 497 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::data, and resize().
vpRowVector vpRowVector::operator- | ( | const vpRowVector & | m | ) | const |
Operator that allows to substract to row vectors that have the same size.
vpException::dimensionError | If the vectors size differ. |
Definition at line 397 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< double >::getCols(), and vpArray2D< Type >::getCols().
vpRowVector vpRowVector::operator- | ( | void | ) | const |
Operator that allows to negate all the row vector elements.
Definition at line 380 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::data, and vpArray2D< Type >::data.
vpRowVector & vpRowVector::operator-= | ( | vpRowVector | v | ) |
Operator that allows to substract two row vectors that have the same size.
vpException::dimensionError | If the size of the two vectors differ. |
Definition at line 451 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< double >::getCols(), and vpArray2D< Type >::getCols().
vpRowVector vpRowVector::operator/ | ( | double | x | ) | const |
Operator that allows to divide each element of a row vector by a scalar.
x | : The scalar. |
Definition at line 333 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::data, and vpArray2D< Type >::data.
vpRowVector & vpRowVector::operator/= | ( | double | x | ) |
Operator that allows to divide each element of a row vector by a scalar.
x | : The scalar. |
Definition at line 363 of file vpRowVector.cpp.
References vpArray2D< double >::colNum.
vpRowVector & vpRowVector::operator<< | ( | const vpRowVector & | v | ) |
Copy operator. Allows operation such as A << v
In row vector A we get:
Definition at line 484 of file vpRowVector.cpp.
vpRowVector & vpRowVector::operator<< | ( | double | val | ) |
Definition at line 490 of file vpRowVector.cpp.
References vpArray2D< double >::data, and resize().
vpRowVector & vpRowVector::operator= | ( | const vpRowVector & | v | ) |
Copy operator. Allow operation such as A = v.
Definition at line 58 of file vpRowVector.cpp.
References vpArray2D< Type >::colNum, vpArray2D< double >::colNum, vpArray2D< double >::data, vpArray2D< Type >::data, and resize().
vpRowVector & vpRowVector::operator= | ( | const vpMatrix & | M | ) |
Initialize a row vector from a 1-by-n size matrix.
vpException::dimensionError | If the matrix is not a 1-by-n dimension matrix. |
Definition at line 81 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpArray2D< Type >::data, vpArray2D< double >::data, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), and resize().
vpRowVector & vpRowVector::operator= | ( | const std::vector< double > & | v | ) |
Initialize a row vector from a standard vector of double.
Definition at line 98 of file vpRowVector.cpp.
References resize().
vpRowVector & vpRowVector::operator= | ( | const std::vector< float > & | v | ) |
Initialize a row vector from a standard vector of double.
Definition at line 108 of file vpRowVector.cpp.
References resize().
vpRowVector & vpRowVector::operator= | ( | double | x | ) |
Initialize each element of the vector with x.
Definition at line 117 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
vpRowVector & vpRowVector::operator= | ( | vpRowVector && | v | ) |
Definition at line 128 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::data, vpArray2D< double >::dsize, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
vpRowVector & vpRowVector::operator= | ( | const std::initializer_list< double > & | list | ) |
Set vector elements from a list of double.
It produces the following printings:
Definition at line 169 of file vpRowVector.cpp.
References vpArray2D< double >::data, and resize().
bool vpRowVector::operator== | ( | const vpRowVector & | v | ) | const |
Comparison operator.
Definition at line 177 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpArray2D< Type >::colNum, vpArray2D< Type >::data, vpArray2D< double >::data, vpMath::equal(), vpArray2D< double >::rowNum, and vpArray2D< Type >::rowNum.
Equal to comparison operator of a 2D array.
Definition at line 949 of file vpArray2D.h.
References vpArray2D< Type >::colNum, vpArray2D< Type >::data, vpArray2D< Type >::operator==(), vpArray2D< Type >::rowNum, and vpArray2D< Type >::size().
Definition at line 979 of file vpArray2D.h.
References vpArray2D< Type >::colNum, vpArray2D< Type >::data, vpArray2D< Type >::rowNum, and vpArray2D< Type >::size().
|
inline |
Operator that allows to set a value of an element : v[i] = x.
Definition at line 214 of file vpRowVector.h.
|
inline |
Operator that allows to get the value of an element : x = v[i].
Definition at line 216 of file vpRowVector.h.
References vpArray2D< Type >::operator!=(), operator*(), vpArray2D< Type >::operator<<, vpArray2D< Type >::operator=(), and vpArray2D< Type >::operator==().
int vpRowVector::print | ( | std::ostream & | s, |
unsigned int | length, | ||
char const * | intro = 0 |
||
) | const |
Pretty print a row vector. 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 row vector 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 vector. Can be set to zero (or omitted), in which case the introduction is not printed. |
Definition at line 964 of file vpRowVector.cpp.
References vpArray2D< double >::getCols(), vpMath::maximum(), and operator*().
|
inline |
Convert a column vector containing angles in radians into degrees.
Definition at line 256 of file vpRowVector.h.
References vpArray2D< Type >::reshape().
void vpRowVector::reshape | ( | vpMatrix & | M, |
const unsigned int & | nrows, | ||
const unsigned int & | ncols | ||
) |
Reshape the row vector in a matrix.
M | : the reshaped matrix. |
nrows | : number of rows of the matrix. |
ncols | : number of columns of the matrix. |
vpException::dimensionError | If the matrix and the row vector have not the same size. |
The following example shows how to use this method.
If you run the previous example, you get:
Definition at line 699 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::data, vpException::dimensionError, vpArray2D< double >::dsize, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), and vpArray2D< Type >::resize().
Referenced by reshape().
vpMatrix vpRowVector::reshape | ( | unsigned int | nrows, |
unsigned int | ncols | ||
) |
Reshape the row vector in a matrix.
nrows | : number of rows of the matrix. |
ncols | : number of columns of the matrix. |
vpException::dimensionError | If the matrix and the row vector have not the same size. |
Definition at line 649 of file vpRowVector.cpp.
References reshape().
|
inline |
Modify the size of the row vector.
i | : Size of the vector. This value corresponds to the vector number of columns. |
flagNullify | : If true, set the data to zero. |
Definition at line 271 of file vpRowVector.h.
References vpArray2D< Type >::resize().
Referenced by vpImageTools::columnMean(), vp::eigen2visp(), init(), operator,(), operator<<(), operator=(), stack(), vpMatrix::stackRows(), vpTemplateTrackerSSD::vpTemplateTrackerSSD(), and vpTemplateTrackerZNCC::vpTemplateTrackerZNCC().
|
inline |
Resize the row vector to a ncols-dimension vector. This function can only be used with nrows = 1.
nrows | : Vector number of rows. This value should be set to 1. |
ncols | : Vector number of columns. This value corresponds to the size of the vector. |
flagNullify | : If true, set the data to zero. |
vpException::fatalError | When nrows is not equal to 1. |
Definition at line 286 of file vpRowVector.h.
References vpException::fatalError, and vpArray2D< Type >::resize().
|
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 305 of file vpArray2D.h.
References vpArray2D< Type >::colNum, vpArray2D< Type >::dsize, vpException::memoryAllocationError, vpArray2D< Type >::rowNum, and vpArray2D< Type >::rowPtrs.
Referenced by vpMatrix::diag(), vpMatrix::eye(), vpMatrix::init(), vpMatrix::operator,(), vpMatrix::operator<<(), vpMatrix::operator=(), vpMatrix::stack(), and vpMatrix::svdOpenCV().
|
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 738 of file vpArray2D.h.
References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().
|
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 831 of file vpArray2D.h.
References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().
vp_deprecated void vpRowVector::setIdentity | ( | const double & | val = 1.0 | ) |
|
inlineinherited |
Return the number of elements of the 2D array.
Definition at line 291 of file vpArray2D.h.
References vpArray2D< Type >::rowNum.
Referenced by insert(), vpColVector::insert(), vpColVector::operator*(), vpRotationVector::operator,(), vpTranslationVector::operator,(), vpRotationMatrix::operator,(), vpQuaternionVector::operator=(), vpTranslationVector::operator=(), vpRxyzVector::operator=(), vpRzyzVector::operator=(), vpRzyxVector::operator=(), vpThetaUVector::operator=(), vpMatrix::stack(), vpRotationVector::toStdVector(), toStdVector(), and vpColVector::toStdVector().
void vpRowVector::stack | ( | double | d | ) |
Stack row vector with a new element at the end of the vector.
d | : Element to stack to the existing one. |
Definition at line 787 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, and resize().
Referenced by stack().
void vpRowVector::stack | ( | const vpRowVector & | v | ) |
Stack row vectors.
v | : Vector to stack to the existing one. |
Definition at line 812 of file vpRowVector.cpp.
References stack().
|
static |
Stack row vectors.
A | : Initial vector. |
B | : Vector to stack at the end of A. |
Definition at line 834 of file vpRowVector.cpp.
References stack().
|
static |
Stack row vectors.
A | : Initial vector. |
B | : Vector to stack at the end of A. |
C | : Resulting stacked vector . |
Definition at line 861 of file vpRowVector.cpp.
References vpArray2D< Type >::getCols(), and resize().
|
inline |
Definition at line 325 of file vpRowVector.h.
|
inlinestatic |
Definition at line 330 of file vpRowVector.h.
|
inlinestatic |
Definition at line 335 of file vpRowVector.h.
References operator*().
|
static |
Compute the standard deviation value of all the elements of the vector.
Definition at line 925 of file vpRowVector.cpp.
References vpArray2D< Type >::data, vpException::dimensionError, mean(), and vpArray2D< Type >::size().
double vpRowVector::sum | ( | ) | const |
Return the sum of all the elements of the row vector v(n).
Definition at line 1062 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, and vpArray2D< double >::rowPtrs.
double vpRowVector::sumSquare | ( | ) | const |
Return the sum square of all the elements of the row vector v(n).
Definition at line 1079 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, and vpArray2D< double >::rowPtrs.
Referenced by frobeniusNorm(), and normalize().
vpColVector vpRowVector::t | ( | ) | const |
Transpose the row vector. The resulting vector becomes a column vector.
Definition at line 507 of file vpRowVector.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::data, and vpArray2D< Type >::data.
Referenced by transpose().
std::vector< double > vpRowVector::toStdVector | ( | ) |
Converts the vpRowVector to a std::vector.
Definition at line 762 of file vpRowVector.cpp.
References vpArray2D< double >::data, and vpArray2D< double >::size().
vpColVector vpRowVector::transpose | ( | ) | const |
Transpose the row vector. The resulting vector becomes a column vector.
Definition at line 518 of file vpRowVector.cpp.
References t().
void vpRowVector::transpose | ( | vpColVector & | v | ) | const |
Transpose the row vector. The resulting vector v becomes a column vector.
Definition at line 523 of file vpRowVector.cpp.
References t().
|
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 137 of file vpArray2D.h.
Referenced by vpMatrix::AAt(), vpMatrix::AtA(), vpColVector::clear(), vpMatrix::detByLU(), vpMatrix::detByLUEigen3(), vpMatrix::detByLUGsl(), vpMatrix::detByLULapack(), vpMatrix::detByLUOpenCV(), vpMatrix::diag(), vpMatrix::eigenValues(), vpMatrix::expm(), vpMatrix::eye(), vpMatrix::getDiag(), vpMatrix::getRow(), vpColVector::hadamard(), vpMatrix::hadamard(), vpMatrix::infinityNorm(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), insert(), vpMatrix::insert(), vpMatrix::inverseByCholeskyLapack(), vpMatrix::inverseByCholeskyOpenCV(), vpMatrix::inverseByLUEigen3(), vpMatrix::inverseByLUGsl(), vpMatrix::inverseByLULapack(), vpMatrix::inverseByLUOpenCV(), vpMatrix::inverseByQRLapack(), vpMatrix::inverseTriangular(), vpRotationMatrix::operator*(), operator*(), vpMatrix::operator*(), vpRotationMatrix::operator*=(), operator*=(), vpMatrix::operator*=(), operator+(), operator+=(), vpMatrix::operator+=(), operator,(), vpMatrix::operator,(), operator-(), operator-=(), vpMatrix::operator-=(), operator/(), vpMatrix::operator/(), operator/=(), vpMatrix::operator/=(), vpMatrix::operator<<(), vpColVector::operator<<(), vpSubRowVector::operator=(), vpSubMatrix::operator=(), operator=(), vpColVector::operator=(), vpMatrix::operator=(), operator==(), vpColVector::operator==(), vpMatrix::qr(), vpMatrix::qrPivot(), reshape(), vpMatrix::setIdentity(), vpMatrix::solveByQR(), vpMatrix::solveBySVD(), vpMatrix::stack(), stack(), vpMatrix::stackColumns(), vpMatrix::stackRows(), sum(), vpMatrix::sum(), sumSquare(), vpMatrix::sumSquare(), t(), vpMatrix::transpose(), vpColVector::vpColVector(), vpMatrix::vpMatrix(), and vpRowVector().
|
inherited |
Address of the first element of the data array.
Definition at line 145 of file vpArray2D.h.
Referenced by vpMatrix::AtA(), vpQuaternionVector::buildFrom(), vpHomogeneousMatrix::buildFrom(), vpThetaUVector::buildFrom(), vpRzyzVector::buildFrom(), vpRxyzVector::buildFrom(), vpRzyxVector::buildFrom(), vpSubColVector::checkParentStatus(), vpSubRowVector::checkParentStatus(), vpSubMatrix::checkParentStatus(), vpColVector::clear(), vpHomogeneousMatrix::convert(), vpMatrix::detByLUEigen3(), vpMatrix::detByLUOpenCV(), vpMatrix::expm(), vpThetaUVector::extract(), vpMatrix::frobeniusNorm(), vpMatrix::getRow(), vpThetaUVector::getTheta(), vpThetaUVector::getU(), vpColVector::hadamard(), vpMatrix::hadamard(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpColVector::insert(), vpMatrix::insert(), vpMatrix::inverseByCholeskyOpenCV(), vpMatrix::inverseByLUEigen3(), vpMatrix::inverseByLUOpenCV(), vpTranslationVector::operator*(), operator*(), vpHomography::operator*(), vpColVector::operator*(), vpMatrix::operator*(), vpRotationVector::operator,(), vpTranslationVector::operator,(), vpRotationMatrix::operator,(), operator,(), vpColVector::operator,(), vpTranslationVector::operator-(), operator-(), vpColVector::operator-(), vpTranslationVector::operator/(), operator/(), vpHomography::operator/(), vpColVector::operator/(), vpHomography::operator/=(), vpRotationVector::operator<<(), vpTranslationVector::operator<<(), vpRotationMatrix::operator<<(), operator<<(), vpColVector::operator<<(), vpSubColVector::operator=(), vpSubRowVector::operator=(), vpQuaternionVector::operator=(), vpTranslationVector::operator=(), vpRotationMatrix::operator=(), vpRxyzVector::operator=(), vpRzyzVector::operator=(), vpRzyxVector::operator=(), operator=(), vpThetaUVector::operator=(), vpColVector::operator=(), vpMatrix::operator=(), operator==(), vpColVector::operator==(), vpColVector::operator[](), vpMatrix::qr(), vpMatrix::qrPivot(), reshape(), vpColVector::reshape(), vpQuaternionVector::set(), vpMatrix::stack(), vpMatrix::stackRows(), vpColVector::sum(), vpColVector::sumSquare(), vpMatrix::svdEigen3(), vpMatrix::svdGsl(), vpMatrix::svdLapack(), vpMatrix::svdOpenCV(), vpRotationVector::t(), vpTranslationVector::t(), vpPoseVector::t(), t(), vpColVector::t(), vpRotationVector::toStdVector(), toStdVector(), vpColVector::toStdVector(), vpColVector::vpColVector(), vpMatrix::vpMatrix(), vpRowVector(), vpQuaternionVector::w(), vpQuaternionVector::x(), vpQuaternionVector::y(), vpQuaternionVector::z(), vpSubColVector::~vpSubColVector(), vpSubMatrix::~vpSubMatrix(), and vpSubRowVector::~vpSubRowVector().
|
protectedinherited |
Current array size (rowNum * colNum)
Definition at line 141 of file vpArray2D.h.
Referenced by vpColVector::clear(), vpMatrix::frobeniusNorm(), vpColVector::hadamard(), vpMatrix::hadamard(), vpMatrix::inducedL2Norm(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpRotationVector::operator*(), vpTranslationVector::operator*(), vpTranslationVector::operator-(), vpTranslationVector::operator/(), vpRotationMatrix::operator=(), vpRzyzVector::operator=(), vpRxyzVector::operator=(), vpRzyxVector::operator=(), vpThetaUVector::operator=(), operator=(), vpColVector::operator=(), vpMatrix::operator=(), reshape(), vpColVector::reshape(), vpRotationVector::t(), vpColVector::vpColVector(), vpMatrix::vpMatrix(), and vpRowVector().
|
protectedinherited |
Number of rows in the array.
Definition at line 135 of file vpArray2D.h.
Referenced by vpMatrix::AAt(), vpMatrix::AtA(), vpColVector::clear(), vpMatrix::detByLU(), vpMatrix::detByLUEigen3(), vpMatrix::detByLUGsl(), vpMatrix::detByLULapack(), vpMatrix::detByLUOpenCV(), vpMatrix::diag(), vpMatrix::eigenValues(), vpMatrix::expm(), vpColVector::extract(), vpMatrix::eye(), vpMatrix::getCol(), vpMatrix::getDiag(), vpMatrix::getRow(), vpColVector::hadamard(), vpMatrix::hadamard(), vpColVector::infinityNorm(), vpMatrix::infinityNorm(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpMatrix::insert(), vpMatrix::inverseByCholeskyLapack(), vpMatrix::inverseByCholeskyOpenCV(), vpMatrix::inverseByLUEigen3(), vpMatrix::inverseByLUGsl(), vpMatrix::inverseByLULapack(), vpMatrix::inverseByLUOpenCV(), vpMatrix::inverseByQRLapack(), vpMatrix::inverseTriangular(), vpTranslationVector::operator*(), vpRotationMatrix::operator*(), vpHomogeneousMatrix::operator*(), vpColVector::operator*(), vpMatrix::operator*(), vpTranslationVector::operator*=(), vpRotationMatrix::operator*=(), vpColVector::operator*=(), vpMatrix::operator*=(), vpColVector::operator+(), vpColVector::operator+=(), vpMatrix::operator+=(), vpColVector::operator,(), vpColVector::operator-(), vpColVector::operator-=(), vpMatrix::operator-=(), vpColVector::operator/(), vpMatrix::operator/(), vpTranslationVector::operator/=(), vpColVector::operator/=(), vpMatrix::operator/=(), vpMatrix::operator<<(), vpColVector::operator<<(), vpSubColVector::operator=(), vpSubRowVector::operator=(), vpSubMatrix::operator=(), vpTranslationVector::operator=(), operator=(), vpColVector::operator=(), vpMatrix::operator=(), operator==(), vpColVector::operator==(), vpMatrix::qr(), vpMatrix::qrPivot(), vpColVector::reshape(), vpMatrix::setIdentity(), vpMatrix::stack(), vpColVector::stack(), vpMatrix::stackColumns(), vpMatrix::stackRows(), vpColVector::sum(), vpMatrix::sum(), vpRotationVector::sumSquare(), vpTranslationVector::sumSquare(), vpColVector::sumSquare(), vpMatrix::sumSquare(), vpTranslationVector::t(), vpPoseVector::t(), vpColVector::t(), vpMatrix::transpose(), vpColVector::vpColVector(), vpMatrix::vpMatrix(), and vpRowVector().
|
protectedinherited |
Address of the first element of each rows.
Definition at line 139 of file vpArray2D.h.
Referenced by vpMatrix::AAt(), vpColVector::clear(), vpMatrix::infinityNorm(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), init(), vpColVector::init(), vpMatrix::init(), vpRotationMatrix::operator*(), vpForceTwistMatrix::operator*(), vpVelocityTwistMatrix::operator*(), vpHomogeneousMatrix::operator*(), vpMatrix::operator*(), vpRotationMatrix::operator*=(), vpMatrix::operator*=(), vpMatrix::operator+=(), vpMatrix::operator,(), vpMatrix::operator-=(), vpMatrix::operator/(), vpMatrix::operator/=(), vpMatrix::operator<<(), vpColVector::operator<<(), vpSubMatrix::operator=(), vpRotationMatrix::operator=(), vpForceTwistMatrix::operator=(), vpHomogeneousMatrix::operator=(), vpVelocityTwistMatrix::operator=(), operator=(), vpColVector::operator=(), vpMatrix::operator=(), vpMatrix::stack(), vpMatrix::stackColumns(), sum(), vpMatrix::sum(), vpRotationVector::sumSquare(), vpTranslationVector::sumSquare(), sumSquare(), vpMatrix::sumSquare(), vpColVector::vpColVector(), vpMatrix::vpMatrix(), and vpRowVector().