YARP
Yet Another Robot Platform
math.cpp File Reference
#include <yarp/os/LogComponent.h>
#include <yarp/math/Math.h>
#include <yarp/math/SVD.h>
#include <yarp/math/Quaternion.h>
#include <yarp/eigen/Eigen.h>
#include <Eigen/Eigenvalues>
#include <cmath>
#include <cassert>
+ Include dependency graph for math.cpp:

Go to the source code of this file.

Functions

Vector operator+ (const Vector &a, const double &s)
 Mathematical operations. More...
 
Vector operator+ (const double &s, const Vector &a)
 Addition operator between a scalar and a vector (defined in Math.h). More...
 
Vectoroperator+= (Vector &a, const double &s)
 Addition operator between a scalar and a vector (defined in Math.h). More...
 
Vector operator+ (const Vector &a, const Vector &b)
 Addition operator between vectors, returns a+b (defined in Math.h). More...
 
Vectoroperator+= (Vector &a, const Vector &b)
 Addition operator between vectors, returns a+b (defined in Math.h). More...
 
Matrix operator+ (const Matrix &a, const Matrix &b)
 Addition operator between matrices, returns a+b (defined in Math.h). More...
 
Matrixoperator+= (Matrix &a, const Matrix &b)
 Addition operator between matrices, returns a+b (defined in Math.h). More...
 
Vector operator- (const Vector &a, const double &s)
 Subtraction operator between a vector and a scalar (defined in Math.h). More...
 
Vector operator- (const double &s, const Vector &a)
 Subtraction operator between a scalar and a vector (defined in Math.h). More...
 
Vectoroperator-= (Vector &a, const double &s)
 Subtraction operator between a vector and a scalar (defined in Math.h). More...
 
Vector operator- (const Vector &a, const Vector &b)
 Subtraction operator between vectors, returns a-b (defined in Math.h). More...
 
Vectoroperator-= (Vector &a, const Vector &b)
 Subtraction operator between vectors, returns a-b (defined in Math.h). More...
 
Matrix operator- (const Matrix &a, const Matrix &b)
 Subtraction operator between matrices, returns a-b (defined in Math.h). More...
 
Matrixoperator-= (Matrix &a, const Matrix &b)
 Subtraction operator between matrices, returns a-b (defined in Math.h). More...
 
Vector operator* (double k, const Vector &b)
 Scalar-vector product operator (defined in Math.h). More...
 
Vector operator* (const Vector &a, double k)
 Vector-scalar product operator (defined in Math.h). More...
 
Vectoroperator*= (Vector &a, double k)
 Vector-scalar product operator (defined in Math.h). More...
 
Vector operator* (const Vector &a, const Matrix &m)
 Vector-matrix product operator (defined in Math.h). More...
 
Vectoroperator*= (Vector &a, const Matrix &m)
 Vector-matrix product operator (defined in Math.h). More...
 
Vector operator* (const Matrix &m, const Vector &a)
 Matrix-vector product operator (defined in Math.h). More...
 
Matrix operator* (const Matrix &a, const Matrix &b)
 Matrix-matrix product operator (defined in Math.h). More...
 
Matrixoperator*= (Matrix &a, const Matrix &b)
 Matrix-matrix product operator (defined in Math.h). More...
 
Matrix operator* (const double k, const Matrix &M)
 Scalar-matrix product operator (defined in Math.h). More...
 
Matrix operator* (const Matrix &M, const double k)
 Matrix-scalar product operator (defined in Math.h). More...
 
Matrixoperator*= (Matrix &M, const double k)
 Matrix-scalar product operator (defined in Math.h). More...
 
Vector operator* (const Vector &a, const Vector &b)
 Vector-vector element-wise product operator (defined in Math.h). More...
 
Vectoroperator*= (Vector &a, const Vector &b)
 Vector-vector element-wise product operator (defined in Math.h). More...
 
Quaternion operator* (const Quaternion &a, const Quaternion &b)
 Quaternion-quaternion hamilton product operator (defined in Math.h). More...
 
Vector operator/ (const Vector &a, const Vector &b)
 Vector-vector element-wise division operator (defined in Math.h). More...
 
Vectoroperator/= (Vector &a, const Vector &b)
 Vector-vector element-wise division operator (defined in Math.h). More...
 
Vector operator/ (const Vector &b, double k)
 Vector-scalar division operator (defined in Math.h). More...
 
Vectoroperator/= (Vector &b, double k)
 Vector-scalar division operator (defined in Math.h). More...
 
Matrix operator/ (const Matrix &M, const double k)
 Matrix-scalar division operator (defined in Math.h). More...
 
Matrixoperator/= (Matrix &M, const double k)
 Matrix-scalar division operator (defined in Math.h). More...
 

Function Documentation

◆ operator*() [1/9]

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

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

Parameters
ka scalar
Ma matrix
Returns
k*M

Definition at line 208 of file math.cpp.

◆ operator*() [2/9]

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

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

Parameters
aa matrix
ba matrix
Returns
a*b

Definition at line 187 of file math.cpp.

◆ operator*() [3/9]

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

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

Parameters
Ma matrix
ka scalar
Returns
M*k

Definition at line 214 of file math.cpp.

◆ operator*() [4/9]

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

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

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

Definition at line 177 of file math.cpp.

◆ operator*() [5/9]

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
aa quaternion
ba quaternion
Returns
a*b

Definition at line 242 of file math.cpp.

◆ operator*() [6/9]

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

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

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

Definition at line 156 of file math.cpp.

◆ operator*() [7/9]

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

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

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

Definition at line 227 of file math.cpp.

◆ operator*() [8/9]

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

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

Parameters
ba vector
ka scalar
Returns
b*k

Definition at line 142 of file math.cpp.

◆ operator*() [9/9]

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

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

Parameters
ka scalar
bvector
Returns
k*b

Definition at line 137 of file math.cpp.

◆ operator*=() [1/5]

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

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

Parameters
aa matrix
ba matrix
Returns
a*b

Definition at line 197 of file math.cpp.

◆ operator*=() [2/5]

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

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

Parameters
Ma matrix
ka scalar
Returns
M*k

Definition at line 219 of file math.cpp.

◆ operator*=() [3/5]

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

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

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

Definition at line 166 of file math.cpp.

◆ operator*=() [4/5]

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

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

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

Definition at line 233 of file math.cpp.

◆ operator*=() [5/5]

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

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

Parameters
ba vector
ka scalar
Returns
b*k

Definition at line 148 of file math.cpp.

◆ operator+() [1/4]

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]

Matrix operator+ ( const Matrix a,
const Matrix b 
)

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

Definition at line 64 of file math.cpp.

◆ operator+() [3/4]

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]

Vector operator+ ( const Vector a,
const Vector b 
)

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

Definition at line 49 of file math.cpp.

◆ operator+=() [1/3]

Matrix& operator+= ( Matrix a,
const Matrix b 
)

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

Definition at line 70 of file math.cpp.

◆ operator+=() [2/3]

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]

Vector& operator+= ( Vector a,
const Vector b 
)

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

Definition at line 55 of file math.cpp.

◆ operator-() [1/4]

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]

Matrix operator- ( const Matrix a,
const Matrix b 
)

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

Definition at line 119 of file math.cpp.

◆ operator-() [3/4]

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]

Vector operator- ( const Vector a,
const Vector b 
)

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

Definition at line 104 of file math.cpp.

◆ operator-=() [1/3]

Matrix& operator-= ( Matrix a,
const Matrix b 
)

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

Definition at line 125 of file math.cpp.

◆ operator-=() [2/3]

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]

Vector& operator-= ( Vector a,
const Vector b 
)

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

Definition at line 110 of file math.cpp.

◆ operator/() [1/3]

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

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

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

Definition at line 280 of file math.cpp.

◆ operator/() [2/3]

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

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

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

Definition at line 250 of file math.cpp.

◆ operator/() [3/3]

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

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

Parameters
ba vector
ka scalar
Returns
b/k

Definition at line 265 of file math.cpp.

◆ operator/=() [1/3]

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

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

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

Definition at line 286 of file math.cpp.

◆ operator/=() [2/3]

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

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

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

Definition at line 256 of file math.cpp.

◆ operator/=() [3/3]

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

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

Parameters
ba vector
ka scalar
Returns
b/k

Definition at line 271 of file math.cpp.