YARP
Yet Another Robot Platform
Math.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_MATH_MATH_H
11 #define YARP_MATH_MATH_H
12 
13 #include <yarp/sig/Vector.h>
14 #include <yarp/sig/Matrix.h>
15 #include <yarp/math/api.h>
16 #include <yarp/math/Quaternion.h>
17 
27 
33 
39 
44 
49 
54 
59 
65 
71 
77 
82 
87 
92 
97 
105 
113 
121 
129  const yarp::sig::Matrix &m);
130 
138 
146  const yarp::sig::Vector &a);
147 
155 
163 
171 
179 
187 
195 
203 
212 
220 
228 
236 
244 
252 
260 
261 
262 namespace yarp
263 {
264  namespace math
265  {
273 
281 
289 
297 
305 
313 
321 
329 
337 
345 
352  YARP_math_API yarp::sig::Vector cat(double s1, double s2);
353 
354  YARP_math_API yarp::sig::Vector cat(double s1, double s2, double s3);
355 
356  YARP_math_API yarp::sig::Vector cat(double s1, double s2, double s3, double s4);
357 
358  YARP_math_API yarp::sig::Vector cat(double s1, double s2, double s3, double s4, double s5);
359 
364  YARP_math_API double dot(const yarp::sig::Vector &a, const yarp::sig::Vector &b);
365 
371 
379 
386 
394 
400  YARP_math_API double norm(const yarp::sig::Vector &v);
401 
407  YARP_math_API double norm2(const yarp::sig::Vector &v);
408 
414  YARP_math_API double findMax(const yarp::sig::Vector &v);
415 
421  YARP_math_API double findMin(const yarp::sig::Vector &v);
422 
429 
436 
443  YARP_math_API yarp::sig::Matrix eye(int r, int c);
444 
451 
457  YARP_math_API yarp::sig::Matrix zeros(int r, int c);
458 
463  YARP_math_API double det(const yarp::sig::Matrix& in);
464 
471 
480 
486  //YARP_math_API yarp::sig::Matrix chinv(const yarp::sig::Matrix& in);
487 
494  YARP_math_API double sign(const double &v);
495 
504 
512 
521 
533 
548 
560 
576 
588 
604 
613 
622 
632  }
633 }
634 
635 #endif // YARP_MATH_MATH_H
yarp::math::outerProduct
yarp::sig::Matrix outerProduct(const yarp::sig::Vector &a, const yarp::sig::Vector &b)
Outer product between vectors (defined in Math.h).
Definition: math.cpp:469
Vector.h
contains the definition of a Vector type
operator/=
yarp::sig::Vector & operator/=(yarp::sig::Vector &a, const yarp::sig::Vector &b)
Vector-vector element-wise division operator (defined in Math.h).
Definition: math.cpp:256
yarp::math::zeros
yarp::sig::Vector zeros(int s)
Creates a vector of zeros (defined in Math.h).
Definition: math.cpp:552
yarp::math::dcm2rpy
yarp::sig::Vector dcm2rpy(const yarp::sig::Matrix &R)
Converts a dcm (direction cosine matrix) rotation matrix to roll-pitch-yaw angles (defined in Math....
Definition: math.cpp:780
yarp::math::eye
yarp::sig::Matrix eye(int r, int c)
Build an identity matrix (defined in Math.h).
Definition: math.cpp:562
operator+=
yarp::sig::Vector & operator+=(yarp::sig::Vector &a, const double &s)
Addition operator between a scalar and a vector (defined in Math.h).
Definition: math.cpp:41
yarp::math::cat
yarp::sig::Matrix cat(const yarp::sig::Matrix &m1, const yarp::sig::Matrix &m2)
Matrix-Matrix concatenation by row (defined in Math.h).
Definition: math.cpp:349
Matrix.h
contains the definition of a Matrix type
yarp::math::ones
yarp::sig::Vector ones(int s)
Creates a vector of ones (defined in Math.h).
Definition: math.cpp:557
yarp::math::findMin
double findMin(const yarp::sig::Vector &v)
Returns the minimum of the elements of a real vector (defined in Math.h).
Definition: math.cpp:541
yarp::math::norm
double norm(const yarp::sig::Vector &v)
Returns the Euclidean norm of the vector (defined in Math.h).
Definition: math.cpp:520
operator-
yarp::sig::Vector operator-(const yarp::sig::Vector &a, const double &s)
Subtraction operator between a vector and a scalar (defined in Math.h).
Definition: math.cpp:81
yarp::math::luinv
yarp::sig::Matrix luinv(const yarp::sig::Matrix &in)
Invert a square matrix using LU-decomposition (defined in Math.h).
Definition: math.cpp:588
operator-=
yarp::sig::Vector & operator-=(yarp::sig::Vector &a, const double &s)
Subtraction operator between a vector and a scalar (defined in Math.h).
Definition: math.cpp:96
Quaternion.h
yarp::math::norm2
double norm2(const yarp::sig::Vector &v)
Returns the Euclidean squared norm of the vector (defined in Math.h).
Definition: math.cpp:525
yarp::math::rpy2dcm
yarp::sig::Matrix rpy2dcm(const yarp::sig::Vector &rpy)
Converts roll-pitch-yaw angles in the corresponding dcm (direction cosine matrix) rotation matrix (de...
Definition: math.cpp:818
yarp::math::ypr2dcm
yarp::sig::Matrix ypr2dcm(const yarp::sig::Vector &ypr)
Converts yaw-pitch-roll angles in the corresponding dcm (direction cosine matrix) rotation matrix (de...
Definition: math.cpp:867
yarp::math::dot
double dot(const yarp::sig::Vector &a, const yarp::sig::Vector &b)
Scalar product between vectors (defined in Math.h).
Definition: math.cpp:461
yarp::sig::VectorOf
Provides:
Definition: Vector.h:122
yarp::math::pile
yarp::sig::Matrix pile(const yarp::sig::Matrix &m1, const yarp::sig::Matrix &m2)
Matrix-Matrix concatenation by column (defined in Math.h).
Definition: math.cpp:297
yarp::math::sign
double sign(const double &v)
Invert a symmetric and positive definite matrix using Cholesky decomposition (defined in Math....
Definition: math.cpp:632
yarp::math::cross
yarp::sig::Vector cross(const yarp::sig::Vector &a, const yarp::sig::Vector &b)
Compute the cross product between two vectors (defined in Math.h).
Definition: math.cpp:480
yarp::math::Quaternion
Definition: Quaternion.h:27
yarp::math::det
double det(const yarp::sig::Matrix &in)
Computes the determinant of a matrix (defined in Math.h).
Definition: math.cpp:583
yarp::math::adjointInv
yarp::sig::Matrix adjointInv(const yarp::sig::Matrix &H)
Returns the inverse of the adjoint matrix of a given roto-translational matrix (defined in Math....
Definition: math.cpp:930
yarp::math::axis2dcm
yarp::sig::Matrix axis2dcm(const yarp::sig::Vector &v)
Returns a dcm (direction cosine matrix) rotation matrix R from axis/angle representation (defined in ...
Definition: math.cpp:689
operator+
yarp::sig::Vector operator+(const yarp::sig::Vector &a, const double &s)
Mathematical operations.
Definition: math.cpp:30
yarp::math::dcm2euler
yarp::sig::Vector dcm2euler(const yarp::sig::Matrix &R)
Converts a dcm (direction cosine matrix) rotation matrix to euler angles (ZYZ) (defined in Math....
Definition: math.cpp:726
yarp::math::adjoint
yarp::sig::Matrix adjoint(const yarp::sig::Matrix &H)
Returns the adjoint matrix of a given roto-translational matrix (defined in Math.h).
Definition: math.cpp:904
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
YARP_math_API
#define YARP_math_API
Definition: api.h:18
yarp::math::euler2dcm
yarp::sig::Matrix euler2dcm(const yarp::sig::Vector &euler)
Converts euler angles (ZYZ) vector in the corresponding dcm (direction cosine matrix) rotation matrix...
Definition: math.cpp:764
operator/
yarp::sig::Vector operator/(const yarp::sig::Vector &a, const yarp::sig::Vector &b)
Vector-vector element-wise division operator (defined in Math.h).
Definition: math.cpp:250
operator*=
yarp::sig::Vector & operator*=(yarp::sig::Vector &b, double k)
Vector-scalar product operator (defined in Math.h).
Definition: math.cpp:148
yarp::math::crossProductMatrix
yarp::sig::Matrix crossProductMatrix(const yarp::sig::Vector &v)
Compute the cross product matrix, that is a 3-by-3 skew-symmetric matrix (defined in Math....
Definition: math.cpp:491
yarp::math::dcm2axis
yarp::sig::Vector dcm2axis(const yarp::sig::Matrix &R)
Converts a dcm (direction cosine matrix) rotation matrix R to axis/angle representation (defined in M...
Definition: math.cpp:647
yarp::math::dcm2ypr
yarp::sig::Vector dcm2ypr(const yarp::sig::Matrix &R)
Converts a dcm (direction cosine matrix) rotation matrix to yaw-roll-pitch angles (defined in Math....
Definition: math.cpp:834
operator*
yarp::sig::Vector operator*(double k, const yarp::sig::Vector &b)
Scalar-vector product operator (defined in Math.h).
Definition: math.cpp:137
yarp::math::eigenValues
bool 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).
Definition: math.cpp:600
yarp::math::SE3inv
yarp::sig::Matrix SE3inv(const yarp::sig::Matrix &H)
Returns the inverse of a 4 by 4 rototranslational matrix (defined in Math.h).
Definition: math.cpp:883
api.h
yarp::math::findMax
double findMax(const yarp::sig::Vector &v)
Returns the maximum of the elements of a real vector (defined in Math.h).
Definition: math.cpp:530
yarp::sig::Matrix
A class for a Matrix.
Definition: Matrix.h:46