Visual Servoing Platform  version 3.0.0
vpRowVector Class Reference

#include <visp3/core/vpRowVector.h>

+ Inheritance diagram for vpRowVector:

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)
 
virtual ~vpRowVector ()
 
void clear ()
 
void deg2rad ()
 
double euclideanNorm () const
 
vpRowVector extract (unsigned int c, unsigned int rowsize) const
 
void init (const vpRowVector &v, unsigned int c, unsigned int ncols)
 
void insert (unsigned int i, const vpRowVector &v)
 
vpRowVectornormalize ()
 
vpRowVectornormalize (vpRowVector &x) const
 
double & operator[] (unsigned int n)
 
const double & operator[] (unsigned int n) const
 
vpRowVectoroperator= (const vpRowVector &v)
 
vpRowVectoroperator= (const vpMatrix &M)
 
vpRowVectoroperator= (const std::vector< double > &v)
 
vpRowVectoroperator= (const std::vector< float > &v)
 
vpRowVectoroperator= (const double x)
 
double operator* (const vpColVector &x) const
 
vpRowVector operator* (const vpMatrix &M) const
 
vpRowVector operator* (const double x) const
 
vpRowVectoroperator*= (double x)
 
vpRowVector operator/ (const double x) const
 
vpRowVectoroperator/= (double x)
 
vpRowVector operator+ (const vpRowVector &v) const
 
vpRowVectoroperator+= (vpRowVector v)
 
vpRowVector operator- (const vpRowVector &v) const
 
vpRowVectoroperator-= (vpRowVector v)
 
vpRowVector operator- () const
 
vpRowVectoroperator<< (const vpRowVector &v)
 
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 (const unsigned int &nrows, const unsigned int &ncols)
 
void resize (const unsigned int i, const bool flagNullify=true)
 
void resize (const unsigned int nrows, const unsigned int ncols, const bool flagNullify)
 
void stack (const double &d)
 
void stack (const vpRowVector &v)
 
double sumSquare () const
 
vpColVector t () const
 
vpColVector transpose () const
 
void transpose (vpColVector &v) const
 
Inherited functionalities from vpArray2D
double getMinValue () const
 
double getMaxValue () const
 
unsigned int getRows () const
 
unsigned int getCols () const
 
unsigned int size () 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, const bool useBesselCorrection=false)
 
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.)

enum  vpGEMMmethod
 

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)
 

Detailed Description

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>.

Examples:
testMatrix.cpp, and testRowVector.cpp.

Definition at line 70 of file vpRowVector.h.

Constructor & Destructor Documentation

vpRowVector::vpRowVector ( )
inline

Basic constructor that creates an empty 0-size row vector.

Definition at line 74 of file vpRowVector.h.

vpRowVector::vpRowVector ( unsigned int  n)
inline

Construct a row vector of size n. All the elements are initialized to zero.

Definition at line 76 of file vpRowVector.h.

vpRowVector::vpRowVector ( unsigned int  n,
double  val 
)
inline

Construct a row vector of size n. Each element is set to val.

Definition at line 78 of file vpRowVector.h.

vpRowVector::vpRowVector ( const vpRowVector v)
inline

Copy constructor that allows to construct a row vector from an other one.

Definition at line 80 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.

Parameters
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.

See also
init()

Definition at line 513 of file vpRowVector.cpp.

References init().

vpRowVector::vpRowVector ( const vpMatrix M)

Constructor that creates a row vector from a 1-by-n matrix M.

Exceptions
vpException::dimensionErrorIf the matrix is not a 1-by-n matrix.

Definition at line 469 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 458 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 485 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 494 of file vpRowVector.cpp.

virtual vpRowVector::~vpRowVector ( )
inlinevirtual

Destructor.

Definition at line 89 of file vpRowVector.h.

Member Function Documentation

void vpRowVector::clear ( )
inline

Removes all elements from the vector (which are destroyed), leaving the container with a size of 0.

Examples:
testRowVector.cpp.

Definition at line 95 of file vpRowVector.h.

void vpRowVector::deg2rad ( )
inline

Convert a column vector containing angles in degrees into radians.

See also
rad2deg()

Definition at line 113 of file vpRowVector.h.

double vpRowVector::euclideanNorm ( ) const

Compute and return the Euclidean norm $ ||x|| = \sqrt{ \sum{v_{i}^2}} $.

Returns
The Euclidean norm if the vector is initialized, 0 otherwise.

Definition at line 956 of file vpRowVector.cpp.

References vpArray2D< double >::data, and vpArray2D< double >::dsize.

vpRowVector vpRowVector::extract ( unsigned int  c,
unsigned int  rowsize 
) const
inline

Extract a sub-row vector from a row vector.

Parameters
c: Index of the column corresponding to the first element of the vector to extract.
rowsize: Size of the vector to extract.
Exceptions
vpException::fatalErrorIf the vector to extract is not contained in the original one.
for (unsigned int i=0; i<4; i++)
r1.stack(i);
// r1 is equal to [0 1 2 3]
vpRowVector r2 = r1.extract(1, 3);
// r2 is equal to [1 2 3]
Examples:
testRowVector.cpp.

Definition at line 135 of file vpRowVector.h.

References vpException::fatalError.

double vpArray2D< double >::getMaxValue ( ) const
inherited

Return the array max value.

Examples:
servoMomentImage.cpp.
double vpArray2D< double >::getMinValue ( ) const
inherited

Return the array min value.

Examples:
servoMomentImage.cpp.
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.

Parameters
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:

#include <visp3/core/vpRowVector.h>
int main()
{
int val = 0;
for(size_t i=0; i<v.getCols(); i++) {
v[i] = val++;
}
std::cout << "v: " << v << std::endl;
w.init(v, 1, 2);
std::cout << "w: " << w << std::endl;
}

It produces the following output:

v: 0 1 2 3
w: 1 2
Examples:
testRowVector.cpp.

Definition at line 1002 of file vpRowVector.cpp.

References vpException::dimensionError, vpArray2D< Type >::getCols(), resize(), and vpArray2D< double >::rowPtrs.

vp_deprecated void vpRowVector::init ( )
inline
Deprecated:
Provided only for compat with previous releases. This function does nothing.

Definition at line 246 of file vpRowVector.h.

Referenced by vpRowVector(), and vpSubRowVector::vpSubRowVector().

void vpRowVector::insert ( unsigned int  i,
const vpRowVector v 
)

Insert a row vector.

Parameters
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:

#include <visp/vpRowVector.h>
int main()
{
for (unsigned int i=0; i < v.size(); i++)
v[i] = i;
std::cout << "v: " << v << std::endl;
for (unsigned int i=0; i < w.size(); i++)
w[i] = i+10;
std::cout << "w: " << w << std::endl;
v.insert(1, w);
std::cout << "v: " << v << std::endl;
}

It produces the following output:

v: 0 1 2 3
w: 10 11
v: 0 10 11 3

Definition at line 625 of file vpRowVector.cpp.

References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::size(), and vpArray2D< double >::size().

static bool vpArray2D< double >::load ( const std::string &  filename,
vpArray2D< double > &  A,
const bool  binary = false,
char *  header = NULL 
)
inlinestaticinherited

Load a matrix from a file.

Parameters
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.
Returns
Returns true if success.
See also
save()

Definition at line 308 of file vpArray2D.h.

References vpException::badValue, and vpArray2D< Type >::resize().

static bool vpArray2D< double >::loadYAML ( const std::string &  filename,
vpArray2D< double > &  A,
char *  header = NULL 
)
inlinestaticinherited

Load an array from a YAML-formatted file.

Parameters
filename: absolute file name.
A: array to be loaded from the file.
header: header of the file is loaded in this parameter.
Returns
Returns true on success.
See also
saveYAML()

Definition at line 392 of file vpArray2D.h.

References vpArray2D< Type >::resize().

double vpRowVector::mean ( const vpRowVector v)
static

Compute the mean value of all the elements of the vector.

Examples:
testRowVector.cpp.

Definition at line 761 of file vpRowVector.cpp.

References vpArray2D< Type >::data, vpException::fatalError, and vpArray2D< Type >::getCols().

Referenced by stdev().

double vpRowVector::median ( const vpRowVector v)
static

Compute the median value of all the elements of the vector.

Examples:
testRowVector.cpp.

Definition at line 780 of file vpRowVector.cpp.

References vpArray2D< Type >::data, vpException::fatalError, vpMath::getMedian(), and vpArray2D< Type >::size().

vpRowVector & vpRowVector::normalize ( )

Normalise the vector modifying the vector as:

\[ {\bf x} = \frac{{\bf x}}{\sqrt{\sum_{i=1}^{n}x^2_i}} \]

where $x_i$ is an element of the row vector $\bf x$.

Examples:
testRowVector.cpp.

Definition at line 543 of file vpRowVector.cpp.

References sumSquare().

vpRowVector & vpRowVector::normalize ( vpRowVector x) const

Normalise the vector given as input parameter and return the normalized vector:

\[ {\bf x} = \frac{{\bf x}}{\sqrt{\sum_{i=1}^{n}x^2_i}} \]

where $x_i$ is an element of the row vector $\bf x$.

Definition at line 527 of file vpRowVector.cpp.

References sumSquare().

double vpRowVector::operator* ( const vpColVector x) const

Multiply a row vector by a column vector.

Parameters
x: Column vector.
Warning
The number of elements of the two vectors must be equal.
Exceptions
vpException::dimensionError: If the number of elements of the two vectors is not the same.
Returns
A scalar.

Definition at line 142 of file vpRowVector.cpp.

References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< double >::getCols(), and vpArray2D< Type >::getRows().

vpRowVector vpRowVector::operator* ( const vpMatrix M) const

Multiply a row vector by a matrix.

Parameters
M: Matrix.
Warning
The number of elements of the row vector must be equal to the number of rows of the matrix.
Exceptions
vpException::dimensionErrorIf the number of elements of the row vector is not equal to the number of rows of the matrix.
Returns
The resulting row vector.

Definition at line 173 of file vpRowVector.cpp.

References vpArray2D< double >::colNum, vpArray2D< double >::data, vpException::dimensionError, vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().

vpRowVector vpRowVector::operator* ( const double  x) const

Operator that allows to multiply each element of a row vector by a scalar.

Parameters
x: The scalar.
Returns
The row vector multiplied by the scalar. The current row vector (*this) is unchanged.
v[0] = 1;
v[1] = 2;
v[2] = 3;
vpRowVector w = v * 3;
// v is unchanged
// w is now equal to : [3 6 9]

Definition at line 214 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.

Parameters
x: The scalar.
Returns
The row vector multiplied by the scalar.
v[0] = 1;
v[1] = 2;
v[2] = 3;
v *= 3;
// v is now equal to : [3 6 9]

Definition at line 242 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.

Exceptions
vpException::dimensionErrorIf the vectors size differ.

Definition at line 349 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.

Exceptions
vpException::dimensionErrorIf the size of the two vectors differ.

Definition at line 369 of file vpRowVector.cpp.

References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< double >::getCols(), and vpArray2D< Type >::getCols().

vpRowVector vpRowVector::operator- ( const vpRowVector m) const

Operator that allows to substract to row vectors that have the same size.

Exceptions
vpException::dimensionErrorIf the vectors size differ.

Definition at line 330 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.

vpRowVector r(3, 1);
// r contains [1 1 1]
vpRowVector v = -r;
// v contains [-1 -1 -1]

Definition at line 314 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.

Exceptions
vpException::dimensionErrorIf the size of the two vectors differ.

Definition at line 387 of file vpRowVector.cpp.

References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< double >::getCols(), and vpArray2D< Type >::getCols().

vpRowVector vpRowVector::operator/ ( const double  x) const

Operator that allows to divide each element of a row vector by a scalar.

Parameters
x: The scalar.
Returns
The row vector divided by the scalar. The current row vector (*this) is unchanged.
v[0] = 8;
v[1] = 4;
v[2] = 2;
vpRowVector w = v / 2;
// v is equal to : [8 4 2]
// w is equal to : [4 2 1]

Definition at line 268 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.

Parameters
x: The scalar.
Returns
The row vector divided by the scalar.
v[0] = 8;
v[1] = 4;
v[2] = 2;
// v is equal to : [8 4 2]
v /= 2;
// v is equal to : [4 2 1]

Definition at line 297 of file vpRowVector.cpp.

References vpArray2D< double >::colNum.

vpRowVector & vpRowVector::operator<< ( const vpRowVector v)

Copy operator. Allows operation such as A << v

#include <visp3/core/vpRowVector.h>
int main()
{
vpRowVector A, B(5);
for (unsigned int i=0; i<B.size(); i++)
B[i] = i;
A << B;
std::cout << "A: " << A << std::endl;
}

In row vector A we get:

A: 0 1 2 3 4

Definition at line 421 of file vpRowVector.cpp.

vpRowVector & vpRowVector::operator= ( const vpRowVector v)

Copy operator. Allow operation such as A = v.

Definition at line 57 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.

Warning
Handled with care m should be a 1 column matrix.
Exceptions
vpException::dimensionErrorIf 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 99 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 109 of file vpRowVector.cpp.

References resize().

vpRowVector & vpRowVector::operator= ( const double  x)

Initialize each element of the vector with x.

Definition at line 118 of file vpRowVector.cpp.

References vpArray2D< double >::colNum, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.

double& vpRowVector::operator[] ( unsigned int  n)
inline

Operator that allows to set a value of an element $v_i$: v[i] = x.

Definition at line 153 of file vpRowVector.h.

const double& vpRowVector::operator[] ( unsigned int  n) const
inline

Operator that allows to get the value of an element $v_i$: x = v[i].

Definition at line 155 of file vpRowVector.h.

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.

Parameters
sStream used for the printing.
lengthThe 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.
introThe introduction which is printed before the vector. Can be set to zero (or omitted), in which case the introduction is not printed.
Returns
Returns the common total width for all vector elements.
See also
std::ostream &operator<<(std::ostream &s, const vpArray2D<Type> &A)
Examples:
servoSimu3D_cdMc_CamVelocity.cpp, servoSimu3D_cMcd_CamVelocity.cpp, testMatrix.cpp, and testRowVector.cpp.

Definition at line 840 of file vpRowVector.cpp.

References vpArray2D< double >::getCols(), and vpMath::maximum().

void vpRowVector::rad2deg ( )
inline

Convert a column vector containing angles in radians into degrees.

See also
deg2rad()

Definition at line 186 of file vpRowVector.h.

void vpRowVector::reshape ( vpMatrix M,
const unsigned int &  nrows,
const unsigned int &  ncols 
)

Reshape the row vector in a matrix.

Parameters
M: the reshaped matrix.
nrows: number of rows of the matrix.
ncols: number of columns of the matrix.
Exceptions
vpException::dimensionErrorIf the matrix and the row vector have not the same size.

Definition at line 577 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 ( const unsigned int &  nrows,
const unsigned int &  ncols 
)

Reshape the row vector in a matrix.

Parameters
nrows: number of rows of the matrix.
ncols: number of columns of the matrix.
Returns
The resulting matrix.
Exceptions
vpException::dimensionErrorIf the matrix and the row vector have not the same size.

Definition at line 562 of file vpRowVector.cpp.

References reshape().

void vpRowVector::resize ( const unsigned int  i,
const bool  flagNullify = true 
)
inline

Modify the size of the row vector.

Parameters
i: Size of the vector. This value corresponds to the vector number of columns.
flagNullify: If true, set the data to zero.
Examples:
testMatrix.cpp, and testRowVector.cpp.

Definition at line 199 of file vpRowVector.h.

References vpArray2D< Type >::resize().

Referenced by init(), operator=(), stack(), vpMatrix::stackRows(), vpTemplateTrackerSSD::vpTemplateTrackerSSD(), and vpTemplateTrackerZNCC::vpTemplateTrackerZNCC().

void vpRowVector::resize ( const unsigned int  nrows,
const unsigned int  ncols,
const bool  flagNullify 
)
inline

Resize the row vector to a ncols-dimension vector. This function can only be used with nrows = 1.

Parameters
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.
Exceptions
vpException::fatalErrorWhen nrows is not equal to 1.

Definition at line 214 of file vpRowVector.h.

References vpException::fatalError, and vpArray2D< Type >::resize().

static bool vpArray2D< double >::save ( const std::string &  filename,
const vpArray2D< double > &  A,
const bool  binary = false,
const char *  header = "" 
)
inlinestaticinherited

Save a matrix to a file.

Parameters
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.
Returns
Returns true if success.

Warning : If you save the matrix as in a text file the precision is less than if you save it in a binary file.

See also
load()

Definition at line 468 of file vpArray2D.h.

References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().

static bool vpArray2D< double >::saveYAML ( const std::string &  filename,
const vpArray2D< double > &  A,
const char *  header = "" 
)
inlinestaticinherited

Save an array in a YAML-formatted file.

Parameters
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.
Returns
Returns true if success.

Here is an example of outputs.

vpArray2D::saveYAML("matrix.yml", M, "example: a YAML-formatted header");
vpArray2D::saveYAML("matrixIndent.yml", M, "example:\n - a YAML-formatted header\n - with inner indentation");

Content of matrix.yml:

example: a YAML-formatted header
rows: 3
cols: 4
- [0, 0, 0, 0]
- [0, 0, 0, 0]
- [0, 0, 0, 0]

Content of matrixIndent.yml:

example:
- a YAML-formatted header
- with inner indentation
rows: 3
cols: 4
- [0, 0, 0, 0]
- [0, 0, 0, 0]
- [0, 0, 0, 0]
See also
loadYAML()

Definition at line 560 of file vpArray2D.h.

References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().

vp_deprecated void vpRowVector::setIdentity ( const double &  val = 1.0)
Deprecated:
You should rather use eye()
unsigned int vpArray2D< double >::size ( ) const
inlineinherited
void vpRowVector::stack ( const double &  d)

Stack row vector with a new element at the end of the vector.

Parameters
d: Element to stack to the existing one.
vpRowVector v(3, 1);
// v is equal to [1 1 1]
v.stack(-2);
// v is equal to [1 1 1 -2]
See also
stack(const vpRowVector &, const vpRowVector &)
stack(const vpRowVector &, const vpRowVector &, vpRowVector &)
Examples:
testRowVector.cpp.

Definition at line 651 of file vpRowVector.cpp.

References vpArray2D< double >::colNum, and resize().

Referenced by stack().

void vpRowVector::stack ( const vpRowVector v)

Stack row vectors.

Parameters
v: Vector to stack to the existing one.
vpRowVector v1(3, 1);
// v1 is equal to [1 1 1]
vpRowVector v2(2, 3);
// v2 is equal to [3 3]
v1.stack(v2);
// v1 is equal to [1 1 1 3 3]
See also
stack(const vpRowVector &, const double &)
stack(const vpRowVector &, const vpRowVector &)
stack(const vpRowVector &, const vpRowVector &, vpRowVector &)

Definition at line 676 of file vpRowVector.cpp.

References stack().

vpRowVector vpRowVector::stack ( const vpRowVector A,
const vpRowVector B 
)
static

Stack row vectors.

Parameters
A: Initial vector.
B: Vector to stack at the end of A.
Returns
Stacked vector $[A B]$.
vpRowVector r1(3, 1);
// r1 is equal to [1 1 1]
vpRowVector r2(2, 3);
// r2 is equal to [3 3]
v = vpRowVector::stack(r1, r2);
// v is equal to [1 1 1 3 3]
See also
stack(const vpRowVector &)
stack(const vpRowVector &, const vpRowVector &, vpRowVector &)

Definition at line 701 of file vpRowVector.cpp.

References stack().

void vpRowVector::stack ( const vpRowVector A,
const vpRowVector B,
vpRowVector C 
)
static

Stack row vectors.

Parameters
A: Initial vector.
B: Vector to stack at the end of A.
C: Resulting stacked vector $C = [A B]$.
vpRowVector r1(3, 1);
// r1 is equal to [1 1 1]
vpRowVector r2(2, 3);
// r2 is equal to [3 3]
vpRowVector::stack(r1, r2, v);
// v is equal to [1 1 1 3 3]
See also
stack(const vpRowVector &)
stack(const vpRowVector &, const vpRowVector &)

Definition at line 728 of file vpRowVector.cpp.

References vpArray2D< Type >::getCols(), and resize().

vp_deprecated void vpRowVector::stackMatrices ( const vpRowVector r)
inline
Deprecated:
You should rather use stack(const vpRowVector &)

Definition at line 250 of file vpRowVector.h.

static vp_deprecated vpRowVector vpRowVector::stackMatrices ( const vpRowVector A,
const vpRowVector B 
)
inlinestatic
Deprecated:
You should rather use stack(const vpRowVector &A, const vpRowVector &B)

Definition at line 254 of file vpRowVector.h.

static vp_deprecated void vpRowVector::stackMatrices ( const vpRowVector A,
const vpRowVector B,
vpRowVector C 
)
inlinestatic
double vpRowVector::stdev ( const vpRowVector v,
const bool  useBesselCorrection = false 
)
static

Compute the standard deviation value of all the elements of the vector.

Examples:
testRowVector.cpp.

Definition at line 799 of file vpRowVector.cpp.

References vpArray2D< Type >::data, vpException::fatalError, mean(), and vpArray2D< Type >::size().

double vpRowVector::sumSquare ( ) const

Return the sum square of all the elements $v_{i}$ of the row vector v(n).

Returns
The sum square value: $\sum_{j=0}^{n} v_j^{2}$.

Definition at line 938 of file vpRowVector.cpp.

References vpArray2D< double >::colNum, and vpArray2D< double >::rowPtrs.

Referenced by normalize(), and vpMatrix::pseudoInverse().

vpColVector vpRowVector::t ( ) const

Transpose the row vector. The resulting vector becomes a column vector.

Examples:
servoSimu3D_cMcd_CamVelocityWithoutVpServo.cpp, and testKalmanAcceleration.cpp.

Definition at line 430 of file vpRowVector.cpp.

References vpArray2D< double >::colNum, vpArray2D< double >::data, and vpArray2D< Type >::data.

Referenced by transpose().

vpColVector vpRowVector::transpose ( ) const

Transpose the row vector. The resulting vector becomes a column vector.

See also
t()

Definition at line 441 of file vpRowVector.cpp.

References t().

void vpRowVector::transpose ( vpColVector v) const

Transpose the row vector. The resulting vector v becomes a column vector.

See also
t()

Definition at line 449 of file vpRowVector.cpp.

References t().

Friends And Related Function Documentation

enum vpGEMMmethod
related

Enumeration of the operations applied on matrices in vpGEMM() function.

Operations are :

  • VP_GEMM_A_T to use the transpose matrix of A instead of the matrix A
  • VP_GEMM_B_T to use the transpose matrix of B instead of the matrix B
  • VP_GEMM_C_T to use the transpose matrix of C instead of the matrix C

Definition at line 57 of file vpGEMM.h.

Member Data Documentation

double * vpArray2D< double >::data
inherited

Address of the first element of the data array.

Examples:
testDisplacement.cpp, testMatrix.cpp, testPoseVector.cpp, and testTranslationVector.cpp.

Definition at line 84 of file vpArray2D.h.

Referenced by vpMatrix::AtA(), vpHomogeneousMatrix::buildFrom(), vpRzyzVector::buildFrom(), vpRzyxVector::buildFrom(), vpRxyzVector::buildFrom(), vpThetaUVector::buildFrom(), vpSubColVector::checkParentStatus(), vpSubRowVector::checkParentStatus(), vpSubMatrix::checkParentStatus(), vpColVector::clear(), vpHomogeneousMatrix::convert(), vpTranslationVector::euclideanNorm(), euclideanNorm(), vpColVector::euclideanNorm(), vpMatrix::euclideanNorm(), vpMatrix::expm(), vpThetaUVector::extract(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpTranslationVector::operator*(), operator*(), vpColVector::operator*(), vpHomography::operator*(), vpTranslationVector::operator-(), operator-(), vpColVector::operator-(), vpTranslationVector::operator/(), operator/(), vpColVector::operator/(), vpHomography::operator/(), vpHomography::operator/=(), vpSubColVector::operator=(), vpSubRowVector::operator=(), vpTranslationVector::operator=(), operator=(), vpColVector::operator=(), vpRzyxVector::operator=(), vpRzyzVector::operator=(), vpRxyzVector::operator=(), vpMatrix::operator=(), vpThetaUVector::operator=(), vpColVector::operator[](), reshape(), vpColVector::reshape(), vpQuaternionVector::set(), vpMatrix::stackRows(), vpRotationVector::t(), vpTranslationVector::t(), vpPoseVector::t(), t(), vpColVector::t(), vpQuaternionVector::w(), vpQuaternionVector::x(), vpQuaternionVector::y(), vpQuaternionVector::z(), vpSubColVector::~vpSubColVector(), vpSubMatrix::~vpSubMatrix(), and vpSubRowVector::~vpSubRowVector().

unsigned int vpArray2D< double >::rowNum
protectedinherited

Number of rows in the array.

Definition at line 74 of file vpArray2D.h.

Referenced by vpMatrix::AAt(), vpMatrix::AtA(), vpColVector::clear(), vpMatrix::diag(), vpMatrix::eigenValues(), vpMatrix::expm(), vpColVector::extract(), vpMatrix::eye(), vpColVector::infinityNorm(), vpMatrix::infinityNorm(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpMatrix::insert(), vpMatrix::inverseByCholesky(), vpMatrix::inverseByLU(), vpMatrix::inverseByQR(), vpRotationMatrix::operator*(), vpTranslationVector::operator*(), vpHomogeneousMatrix::operator*(), vpColVector::operator*(), vpMatrix::operator*(), vpRotationMatrix::operator*=(), vpTranslationVector::operator*=(), vpColVector::operator*=(), vpMatrix::operator*=(), vpColVector::operator+(), vpColVector::operator+=(), vpMatrix::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=(), vpColVector::reshape(), vpMatrix::setIdentity(), vpMatrix::stack(), vpColVector::stack(), vpMatrix::stackColumns(), vpMatrix::stackRows(), vpMatrix::sum(), vpRotationVector::sumSquare(), vpTranslationVector::sumSquare(), vpColVector::sumSquare(), vpMatrix::sumSquare(), vpTranslationVector::t(), vpPoseVector::t(), vpColVector::t(), vpMatrix::t(), and vpMatrix::transpose().