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 215 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 194 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 221 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 184 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 252 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 163 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 236 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 148 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 143 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 204 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 226 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 173 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 242 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 154 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 33 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 63 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 27 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 47 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 69 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 38 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 53 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 88 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 123 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 82 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 107 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 129 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 98 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 113 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 292 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 260 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 276 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 298 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 266 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 282 of file math.cpp.