YARP Yet Another Robot Platform
Math.h File Reference
`#include <yarp/sig/Vector.h>`
`#include <yarp/sig/Matrix.h>`
`#include <yarp/math/api.h>`
`#include <yarp/math/Quaternion.h>`
Include dependency graph for Math.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Namespaces

yarp
The main, catch-all namespace for YARP.

yarp::math

## Functions

yarp::sig::Vector operator+ (const yarp::sig::Vector &a, const double &s)
Mathematical operations. More...

yarp::sig::Vector operator+ (const double &s, const yarp::sig::Vector &a)
Addition operator between a scalar and a vector (defined in Math.h). More...

yarp::sig::Vectoroperator+= (yarp::sig::Vector &a, const double &s)
Addition operator between a scalar and a vector (defined in Math.h). More...

yarp::sig::Vector operator+ (const yarp::sig::Vector &a, const yarp::sig::Vector &b)
Addition operator between vectors, returns a+b (defined in Math.h). More...

yarp::sig::Vectoroperator+= (yarp::sig::Vector &a, const yarp::sig::Vector &b)
Addition operator between vectors, returns a+b (defined in Math.h). More...

yarp::sig::Matrix operator+ (const yarp::sig::Matrix &a, const yarp::sig::Matrix &b)
Addition operator between matrices, returns a+b (defined in Math.h). More...

yarp::sig::Matrixoperator+= (yarp::sig::Matrix &a, const yarp::sig::Matrix &b)
Addition operator between matrices, returns a+b (defined in Math.h). More...

yarp::sig::Vector operator- (const yarp::sig::Vector &a, const double &s)
Subtraction operator between a vector and a scalar (defined in Math.h). More...

yarp::sig::Vector operator- (const double &s, const yarp::sig::Vector &a)
Subtraction operator between a scalar and a vector (defined in Math.h). More...

yarp::sig::Vectoroperator-= (yarp::sig::Vector &a, const double &s)
Subtraction operator between a vector and a scalar (defined in Math.h). More...

yarp::sig::Vector operator- (const yarp::sig::Vector &a, const yarp::sig::Vector &b)
Subtraction operator between vectors, returns a-b (defined in Math.h). More...

yarp::sig::Vectoroperator-= (yarp::sig::Vector &a, const yarp::sig::Vector &b)
Subtraction operator between vectors, returns a-b (defined in Math.h). More...

yarp::sig::Matrix operator- (const yarp::sig::Matrix &a, const yarp::sig::Matrix &b)
Subtraction operator between matrices, returns a-b (defined in Math.h). More...

yarp::sig::Matrixoperator-= (yarp::sig::Matrix &a, const yarp::sig::Matrix &b)
Subtraction operator between matrices, returns a-b (defined in Math.h). More...

yarp::sig::Vector operator* (double k, const yarp::sig::Vector &b)
Scalar-vector product operator (defined in Math.h). More...

yarp::sig::Vector operator* (const yarp::sig::Vector &b, double k)
Vector-scalar product operator (defined in Math.h). More...

yarp::sig::Vectoroperator*= (yarp::sig::Vector &b, double k)
Vector-scalar product operator (defined in Math.h). More...

yarp::sig::Vector operator* (const yarp::sig::Vector &a, const yarp::sig::Matrix &m)
Vector-matrix product operator (defined in Math.h). More...

yarp::sig::Vectoroperator*= (yarp::sig::Vector &a, const yarp::sig::Matrix &m)
Vector-matrix product operator (defined in Math.h). More...

yarp::sig::Vector operator* (const yarp::sig::Matrix &m, const yarp::sig::Vector &a)
Matrix-vector product operator (defined in Math.h). More...

yarp::sig::Matrix operator* (const yarp::sig::Matrix &a, const yarp::sig::Matrix &b)
Matrix-matrix product operator (defined in Math.h). More...

yarp::sig::Matrixoperator*= (yarp::sig::Matrix &a, const yarp::sig::Matrix &b)
Matrix-matrix product operator (defined in Math.h). More...

yarp::sig::Matrix operator* (const double k, const yarp::sig::Matrix &M)
Scalar-matrix product operator (defined in Math.h). More...

yarp::sig::Matrix operator* (const yarp::sig::Matrix &M, const double k)
Matrix-scalar product operator (defined in Math.h). More...

yarp::sig::Matrixoperator*= (yarp::sig::Matrix &M, const double k)
Matrix-scalar product operator (defined in Math.h). More...

yarp::sig::Vector operator* (const yarp::sig::Vector &a, const yarp::sig::Vector &b)
Vector-vector element-wise product operator (defined in Math.h). More...

yarp::sig::Vectoroperator*= (yarp::sig::Vector &a, const yarp::sig::Vector &b)
Vector-vector element-wise product operator (defined in Math.h). More...

yarp::math::Quaternion operator* (const yarp::math::Quaternion &a, const yarp::math::Quaternion &b)
Quaternion-quaternion hamilton product operator (defined in Math.h). More...

yarp::sig::Vector operator/ (const yarp::sig::Vector &a, const yarp::sig::Vector &b)
Vector-vector element-wise division operator (defined in Math.h). More...

yarp::sig::Vectoroperator/= (yarp::sig::Vector &a, const yarp::sig::Vector &b)
Vector-vector element-wise division operator (defined in Math.h). More...

yarp::sig::Vector operator/ (const yarp::sig::Vector &b, double k)
Vector-scalar division operator (defined in Math.h). More...

yarp::sig::Vectoroperator/= (yarp::sig::Vector &b, double k)
Vector-scalar division operator (defined in Math.h). More...

yarp::sig::Matrix operator/ (const yarp::sig::Matrix &M, double k)
Matrix-scalar division operator (defined in Math.h). More...

yarp::sig::Matrixoperator/= (yarp::sig::Matrix &M, double k)
Matrix-scalar division operator (defined in Math.h). More...

yarp::sig::Matrix yarp::math::pile (const yarp::sig::Matrix &m1, const yarp::sig::Matrix &m2)
Matrix-Matrix concatenation by column (defined in Math.h). More...

yarp::sig::Matrix yarp::math::pile (const yarp::sig::Vector &v, const yarp::sig::Matrix &m)
Vector-Matrix concatenation (defined in Math.h). More...

yarp::sig::Matrix yarp::math::pile (const yarp::sig::Matrix &m, const yarp::sig::Vector &v)
Matrix-Vector concatenation (defined in Math.h). More...

yarp::sig::Matrix yarp::math::pile (const yarp::sig::Vector &v1, const yarp::sig::Vector &v2)
Vector-Vector concatenation (defined in Math.h). More...

yarp::sig::Matrix yarp::math::cat (const yarp::sig::Matrix &m1, const yarp::sig::Matrix &m2)
Matrix-Matrix concatenation by row (defined in Math.h). More...

yarp::sig::Matrix yarp::math::cat (const yarp::sig::Matrix &m, const yarp::sig::Vector &v)
Matrix-Vector concatenation (defined in Math.h). More...

yarp::sig::Matrix yarp::math::cat (const yarp::sig::Vector &v, const yarp::sig::Matrix &m)
Vector-Matrix concatenation (defined in Math.h). More...

yarp::sig::Vector yarp::math::cat (const yarp::sig::Vector &v1, const yarp::sig::Vector &v2)
Vector-Vector concatenation (defined in Math.h). More...

yarp::sig::Vector yarp::math::cat (const yarp::sig::Vector &v, double s)
Vector-scalar concatenation (defined in Math.h). More...

yarp::sig::Vector yarp::math::cat (double s, const yarp::sig::Vector &v)
Scalar-vector concatenation (defined in Math.h). More...

yarp::sig::Vector yarp::math::cat (double s1, double s2)
Scalar-scalar concatenation (defined in Math.h). More...

yarp::sig::Vector yarp::math::cat (double s1, double s2, double s3)

yarp::sig::Vector yarp::math::cat (double s1, double s2, double s3, double s4)

yarp::sig::Vector yarp::math::cat (double s1, double s2, double s3, double s4, double s5)

double yarp::math::dot (const yarp::sig::Vector &a, const yarp::sig::Vector &b)
Scalar product between vectors (defined in Math.h). More...

yarp::sig::Matrix yarp::math::outerProduct (const yarp::sig::Vector &a, const yarp::sig::Vector &b)
Outer product between vectors (defined in Math.h). More...

yarp::sig::Vector yarp::math::cross (const yarp::sig::Vector &a, const yarp::sig::Vector &b)
Compute the cross product between two vectors (defined in Math.h). More...

yarp::sig::Matrix yarp::math::crossProductMatrix (const yarp::sig::Vector &v)
Compute the cross product matrix, that is a 3-by-3 skew-symmetric matrix (defined in Math.h). More...

bool yarp::math::crossProductMatrix (const yarp::sig::Vector &v, yarp::sig::Matrix &res)
Compute the cross product matrix, that is a 3-by-3 skew-symmetric matrix (defined in Math.h). More...

double yarp::math::norm (const yarp::sig::Vector &v)
Returns the Euclidean norm of the vector (defined in Math.h). More...

double yarp::math::norm2 (const yarp::sig::Vector &v)
Returns the Euclidean squared norm of the vector (defined in Math.h). More...

double yarp::math::findMax (const yarp::sig::Vector &v)
Returns the maximum of the elements of a real vector (defined in Math.h). More...

double yarp::math::findMin (const yarp::sig::Vector &v)
Returns the minimum of the elements of a real vector (defined in Math.h). More...

yarp::sig::Vector yarp::math::zeros (int s)
Creates a vector of zeros (defined in Math.h). More...

yarp::sig::Vector yarp::math::ones (int s)
Creates a vector of ones (defined in Math.h). More...

yarp::sig::Matrix yarp::math::eye (int r, int c)
Build an identity matrix (defined in Math.h). More...

yarp::sig::Matrix yarp::math::eye (int n)
Build a square identity matrix (defined in Math.h). More...

yarp::sig::Matrix yarp::math::zeros (int r, int c)
Build a matrix of zeros (defined in Math.h). More...

double yarp::math::det (const yarp::sig::Matrix &in)
Computes the determinant of a matrix (defined in Math.h). More...

yarp::sig::Matrix yarp::math::luinv (const yarp::sig::Matrix &in)
Invert a square matrix using LU-decomposition (defined in Math.h). More...

bool yarp::math::eigenValues (const yarp::sig::Matrix &in, yarp::sig::Vector &real, yarp::sig::Vector &img)
Computes eigenvalues of the n-by-n real nonsymmetric matrix (defined in Math.h). More...

double yarp::math::sign (const double &v)
Invert a symmetric and positive definite matrix using Cholesky decomposition (defined in Math.h). More...

yarp::sig::Vector yarp::math::sign (const yarp::sig::Vector &v)
Returns the sign vector of a real vector, that is a vector with 1 if the value is positive, -1 if negative, 0 if equal to zero (defined in Math.h). More...

yarp::sig::Vector yarp::math::dcm2axis (const yarp::sig::Matrix &R)
Converts a dcm (direction cosine matrix) rotation matrix R to axis/angle representation (defined in Math.h). More...

yarp::sig::Matrix yarp::math::axis2dcm (const yarp::sig::Vector &v)
Returns a dcm (direction cosine matrix) rotation matrix R from axis/angle representation (defined in Math.h). More...

yarp::sig::Vector yarp::math::dcm2euler (const yarp::sig::Matrix &R)
Converts a dcm (direction cosine matrix) rotation matrix to euler angles (ZYZ) (defined in Math.h). More...

yarp::sig::Matrix yarp::math::euler2dcm (const yarp::sig::Vector &euler)
Converts euler angles (ZYZ) vector in the corresponding dcm (direction cosine matrix) rotation matrix (defined in Math.h). More...

yarp::sig::Vector yarp::math::dcm2rpy (const yarp::sig::Matrix &R)
Converts a dcm (direction cosine matrix) rotation matrix to roll-pitch-yaw angles (defined in Math.h). More...

yarp::sig::Matrix yarp::math::rpy2dcm (const yarp::sig::Vector &rpy)
Converts roll-pitch-yaw angles in the corresponding dcm (direction cosine matrix) rotation matrix (defined in Math.h). More...

yarp::sig::Vector yarp::math::dcm2ypr (const yarp::sig::Matrix &R)
Converts a dcm (direction cosine matrix) rotation matrix to yaw-roll-pitch angles (defined in Math.h). More...

yarp::sig::Matrix yarp::math::ypr2dcm (const yarp::sig::Vector &ypr)
Converts yaw-pitch-roll angles in the corresponding dcm (direction cosine matrix) rotation matrix (defined in Math.h). More...

yarp::sig::Matrix yarp::math::SE3inv (const yarp::sig::Matrix &H)
Returns the inverse of a 4 by 4 rototranslational matrix (defined in Math.h). More...

Returns the adjoint matrix of a given roto-translational matrix (defined in Math.h). More...

Returns the inverse of the adjoint matrix of a given roto-translational matrix (defined in Math.h). More...

## ◆ operator*() [1/9]

 yarp::sig::Matrix operator* ( const double k, const yarp::sig::Matrix & M )

Scalar-matrix product operator (defined in Math.h).

Parameters
 k a scalar M a matrix
Returns
k*M

Definition at line 208 of file math.cpp.

## ◆ operator*() [2/9]

 yarp::math::Quaternion operator* ( const yarp::math::Quaternion & a, const yarp::math::Quaternion & b )

Quaternion-quaternion hamilton product operator (defined in Math.h).

reference: "Stevens, Brian L., Frank L. Lewis, Aircraft Control and Simulation, Wileyâ€“Interscience, 2nd Edition".

Parameters
 a a quaternion b a quaternion
Returns
a*b

Definition at line 242 of file math.cpp.

## ◆ operator*() [3/9]

 yarp::sig::Matrix operator* ( const yarp::sig::Matrix & a, const yarp::sig::Matrix & b )

Matrix-matrix product operator (defined in Math.h).

Parameters
 a a matrix b a matrix
Returns
a*b

Definition at line 187 of file math.cpp.

## ◆ operator*() [4/9]

 yarp::sig::Matrix operator* ( const yarp::sig::Matrix & M, const double k )

Matrix-scalar product operator (defined in Math.h).

Parameters
 M a matrix k a scalar
Returns
M*k

Definition at line 214 of file math.cpp.

## ◆ operator*() [5/9]

 yarp::sig::Vector operator* ( const yarp::sig::Matrix & m, const yarp::sig::Vector & a )

Matrix-vector product operator (defined in Math.h).

Parameters
 a is a vector (interpreted as a column) m is a matrix
Returns
m*a

Definition at line 177 of file math.cpp.

## ◆ operator*() [6/9]

 yarp::sig::Vector operator* ( const yarp::sig::Vector & a, const yarp::sig::Matrix & m )

Vector-matrix product operator (defined in Math.h).

Parameters
 a is a vector (interpreted as a row) m is a matrix
Returns
a*m

Definition at line 156 of file math.cpp.

## ◆ operator*() [7/9]

 yarp::sig::Vector operator* ( const yarp::sig::Vector & a, const yarp::sig::Vector & b )

Vector-vector element-wise product operator (defined in Math.h).

Parameters
 a a vector b a vector
Returns
a.*b (matlab notation)

Definition at line 227 of file math.cpp.

## ◆ operator*() [8/9]

 yarp::sig::Vector operator* ( const yarp::sig::Vector & b, double k )

Vector-scalar product operator (defined in Math.h).

Parameters
 b a vector k a scalar
Returns
b*k

Definition at line 142 of file math.cpp.

## ◆ operator*() [9/9]

 yarp::sig::Vector operator* ( double k, const yarp::sig::Vector & b )

Scalar-vector product operator (defined in Math.h).

Parameters
 k a scalar b vector
Returns
k*b

Definition at line 137 of file math.cpp.

## ◆ operator*=() [1/5]

 yarp::sig::Matrix& operator*= ( yarp::sig::Matrix & a, const yarp::sig::Matrix & b )

Matrix-matrix product operator (defined in Math.h).

Parameters
 a a matrix b a matrix
Returns
a*b

Definition at line 197 of file math.cpp.

## ◆ operator*=() [2/5]

 yarp::sig::Matrix& operator*= ( yarp::sig::Matrix & M, const double k )

Matrix-scalar product operator (defined in Math.h).

Parameters
 M a matrix k a scalar
Returns
M*k

Definition at line 219 of file math.cpp.

## ◆ operator*=() [3/5]

 yarp::sig::Vector& operator*= ( yarp::sig::Vector & a, const yarp::sig::Matrix & m )

Vector-matrix product operator (defined in Math.h).

Parameters
 a is a vector (interpreted as a row) m is a matrix
Returns
a*m

Definition at line 166 of file math.cpp.

## ◆ operator*=() [4/5]

 yarp::sig::Vector& operator*= ( yarp::sig::Vector & a, const yarp::sig::Vector & b )

Vector-vector element-wise product operator (defined in Math.h).

Parameters
 a a vector b a vector
Returns
a.*b (matlab notation)

Definition at line 233 of file math.cpp.

## ◆ operator*=() [5/5]

 yarp::sig::Vector& operator*= ( yarp::sig::Vector & b, double k )

Vector-scalar product operator (defined in Math.h).

Parameters
 b a vector k a scalar
Returns
b*k

Definition at line 148 of file math.cpp.

## ◆ operator+() [1/4]

 yarp::sig::Vector operator+ ( const double & s, const yarp::sig::Vector & a )

Addition operator between a scalar and a vector (defined in Math.h).

Sum the scalar to all the elements of the vector.

Definition at line 36 of file math.cpp.

## ◆ operator+() [2/4]

 yarp::sig::Matrix operator+ ( const yarp::sig::Matrix & a, const yarp::sig::Matrix & b )

Addition operator between matrices, returns a+b (defined in Math.h).

Definition at line 64 of file math.cpp.

## ◆ operator+() [3/4]

 yarp::sig::Vector operator+ ( const yarp::sig::Vector & a, const double & s )

Mathematical operations.

Addition operator between a scalar and a vector (defined in Math.h). Sum the scalar to all the elements of the vector.

Definition at line 30 of file math.cpp.

## ◆ operator+() [4/4]

 yarp::sig::Vector operator+ ( const yarp::sig::Vector & a, const yarp::sig::Vector & b )

Addition operator between vectors, returns a+b (defined in Math.h).

Definition at line 49 of file math.cpp.

## ◆ operator+=() [1/3]

 yarp::sig::Matrix& operator+= ( yarp::sig::Matrix & a, const yarp::sig::Matrix & b )

Addition operator between matrices, returns a+b (defined in Math.h).

Definition at line 70 of file math.cpp.

## ◆ operator+=() [2/3]

 yarp::sig::Vector& operator+= ( yarp::sig::Vector & a, const double & s )

Addition operator between a scalar and a vector (defined in Math.h).

Sum the scalar to all the elements of the vector.

Definition at line 41 of file math.cpp.

## ◆ operator+=() [3/3]

 yarp::sig::Vector& operator+= ( yarp::sig::Vector & a, const yarp::sig::Vector & b )

Addition operator between vectors, returns a+b (defined in Math.h).

Definition at line 55 of file math.cpp.

## ◆ operator-() [1/4]

 yarp::sig::Vector operator- ( const double & s, const yarp::sig::Vector & a )

Subtraction operator between a scalar and a vector (defined in Math.h).

Multiply the vector by -1 and sum the scalar to the result.

Definition at line 87 of file math.cpp.

## ◆ operator-() [2/4]

 yarp::sig::Matrix operator- ( const yarp::sig::Matrix & a, const yarp::sig::Matrix & b )

Subtraction operator between matrices, returns a-b (defined in Math.h).

Definition at line 119 of file math.cpp.

## ◆ operator-() [3/4]

 yarp::sig::Vector operator- ( const yarp::sig::Vector & a, const double & s )

Subtraction operator between a vector and a scalar (defined in Math.h).

Subtract the scalar to all the elements of the vector.

Definition at line 81 of file math.cpp.

## ◆ operator-() [4/4]

 yarp::sig::Vector operator- ( const yarp::sig::Vector & a, const yarp::sig::Vector & b )

Subtraction operator between vectors, returns a-b (defined in Math.h).

Definition at line 104 of file math.cpp.

## ◆ operator-=() [1/3]

 yarp::sig::Matrix& operator-= ( yarp::sig::Matrix & a, const yarp::sig::Matrix & b )

Subtraction operator between matrices, returns a-b (defined in Math.h).

Definition at line 125 of file math.cpp.

## ◆ operator-=() [2/3]

 yarp::sig::Vector& operator-= ( yarp::sig::Vector & a, const double & s )

Subtraction operator between a vector and a scalar (defined in Math.h).

Subtract the scalar to all the elements of the vector.

Definition at line 96 of file math.cpp.

## ◆ operator-=() [3/3]

 yarp::sig::Vector& operator-= ( yarp::sig::Vector & a, const yarp::sig::Vector & b )

Subtraction operator between vectors, returns a-b (defined in Math.h).

Definition at line 110 of file math.cpp.

## ◆ operator/() [1/3]

 yarp::sig::Matrix operator/ ( const yarp::sig::Matrix & M, double k )

Matrix-scalar division operator (defined in Math.h).

Parameters
 M a matrix k a scalar
Returns
M./k (matlab notation)

Definition at line 280 of file math.cpp.

## ◆ operator/() [2/3]

 yarp::sig::Vector operator/ ( const yarp::sig::Vector & a, const yarp::sig::Vector & b )

Vector-vector element-wise division operator (defined in Math.h).

Parameters
 a a vector b a vector
Returns
a./b (matlab notation)

Definition at line 250 of file math.cpp.

## ◆ operator/() [3/3]

 yarp::sig::Vector operator/ ( const yarp::sig::Vector & b, double k )

Vector-scalar division operator (defined in Math.h).

Parameters
 b a vector k a scalar
Returns
b/k

Definition at line 265 of file math.cpp.

## ◆ operator/=() [1/3]

 yarp::sig::Matrix& operator/= ( yarp::sig::Matrix & M, double k )

Matrix-scalar division operator (defined in Math.h).

Parameters
 M a matrix k a scalar
Returns
M./k (matlab notation)

Definition at line 286 of file math.cpp.

## ◆ operator/=() [2/3]

 yarp::sig::Vector& operator/= ( yarp::sig::Vector & a, const yarp::sig::Vector & b )

Vector-vector element-wise division operator (defined in Math.h).

Parameters
 a a vector b a vector
Returns
a./b (matlab notation)

Definition at line 256 of file math.cpp.

## ◆ operator/=() [3/3]

 yarp::sig::Vector& operator/= ( yarp::sig::Vector & b, double k )

Vector-scalar division operator (defined in Math.h).

Parameters
 b a vector k a scalar
Returns
b/k

Definition at line 271 of file math.cpp.