Main MRPT website > C++ reference for MRPT 1.4.0
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
mrpt::math Namespace Reference

Detailed Description

This base provides a set of functions for maths stuff.

Namespaces

 detail
 
 jacobians
 A collection of functions to compute jacobians of diverse transformations, etc (some functions are redirections to existing methods elsewhere, so this namespace is actually used with grouping purposes).
 

Classes

class  CArray
 A STL container (as wrapper) for arrays of constant size defined at compile time - Users will most likely prefer to use CArrayPOD and its derived classes instead. More...
 
class  CArray< T, 0 >
 
class  CArrayDouble
 A partial specialization of CArrayNumeric for double numbers. More...
 
class  CArrayFloat
 A partial specialization of CArrayNumeric for float numbers. More...
 
class  CArrayInt
 A partial specialization of CArrayNumeric for int numbers. More...
 
class  CArrayNumeric
 CArrayNumeric is an array for numeric types supporting several mathematical operations (actually, just a wrapper on Eigen::Matrix<T,N,1>) More...
 
class  CArrayUInt
 A partial specialization of CArrayNumeric for unsigned int numbers. More...
 
class  CBinaryRelation
 This class models a binary relation through the elements of any given set. More...
 
class  CConstMatrixColumnAccessor
 A vector-like wrapper for a const Matrix for accessing the elements of a given column with a [] operator. More...
 
class  CConstMatrixColumnAccessorExtended
 A vector-like wrapper for a const Matrix for accessing the elements of a given column with a [] operator, with offset and custom spacing. More...
 
class  CConstMatrixRowAccessor
 A vector-like wrapper for a const Matrix for accessing the elements of a given row with a [] operator. More...
 
class  CConstMatrixRowAccessorExtended
 A vector-like wrapper for a const Matrix for accessing the elements of a given row with a [] operator, with offset and custom spacing. More...
 
class  CExceptionNotDefPos
 Used in mrpt::math::CSparseMatrix. More...
 
class  CHistogram
 This class provides an easy way of computing histograms for unidimensional real valued variables. More...
 
class  CLevenbergMarquardtTempl
 An implementation of the Levenberg-Marquardt algorithm for least-square minimization. More...
 
class  CMatrix
 This class is a "CSerializable" wrapper for "CMatrixFloat". More...
 
class  CMatrixB
 This class is a "CSerializable" wrapper for "CMatrixBool". More...
 
class  CMatrixBool
 Declares a matrix of booleans (non serializable). More...
 
class  CMatrixColumnAccessor
 A vector-like wrapper for a Matrix for accessing the elements of a given column with a [] operator. More...
 
class  CMatrixColumnAccessorExtended
 A vector-like wrapper for a Matrix for accessing the elements of a given column with a [] operator, with offset and custom spacing. More...
 
class  CMatrixD
 This class is a "CSerializable" wrapper for "CMatrixTemplateNumeric<double>". More...
 
class  CMatrixFixedNumeric
 A numeric matrix of compile-time fixed size. More...
 
class  CMatrixRowAccessor
 A vector-like wrapper for a Matrix for accessing the elements of a given row with a [] operator. More...
 
class  CMatrixRowAccessorExtended
 A vector-like wrapper for a Matrix for accessing the elements of a given row with a [] operator, with offset and custom spacing. More...
 
class  CMatrixTemplate
 This template class provides the basic functionality for a general 2D any-size, resizable container of numerical or non-numerical elements. More...
 
class  CMatrixTemplateNumeric
 A matrix of dynamic size. More...
 
class  CMatrixTemplateObjects
 This template class extends the class "CMatrixTemplate" for storing "objects" at each matrix entry. More...
 
struct  CMatrixTemplateSize
 Auxiliary class used in CMatrixTemplate:size(), CMatrixTemplate::resize(), CMatrixFixedNumeric::size(), CMatrixFixedNumeric::resize(), to mimic the behavior of STL-containers. More...
 
class  CMonteCarlo
 Montecarlo simulation for experiments in 1D. More...
 
struct  ContainerType
 ContainerType<T>::element_t exposes the value of any STL or Eigen container. More...
 
struct  ContainerType< Eigen::EigenBase< Derived > >
 Specialization for Eigen containers. More...
 
class  CPolygon
 A wrapper of a TPolygon2D class, implementing CSerializable. More...
 
class  CQuaternion
 A quaternion, which can represent a 3D rotation as pair $ (r,\mathbf{u}) $, with a real part "r" and a 3D vector $ \mathbf{u} = (x,y,z) $, or alternatively, q = r + ix + jy + kz. More...
 
class  CSparseMatrix
 A sparse matrix structure, wrapping T. More...
 
class  CSparseMatrixTemplate
 A sparse matrix container (with cells of any type), with iterators. More...
 
class  CSparseSymmetricalMatrix
 A sparse matrix container for square symmetrical content around the main diagonal. More...
 
class  CSplineInterpolator1D
 A (persistent) sequence of (x,y) coordinates, allowing queries of intermediate points through spline interpolation, where possible. More...
 
class  dynamic_vector
 Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction. More...
 
class  KDTreeCapable
 A generic adaptor class for providing Nearest Neighbor (NN) lookup via the nanoflann library. More...
 
struct  MatrixBlockSparseCols
 A templated column-indexed efficient storage of block-sparse Jacobian or Hessian matrices, together with other arbitrary information. More...
 
class  ModelSearch
 Model search implementations: RANSAC and genetic algorithm. More...
 
class  RANSAC_Template
 A generic RANSAC implementation with models as matrices. More...
 
struct  RobustKernel
 
struct  RobustKernel< rkLeastSquares, T >
 No robust kernel, use standard least squares: rho(r) = r^2. More...
 
struct  RobustKernel< rkPseudoHuber, T >
 Pseudo-huber robust kernel: rho(r) = 2 * delta^2 * ( -1+sqrt( 1+ r^2/delta^2 ) ) More...
 
struct  TLine2D
 2D line without bounds, represented by its equation $Ax+By+C=0$. More...
 
struct  TLine3D
 3D line, represented by a base point and a director vector. More...
 
struct  TObject2D
 Standard type for storing any lightweight 2D type. More...
 
struct  TObject3D
 Standard object for storing any 3D lightweight object. More...
 
struct  TPlane
 3D Plane, represented by its equation $Ax+By+Cz+D=0$ More...
 
struct  TPoint2D
 Lightweight 2D point. More...
 
struct  TPoint3D
 Lightweight 3D point. More...
 
struct  TPoint3Df
 Lightweight 3D point (float version). More...
 
struct  TPointXYZfIu8
 XYZ point (float) + Intensity(u8) More...
 
struct  TPointXYZfRGBu8
 XYZ point (float) + RGB(u8) More...
 
struct  TPointXYZIu8
 XYZ point (double) + Intensity(u8) More...
 
struct  TPointXYZRGBu8
 XYZ point (double) + RGB(u8) More...
 
class  TPolygon2D
 2D polygon, inheriting from std::vector<TPoint2D>. More...
 
class  TPolygon3D
 3D polygon, inheriting from std::vector<TPoint3D> More...
 
class  TPolygonWithPlane
 Slightly heavyweight type to speed-up calculations with polygons in 3D. More...
 
struct  TPose2D
 Lightweight 2D pose. More...
 
struct  TPose3D
 Lightweight 3D pose (three spatial coordinates, plus three angular coordinates). More...
 
struct  TPose3DQuat
 Lightweight 3D pose (three spatial coordinates, plus a quaternion ). More...
 
struct  TSegment2D
 2D segment, consisting of two points. More...
 
struct  TSegment3D
 3D segment, consisting of two points. More...
 

Typedefs

typedef CLevenbergMarquardtTempl< mrpt::math::CVectorDoubleCLevenbergMarquardt
 The default name for the LM class is an instantiation for "double". More...
 
typedef CMatrixTemplateNumeric< float > CMatrixFloat
 Declares a matrix of float numbers (non serializable). More...
 
typedef CMatrixTemplateNumeric< double > CMatrixDouble
 Declares a matrix of double numbers (non serializable). More...
 
typedef CMatrixTemplateNumeric< unsigned int > CMatrixUInt
 Declares a matrix of unsigned ints (non serializable). More...
 
typedef CMatrixTemplateNumeric< double > CMatrixLongDouble
 Declares a matrix of "long doubles" (non serializable), or of "doubles" if the compiler does not support "long double". More...
 
typedef CQuaternion< double > CQuaternionDouble
 A quaternion of data type "double". More...
 
typedef CQuaternion< float > CQuaternionFloat
 A quaternion of data type "float". More...
 
typedef dynamic_vector< float > CVectorFloat
 Column vector, like Eigen::MatrixXf, but automatically initialized to zeros since construction. More...
 
typedef dynamic_vector< double > CVectorDouble
 Column vector, like Eigen::MatrixXd, but automatically initialized to zeros since construction. More...
 
typedef TPlane TPlane3D
 
typedef RANSAC_Template< double > RANSAC
 The default instance of RANSAC, for double type. More...
 

Enumerations

enum  TConstructorFlags_Quaternions { UNINITIALIZED_QUATERNION = 0 }
 
enum  TMatrixTextFileFormat { MATRIX_FORMAT_ENG = 0, MATRIX_FORMAT_FIXED = 1, MATRIX_FORMAT_INT = 2 }
 
enum  TConstructorFlags_Matrices { UNINITIALIZED_MATRIX = 0 }
 For usage in one of the constructors of CMatrixFixedNumeric or CMatrixTemplate (and derived classes), if it's not required to fill it with zeros at the constructor to save time. More...
 
enum  TRobustKernelType { rkLeastSquares = 0, rkPseudoHuber }
 The different types of kernels for usage within a robustified least-squares estimator. More...
 

Functions

template<class T , std::size_t N>
bool operator== (const CArray< T, N > &x, const CArray< T, N > &y)
 
template<class T , std::size_t N>
bool operator< (const CArray< T, N > &x, const CArray< T, N > &y)
 
template<class T , std::size_t N>
bool operator!= (const CArray< T, N > &x, const CArray< T, N > &y)
 
template<class T , std::size_t N>
bool operator> (const CArray< T, N > &x, const CArray< T, N > &y)
 
template<class T , std::size_t N>
bool operator<= (const CArray< T, N > &x, const CArray< T, N > &y)
 
template<class T , std::size_t N>
bool operator>= (const CArray< T, N > &x, const CArray< T, N > &y)
 
BASE_IMPEXP ::mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, CMatrixPtr &pObj)
 
BASE_IMPEXP ::mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, CMatrixBPtr &pObj)
 
BASE_IMPEXP ::mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, CMatrixDPtr &pObj)
 
BASE_IMPEXP ::mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, CPolygonPtr &pObj)
 
BASE_IMPEXP ::mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, CSplineInterpolator1DPtr &pObj)
 
double BASE_IMPEXP normalPDF (double x, double mu, double std)
 Evaluates the univariate normal (Gaussian) distribution at a given point "x". More...
 
template<class VECTORLIKE1 , class VECTORLIKE2 , class MATRIXLIKE >
MATRIXLIKE::Scalar normalPDFInf (const VECTORLIKE1 &x, const VECTORLIKE2 &mu, const MATRIXLIKE &cov_inv, const bool scaled_pdf=false)
 Evaluates the multivariate normal (Gaussian) distribution at a given point "x". More...
 
template<class VECTORLIKE1 , class VECTORLIKE2 , class MATRIXLIKE >
MATRIXLIKE::Scalar normalPDF (const VECTORLIKE1 &x, const VECTORLIKE2 &mu, const MATRIXLIKE &cov, const bool scaled_pdf=false)
 Evaluates the multivariate normal (Gaussian) distribution at a given point "x". More...
 
template<typename VECTORLIKE , typename MATRIXLIKE >
MATRIXLIKE::Scalar normalPDF (const VECTORLIKE &d, const MATRIXLIKE &cov)
 Evaluates the multivariate normal (Gaussian) distribution at a given point given its distance vector "d" from the Gaussian mean. More...
 
template<typename VECTORLIKE1 , typename MATRIXLIKE1 , typename VECTORLIKE2 , typename MATRIXLIKE2 >
double KLD_Gaussians (const VECTORLIKE1 &mu0, const MATRIXLIKE1 &cov0, const VECTORLIKE2 &mu1, const MATRIXLIKE2 &cov1)
 Kullback-Leibler divergence (KLD) between two independent multivariate Gaussians. More...
 
double BASE_IMPEXP erfc (const double x)
 The complementary error function of a Normal distribution. More...
 
double BASE_IMPEXP erf (const double x)
 The error function of a Normal distribution. More...
 
double BASE_IMPEXP normalQuantile (double p)
 Evaluates the Gaussian distribution quantile for the probability value p=[0,1]. More...
 
double BASE_IMPEXP normalCDF (double p)
 Evaluates the Gaussian cumulative density function. More...
 
double BASE_IMPEXP chi2inv (double P, unsigned int dim=1)
 The "quantile" of the Chi-Square distribution, for dimension "dim" and probability 0<P<1 (the inverse of chi2CDF) An aproximation from the Wilson-Hilferty transformation is used. More...
 
double BASE_IMPEXP noncentralChi2CDF (unsigned int degreesOfFreedom, double noncentrality, double arg)
 
double BASE_IMPEXP chi2CDF (unsigned int degreesOfFreedom, double arg)
 
double BASE_IMPEXP chi2PDF (unsigned int degreesOfFreedom, double arg, double accuracy=1e-7)
 
std::pair< double, double > BASE_IMPEXP noncentralChi2PDF_CDF (unsigned int degreesOfFreedom, double noncentrality, double arg, double eps=1e-7)
 Returns the 'exact' PDF (first) and CDF (second) of a Non-central chi-squared probability distribution, using an iterative method. More...
 
template<typename CONTAINER >
void confidenceIntervals (const CONTAINER &data, typename mrpt::math::ContainerType< CONTAINER >::element_t &out_mean, typename mrpt::math::ContainerType< CONTAINER >::element_t &out_lower_conf_interval, typename mrpt::math::ContainerType< CONTAINER >::element_t &out_upper_conf_interval, const double confidenceInterval=0.1, const size_t histogramNumBins=1000)
 Return the mean and the 10%-90% confidence points (or with any other confidence value) of a set of samples by building the cummulative CDF of all the elements of the container. More...
 
void BASE_IMPEXP fft_real (CVectorFloat &in_realData, CVectorFloat &out_FFT_Re, CVectorFloat &out_FFT_Im, CVectorFloat &out_FFT_Mag)
 Computes the FFT of a 2^N-size vector of real numbers, and returns the Re+Im+Magnitude parts. More...
 
void BASE_IMPEXP dft2_real (const CMatrixFloat &in_data, CMatrixFloat &out_real, CMatrixFloat &out_imag)
 Compute the 2D Discrete Fourier Transform (DFT) of a real matrix, returning the real and imaginary parts separately. More...
 
void BASE_IMPEXP idft2_real (const CMatrixFloat &in_real, const CMatrixFloat &in_imag, CMatrixFloat &out_data)
 Compute the 2D inverse Discrete Fourier Transform (DFT) More...
 
void BASE_IMPEXP dft2_complex (const CMatrixFloat &in_real, const CMatrixFloat &in_imag, CMatrixFloat &out_real, CMatrixFloat &out_imag)
 Compute the 2D Discrete Fourier Transform (DFT) of a complex matrix, returning the real and imaginary parts separately. More...
 
void BASE_IMPEXP idft2_complex (const CMatrixFloat &in_real, const CMatrixFloat &in_imag, CMatrixFloat &out_real, CMatrixFloat &out_imag)
 Compute the 2D inverse Discrete Fourier Transform (DFT). More...
 
void BASE_IMPEXP cross_correlation_FFT (const CMatrixFloat &A, const CMatrixFloat &B, CMatrixFloat &out_corr)
 Correlation of two matrixes using 2D FFT. More...
 
template<class MATRIXLIKE1 , class MATRIXLIKE2 >
void homogeneousMatrixInverse (const MATRIXLIKE1 &M, MATRIXLIKE2 &out_inverse_M)
 Efficiently compute the inverse of a 4x4 homogeneous matrix by only transposing the rotation 3x3 part and solving the translation with dot products. More...
 
template<class IN_ROTMATRIX , class IN_XYZ , class OUT_ROTMATRIX , class OUT_XYZ >
void homogeneousMatrixInverse (const IN_ROTMATRIX &in_R, const IN_XYZ &in_xyz, OUT_ROTMATRIX &out_R, OUT_XYZ &out_xyz)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<class MATRIXLIKE >
void homogeneousMatrixInverse (MATRIXLIKE &M)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<class T , class VECTOR >
interpolate (const T &x, const VECTOR &ys, const T &x0, const T &x1)
 Interpolate a data sequence "ys" ranging from "x0" to "x1" (equally spaced), to obtain the approximation of the sequence at the point "x". More...
 
double BASE_IMPEXP interpolate2points (const double x, const double x0, const double y0, const double x1, const double y1, bool wrap2pi=false)
 Linear interpolation/extrapolation: evaluates at "x" the line (x0,y0)-(x1,y1). More...
 
double BASE_IMPEXP spline (const double t, const CVectorDouble &x, const CVectorDouble &y, bool wrap2pi=false)
 Interpolates the value of a function in a point "t" given 4 SORTED points where "t" is between the two middle points If wrap2pi is true, output "y" values are wrapped to ]-pi,pi] (It is assumed that input "y" values already are in the correct range). More...
 
template<typename NUMTYPE , class VECTORLIKE >
NUMTYPE leastSquareLinearFit (const NUMTYPE t, const VECTORLIKE &x, const VECTORLIKE &y, bool wrap2pi=false)
 Interpolates or extrapolates using a least-square linear fit of the set of values "x" and "y", evaluated at a single point "t". More...
 
template<class VECTORLIKE1 , class VECTORLIKE2 , class VECTORLIKE3 >
void leastSquareLinearFit (const VECTORLIKE1 &ts, VECTORLIKE2 &outs, const VECTORLIKE3 &x, const VECTORLIKE3 &y, bool wrap2pi=false)
 Interpolates or extrapolates using a least-square linear fit of the set of values "x" and "y", evaluated at a sequence of points "ts" and returned at "outs". More...
 
std::ostream BASE_IMPEXPoperator<< (std::ostream &o, const TPoint2D &p)
 
std::ostream BASE_IMPEXPoperator<< (std::ostream &o, const TPoint3D &p)
 
std::ostream BASE_IMPEXPoperator<< (std::ostream &o, const TPose2D &p)
 
std::ostream BASE_IMPEXPoperator<< (std::ostream &o, const TPose3D &p)
 
std::ostream BASE_IMPEXPoperator<< (std::ostream &o, const TPose3DQuat &p)
 
TPoint3D operator- (const TPoint3D &p1)
 Unary minus operator for 3D points. More...
 
bool operator== (const TPoint2D &p1, const TPoint2D &p2)
 Exact comparison between 2D points. More...
 
bool operator!= (const TPoint2D &p1, const TPoint2D &p2)
 Exact comparison between 2D points. More...
 
bool operator== (const TPoint3D &p1, const TPoint3D &p2)
 Exact comparison between 3D points. More...
 
bool operator!= (const TPoint3D &p1, const TPoint3D &p2)
 Exact comparison between 3D points. More...
 
bool operator== (const TPose2D &p1, const TPose2D &p2)
 Exact comparison between 2D poses, taking possible cycles into account. More...
 
bool operator!= (const TPose2D &p1, const TPose2D &p2)
 Exact comparison between 2D poses, taking possible cycles into account. More...
 
bool operator== (const TPose3D &p1, const TPose3D &p2)
 Exact comparison between 3D poses, taking possible cycles into account. More...
 
bool operator!= (const TPose3D &p1, const TPose3D &p2)
 Exact comparison between 3D poses, taking possible cycles into account. More...
 
bool operator== (const TSegment2D &s1, const TSegment2D &s2)
 
bool operator!= (const TSegment2D &s1, const TSegment2D &s2)
 
bool operator== (const TSegment3D &s1, const TSegment3D &s2)
 
bool operator!= (const TSegment3D &s1, const TSegment3D &s2)
 
BASE_IMPEXP mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, mrpt::math::TPoint2D &o)
 TPoint2D binary input. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator<< (mrpt::utils::CStream &out, const mrpt::math::TPoint2D &o)
 TPoint2D binary output. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, mrpt::math::TPoint3D &o)
 TPoint3D binary input. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator<< (mrpt::utils::CStream &out, const mrpt::math::TPoint3D &o)
 TPoint3D binary output. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, mrpt::math::TPose2D &o)
 TPose2D binary input. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator<< (mrpt::utils::CStream &out, const mrpt::math::TPose2D &o)
 TPose2D binary output. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, mrpt::math::TPose3D &o)
 TPose3D binary input. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator<< (mrpt::utils::CStream &out, const mrpt::math::TPose3D &o)
 TPose3D binary output. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, mrpt::math::TSegment2D &s)
 TSegment2D binary input. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator<< (mrpt::utils::CStream &out, const mrpt::math::TSegment2D &s)
 TSegment2D binary output. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, mrpt::math::TLine2D &l)
 TLine2D binary input. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator<< (mrpt::utils::CStream &out, const mrpt::math::TLine2D &l)
 TLine2D binary output. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, mrpt::math::TObject2D &o)
 TObject2D binary input. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator<< (mrpt::utils::CStream &out, const mrpt::math::TObject2D &o)
 TObject2D binary input. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, mrpt::math::TSegment3D &s)
 TSegment3D binary input. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator<< (mrpt::utils::CStream &out, const mrpt::math::TSegment3D &s)
 TSegment3D binary output. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, mrpt::math::TLine3D &l)
 TLine3D binary input. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator<< (mrpt::utils::CStream &out, const mrpt::math::TLine3D &l)
 TLine3D binary output. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, mrpt::math::TPlane &p)
 TPlane binary input. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator<< (mrpt::utils::CStream &out, const mrpt::math::TPlane &p)
 TPlane binary output. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &in, mrpt::math::TObject3D &o)
 TObject3D binary input. More...
 
BASE_IMPEXP mrpt::utils::CStreamoperator<< (mrpt::utils::CStream &out, const mrpt::math::TObject3D &o)
 TObject3D binary output. More...
 
template<class CONTAINER1 , class CONTAINER2 >
void cumsum (const CONTAINER1 &in_data, CONTAINER2 &out_cumsum)
 
template<class CONTAINER >
CONTAINER::Scalar norm (const CONTAINER &v)
 
template<class CONTAINER >
CONTAINER::Scalar norm_inf (const CONTAINER &v)
 
template<class MAT_A , class SKEW_3VECTOR , class MAT_OUT >
void multiply_A_skew3 (const MAT_A &A, const SKEW_3VECTOR &v, MAT_OUT &out)
 Only for vectors/arrays "v" of length3, compute out = A * Skew(v), where Skew(v) is the skew symmetric matric generated from v (see mrpt::math::skew_symmetric3) More...
 
template<class SKEW_3VECTOR , class MAT_A , class MAT_OUT >
void multiply_skew3_A (const SKEW_3VECTOR &v, const MAT_A &A, MAT_OUT &out)
 Only for vectors/arrays "v" of length3, compute out = Skew(v) * A, where Skew(v) is the skew symmetric matric generated from v (see mrpt::math::skew_symmetric3) More...
 
template<class T >
wrapTo2Pi (T a)
 Modifies the given angle to translate it into the [0,2pi[ range. More...
 
template<typename MAT >
CMatrixRowAccessor< MAT > getRowAccessor (MAT &m, size_t rowIdx)
 
template<typename MAT >
CMatrixRowAccessorExtended< MAT > getRowAccessor (MAT &m, size_t rowIdx, size_t offset, size_t space=1)
 
template<typename MAT >
CConstMatrixRowAccessor< MAT > getRowAccessor (const MAT &m, size_t rowIdx)
 
template<typename MAT >
CConstMatrixRowAccessorExtended< MAT > getRowAccessor (const MAT &m, size_t rowIdx, size_t offset, size_t space=1)
 
template<typename MAT >
CMatrixColumnAccessor< MAT > getColumnAccessor (MAT &m, size_t colIdx)
 
template<typename MAT >
CMatrixColumnAccessorExtended< MAT > getColumnAccessor (MAT &m, size_t colIdx, size_t offset, size_t space=1)
 
template<typename MAT >
CConstMatrixColumnAccessor< MAT > getColumnAccessor (const MAT &m, size_t colIdx)
 
template<typename MAT >
CConstMatrixColumnAccessorExtended< MAT > getColumnAccessor (const MAT &m, size_t colIdx, size_t offset, size_t space=1)
 
template<class VECTORLIKE , class VECTORLIKE2 , class VECTORLIKE3 , class MATRIXLIKE , class USERPARAM >
void estimateJacobian (const VECTORLIKE &x, void(*functor)(const VECTORLIKE &x, const USERPARAM &y, VECTORLIKE3 &out), const VECTORLIKE2 &increments, const USERPARAM &userParam, MATRIXLIKE &out_Jacobian)
 Estimate the Jacobian of a multi-dimensional function around a point "x", using finite differences of a given size in each input dimension. More...
 
template<class CONTAINER >
std::vector< double > histogram (const CONTAINER &v, double limit_min, double limit_max, size_t number_bins, bool do_normalization=false, std::vector< double > *out_bin_centers=NULL)
 Computes the normalized or normal histogram of a sequence of numbers given the number of bins and the limits. More...
 
template<class EIGEN_CONTAINER >
void resizeLike (EIGEN_CONTAINER &trg, const EIGEN_CONTAINER &src)
 
template<typename T >
void resizeLike (std::vector< T > &trg, const std::vector< T > &src)
 
template<class CONTAINER1 , class CONTAINER2 , typename VALUE >
void cumsum_tmpl (const CONTAINER1 &in_data, CONTAINER2 &out_cumsum)
 Computes the cumulative sum of all the elements, saving the result in another container. More...
 
template<class CONTAINER >
CONTAINER cumsum (const CONTAINER &in_data)
 Computes the cumulative sum of all the elements. More...
 
template<class CONTAINER >
CONTAINER::Scalar maximum (const CONTAINER &v)
 
template<class CONTAINER >
CONTAINER::Scalar minimum (const CONTAINER &v)
 
template<typename T >
maximum (const std::vector< T > &v)
 
template<typename T >
minimum (const std::vector< T > &v)
 
template<class Derived >
const Eigen::MatrixBase< Derived >::AdjointReturnType operator~ (const Eigen::MatrixBase< Derived > &m)
 Transpose operator for matrices. More...
 
template<class Derived >
Eigen::MatrixBase< Derived >::PlainObject operator! (const Eigen::MatrixBase< Derived > &m)
 Unary inversion operator. More...
 
template<typename MAT_H , typename MAT_C , typename MAT_R >
void multiply_HCHt (const MAT_H &H, const MAT_C &C, MAT_R &R, bool accumResultInOutput)
 R = H * C * H^t (with C symmetric) More...
 
template<typename VECTOR_H , typename MAT_C >
MAT_C::Scalar multiply_HCHt_scalar (const VECTOR_H &H, const MAT_C &C)
 r (a scalar) = H * C * H^t (with a vector H and a symmetric matrix C) More...
 
template<typename MAT_H , typename MAT_C , typename MAT_R >
void multiply_HtCH (const MAT_H &H, const MAT_C &C, MAT_R &R, bool accumResultInOutput)
 R = H^t * C * H (with C symmetric) More...
 
template<class MAT_IN , class VECTOR , class MAT_OUT >
void meanAndCovMat (const MAT_IN &v, VECTOR &out_mean, MAT_OUT &out_cov)
 Computes the mean vector and covariance from a list of samples in an NxM matrix, where each row is a sample, so the covariance is MxM. More...
 
template<class MATRIX >
Eigen::Matrix< typename MATRIX::Scalar, MATRIX::ColsAtCompileTime, MATRIX::ColsAtCompileTime > cov (const MATRIX &v)
 Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample, so the covariance is MxM. More...
 
template<class T >
std::ostream & operator<< (std::ostream &out, const std::vector< T > &d)
 A template function for printing out the contents of a std::vector variable. More...
 
template<class T >
std::ostream & operator<< (std::ostream &out, std::vector< T > *d)
 A template function for printing out the contents of a std::vector variable. More...
 
template<typename T , size_t N>
mrpt::utils::CStreamoperator<< (mrpt::utils::CStream &ostrm, const CArrayNumeric< T, N > &a)
 Binary dump of a CArrayNumeric<T,N> to a stream. More...
 
template<typename T , size_t N>
mrpt::utils::CStreamoperator>> (mrpt::utils::CStream &istrm, CArrayNumeric< T, N > &a)
 Binary read of a CArrayNumeric<T,N> from a stream. More...
 
template<class VECTORLIKE1 , class MATLIKE1 , class USERPARAM , class VECTORLIKE2 , class VECTORLIKE3 , class MATLIKE2 >
void transform_gaussian_unscented (const VECTORLIKE1 &x_mean, const MATLIKE1 &x_cov, void(*functor)(const VECTORLIKE1 &x, const USERPARAM &fixed_param, VECTORLIKE3 &y), const USERPARAM &fixed_param, VECTORLIKE2 &y_mean, MATLIKE2 &y_cov, const bool *elem_do_wrap2pi=NULL, const double alpha=1e-3, const double K=0, const double beta=2.0)
 Scaled unscented transformation (SUT) for estimating the Gaussian distribution of a variable Y=f(X) for an arbitrary function f() provided by the user. More...
 
template<class VECTORLIKE1 , class MATLIKE1 , class USERPARAM , class VECTORLIKE2 , class VECTORLIKE3 , class MATLIKE2 >
void transform_gaussian_montecarlo (const VECTORLIKE1 &x_mean, const MATLIKE1 &x_cov, void(*functor)(const VECTORLIKE1 &x, const USERPARAM &fixed_param, VECTORLIKE3 &y), const USERPARAM &fixed_param, VECTORLIKE2 &y_mean, MATLIKE2 &y_cov, const size_t num_samples=1000, typename mrpt::aligned_containers< VECTORLIKE3 >::vector_t *out_samples_y=NULL)
 Simple Montecarlo-base estimation of the Gaussian distribution of a variable Y=f(X) for an arbitrary function f() provided by the user. More...
 
template<class VECTORLIKE1 , class MATLIKE1 , class USERPARAM , class VECTORLIKE2 , class VECTORLIKE3 , class MATLIKE2 >
void transform_gaussian_linear (const VECTORLIKE1 &x_mean, const MATLIKE1 &x_cov, void(*functor)(const VECTORLIKE1 &x, const USERPARAM &fixed_param, VECTORLIKE3 &y), const USERPARAM &fixed_param, VECTORLIKE2 &y_mean, MATLIKE2 &y_cov, const VECTORLIKE1 &x_increments)
 First order uncertainty propagation estimator of the Gaussian distribution of a variable Y=f(X) for an arbitrary function f() provided by the user. More...
 
bool BASE_IMPEXP loadVector (utils::CFileStream &f, std::vector< int > &d)
 Loads one row of a text file as a numerical std::vector. More...
 
bool BASE_IMPEXP loadVector (utils::CFileStream &f, std::vector< double > &d)
 Loads one row of a text file as a numerical std::vector. More...
 
bool BASE_IMPEXP isNaN (float f) MRPT_NO_THROWS
 Returns true if the number is NaN. More...
 
bool BASE_IMPEXP isNaN (double f) MRPT_NO_THROWS
 Returns true if the number is NaN. More...
 
bool BASE_IMPEXP isFinite (float f) MRPT_NO_THROWS
 Returns true if the number is non infinity. More...
 
bool BASE_IMPEXP isFinite (double f) MRPT_NO_THROWS
 Returns true if the number is non infinity. More...
 
void BASE_IMPEXP medianFilter (const std::vector< double > &inV, std::vector< double > &outV, const int &winSize, const int &numberOfSigmas=2)
 
template<typename T , typename VECTOR >
void linspace (T first, T last, size_t count, VECTOR &out_vector)
 Generates an equidistant sequence of numbers given the first one, the last one and the desired number of points. More...
 
template<class T , T STEP>
std::vector< T > sequenceStdVec (T first, size_t length)
 Generates a sequence of values [first,first+STEP,first+2*STEP,...]. More...
 
template<class VEC1 , class VEC2 >
void normalize (const VEC1 &v, VEC2 &out_v)
 Normalize a vector, such as its norm is the unity. More...
 
template<class VECTOR_OF_VECTORS , class VECTORLIKE >
void extractColumnFromVectorOfVectors (const size_t colIndex, const VECTOR_OF_VECTORS &data, VECTORLIKE &out_column)
 Extract a column from a vector of vectors, and store it in another vector. More...
 
uint64_t BASE_IMPEXP factorial64 (unsigned int n)
 Computes the factorial of an integer number and returns it as a 64-bit integer number. More...
 
double BASE_IMPEXP factorial (unsigned int n)
 Computes the factorial of an integer number and returns it as a double value (internally it uses logarithms for avoiding overflow). More...
 
template<class T >
round2up (T val)
 Round up to the nearest power of two of a given number. More...
 
std::string BASE_IMPEXP MATLAB_plotCovariance2D (const CMatrixFloat &cov22, const CVectorFloat &mean, const float &stdCount, const std::string &style=std::string("b"), const size_t &nEllipsePoints=30)
 Generates a string with the MATLAB commands required to plot an confidence interval (ellipse) for a 2D Gaussian ('float' version). More...
 
std::string BASE_IMPEXP MATLAB_plotCovariance2D (const CMatrixDouble &cov22, const CVectorDouble &mean, const float &stdCount, const std::string &style=std::string("b"), const size_t &nEllipsePoints=30)
 Generates a string with the MATLAB commands required to plot an confidence interval (ellipse) for a 2D Gaussian ('double' version). More...
 
template<typename EIGEN_VECTOR , typename At , size_t N>
EIGEN_VECTOR & loadVector (EIGEN_VECTOR &v, At(&theArray)[N])
 Assignment operator for initializing a std::vector from a C array (The vector will be automatically set to the correct size). More...
 
template<typename T , typename At , size_t N>
std::vector< T > & loadVector (std::vector< T > &v, At(&theArray)[N])
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<size_t N, typename T >
std::vector< T > make_vector (const T val1,...)
 A versatile template to build vectors on-the-fly in a style close to MATLAB's v=[a b c d ...] The first argument of the template is the vector length, and the second the type of the numbers. More...
 
template<class TRIPLET >
bool saveEigenSparseTripletsToFile (const std::string &sFile, std::vector< TRIPLET > &tri)
 Saves to a plain-text file the nonzero entries of a Eigen sparse matrix, represented as a vector of triplets. More...
 
template<typename Derived >
mxArrayconvertToMatlab (const Eigen::EigenBase< Derived > &mat)
 Convert vectors, arrays and matrices into Matlab vectors/matrices. More...
 
template<typename CONTAINER >
mxArrayconvertVectorToMatlab (const CONTAINER &vec)
 Convert std::vector<> or std::deque<> of numeric types into Matlab vectors. More...
 
template<class T >
void wrapTo2PiInPlace (T &a)
 Modifies the given angle to translate it into the [0,2pi[ range. More...
 
template<class T >
wrapToPi (T a)
 Modifies the given angle to translate it into the ]-pi,pi] range. More...
 
template<class T >
void wrapToPiInPlace (T &a)
 Modifies the given angle to translate it into the ]-pi,pi] range. More...
 
template<class VECTOR >
void unwrap2PiSequence (VECTOR &x)
 Modify a sequence of angle values such as no consecutive values have a jump larger than PI in absolute value. More...
 
template<class T >
angDistance (T from, T to)
 Computes the shortest angular increment (or distance) between two planar orientations, such that it is constrained to [-pi,pi] and is correct for any combination of angles (e.g. More...
 
template<class MATRIXLIKE >
size_t size (const MATRIXLIKE &m, int dim)
 

Variables

double BASE_IMPEXP geometryEpsilon
 Global epsilon to overcome small precision errors. More...
 
struct BASE_IMPEXP TSegment3D
 
struct BASE_IMPEXP TLine3D
 
class BASE_IMPEXP TPolygon3D
 
struct BASE_IMPEXP TObject3D
 
const unsigned char GEOMETRIC_TYPE_POINT =0
 Object type identifier for TPoint2D or TPoint3D. More...
 
const unsigned char GEOMETRIC_TYPE_SEGMENT =1
 Object type identifier for TSegment2D or TSegment3D. More...
 
const unsigned char GEOMETRIC_TYPE_LINE =2
 Object type identifier for TLine2D or TLine3D. More...
 
const unsigned char GEOMETRIC_TYPE_POLYGON =3
 Object type identifier for TPolygon2D or TPolygon3D. More...
 
const unsigned char GEOMETRIC_TYPE_PLANE =4
 Object type identifier for TPlane. More...
 
const unsigned char GEOMETRIC_TYPE_UNDEFINED =255
 Object type identifier for empty TObject2D or TObject3D. More...
 

Typedef Documentation

◆ CLevenbergMarquardt

The default name for the LM class is an instantiation for "double".

Definition at line 229 of file CLevenbergMarquardt.h.

◆ CMatrixDouble

Declares a matrix of double numbers (non serializable).

For a serializable version, use math::CMatrixD

See also
CMatrixFloat, CMatrix, CMatrixD

Definition at line 130 of file CMatrixTemplateNumeric.h.

◆ CMatrixDouble12

Definition at line 54 of file eigen_frwds.h.

◆ CMatrixDouble13

Definition at line 52 of file eigen_frwds.h.

◆ CMatrixDouble15

Definition at line 61 of file eigen_frwds.h.

◆ CMatrixDouble16

Definition at line 57 of file eigen_frwds.h.

◆ CMatrixDouble17

Definition at line 59 of file eigen_frwds.h.

◆ CMatrixDouble21

Definition at line 55 of file eigen_frwds.h.

◆ CMatrixDouble22

Definition at line 45 of file eigen_frwds.h.

◆ CMatrixDouble23

Definition at line 46 of file eigen_frwds.h.

◆ CMatrixDouble31

Definition at line 53 of file eigen_frwds.h.

◆ CMatrixDouble32

Definition at line 47 of file eigen_frwds.h.

◆ CMatrixDouble33

Definition at line 48 of file eigen_frwds.h.

◆ CMatrixDouble41

Definition at line 62 of file eigen_frwds.h.

◆ CMatrixDouble44

Definition at line 49 of file eigen_frwds.h.

◆ CMatrixDouble51

Definition at line 60 of file eigen_frwds.h.

◆ CMatrixDouble61

Definition at line 56 of file eigen_frwds.h.

◆ CMatrixDouble66

Definition at line 50 of file eigen_frwds.h.

◆ CMatrixDouble71

Definition at line 58 of file eigen_frwds.h.

◆ CMatrixDouble77

Definition at line 51 of file eigen_frwds.h.

◆ CMatrixFloat

Declares a matrix of float numbers (non serializable).

For a serializable version, use math::CMatrix

See also
CMatrixDouble, CMatrix, CMatrixD

Definition at line 124 of file CMatrixTemplateNumeric.h.

◆ CMatrixFloat12

Definition at line 73 of file eigen_frwds.h.

◆ CMatrixFloat13

Definition at line 71 of file eigen_frwds.h.

◆ CMatrixFloat15

Definition at line 80 of file eigen_frwds.h.

◆ CMatrixFloat16

Definition at line 76 of file eigen_frwds.h.

◆ CMatrixFloat17

Definition at line 78 of file eigen_frwds.h.

◆ CMatrixFloat21

Definition at line 74 of file eigen_frwds.h.

◆ CMatrixFloat22

Definition at line 64 of file eigen_frwds.h.

◆ CMatrixFloat23

Definition at line 65 of file eigen_frwds.h.

◆ CMatrixFloat31

Definition at line 72 of file eigen_frwds.h.

◆ CMatrixFloat32

Definition at line 66 of file eigen_frwds.h.

◆ CMatrixFloat33

Definition at line 67 of file eigen_frwds.h.

◆ CMatrixFloat44

Definition at line 68 of file eigen_frwds.h.

◆ CMatrixFloat51

Definition at line 79 of file eigen_frwds.h.

◆ CMatrixFloat61

Definition at line 75 of file eigen_frwds.h.

◆ CMatrixFloat66

Definition at line 69 of file eigen_frwds.h.

◆ CMatrixFloat71

Definition at line 77 of file eigen_frwds.h.

◆ CMatrixFloat77

Definition at line 70 of file eigen_frwds.h.

◆ CMatrixLongDouble

Declares a matrix of "long doubles" (non serializable), or of "doubles" if the compiler does not support "long double".

See also
CMatrixDouble, CMatrixFloat

Definition at line 146 of file CMatrixTemplateNumeric.h.

◆ CMatrixUInt

Declares a matrix of unsigned ints (non serializable).

See also
CMatrixDouble, CMatrixFloat

Definition at line 135 of file CMatrixTemplateNumeric.h.

◆ CQuaternionDouble

A quaternion of data type "double".

Definition at line 407 of file CQuaternion.h.

◆ CQuaternionFloat

A quaternion of data type "float".

Definition at line 408 of file CQuaternion.h.

◆ CVectorDouble

Column vector, like Eigen::MatrixXd, but automatically initialized to zeros since construction.

Definition at line 37 of file eigen_frwds.h.

◆ CVectorFloat

Column vector, like Eigen::MatrixXf, but automatically initialized to zeros since construction.

Definition at line 35 of file eigen_frwds.h.

Enumeration Type Documentation

◆ TConstructorFlags_Matrices

For usage in one of the constructors of CMatrixFixedNumeric or CMatrixTemplate (and derived classes), if it's not required to fill it with zeros at the constructor to save time.

Enumerator
UNINITIALIZED_MATRIX 

Definition at line 73 of file math_frwds.h.

◆ TConstructorFlags_Quaternions

Enumerator
UNINITIALIZED_QUATERNION 

Definition at line 21 of file CQuaternion.h.

◆ TMatrixTextFileFormat

Selection of the number format in CMatrixTemplate::saveToTextFile

Enumerator
MATRIX_FORMAT_ENG 

engineering format 'e'

MATRIX_FORMAT_FIXED 

fixed floating point 'f'

MATRIX_FORMAT_INT 

intergers 'i'

Definition at line 64 of file math_frwds.h.

Function Documentation

◆ adjustRange()

template<class CONTAINER >
void mrpt::math::adjustRange ( CONTAINER &  m,
const typename CONTAINER::Scalar  minVal,
const typename CONTAINER::Scalar  maxVal 
)

Adjusts the range of all the elements such as the minimum and maximum values being those supplied by the user.


Definition at line 224 of file ops_containers.h.

References minimum_maximum().

◆ containerFromPoseOrPoint()

template<class CONTAINER , class POINT_OR_POSE >
CONTAINER & mrpt::math::containerFromPoseOrPoint ( CONTAINER &  C,
const POINT_OR_POSE &  p 
)

Conversion of poses (TPose2D,TPoint2D,..., mrpt::poses::CPoint2D,CPose3D,...) to MRPT containers (vector/matrix)

Conversion of poses to MRPT containers (vector/matrix)

Definition at line 23 of file point_poses2vectors.h.

References static_size.

◆ countCommonElements()

template<class CONTAINER1 , class CONTAINER2 >
size_t mrpt::math::countCommonElements ( const CONTAINER1 &  a,
const CONTAINER2 &  b 
)

Counts the number of elements that appear in both STL-like containers (comparison through the == operator) It is assumed that no repeated elements appear within each of the containers.


Definition at line 212 of file ops_containers.h.

References const_iterator.

◆ cov()

template<class MATRIX >
Eigen::Matrix<typename MATRIX::Scalar,MATRIX::ColsAtCompileTime,MATRIX::ColsAtCompileTime> mrpt::math::cov ( const MATRIX &  v)
inline

◆ covVector()

template<class VECTOR_OF_VECTOR , class RETURN_MATRIX >
RETURN_MATRIX mrpt::math::covVector ( const VECTOR_OF_VECTOR &  v)
inline

Computes the covariance matrix from a list of values given as a vector of vectors, where each row is a sample.

Parameters
vThe set of data, as a vector of N vectors of M elements.
out_covThe output MxM matrix for the estimated covariance matrix.
Template Parameters
RETURN_MATRIXThe type of the returned matrix, e.g. Eigen::MatrixXd
See also
math::mean,math::stddev, math::cov, meanAndCovVec

Definition at line 333 of file ops_containers.h.

References meanAndCovVec().

◆ cumsum() [1/2]

template<class CONTAINER >
CONTAINER mrpt::math::cumsum ( const CONTAINER &  in_data)
inline

Computes the cumulative sum of all the elements.

See also
sum

Definition at line 101 of file ops_containers.h.

References cumsum().

◆ cumsum() [2/2]

template<class CONTAINER1 , class CONTAINER2 >
void mrpt::math::cumsum ( const CONTAINER1 &  in_data,
CONTAINER2 &  out_cumsum 
)
inline

Definition at line 96 of file ops_containers.h.

Referenced by confidenceIntervals(), and cumsum().

◆ cumsum_tmpl()

template<class CONTAINER1 , class CONTAINER2 , typename VALUE >
void mrpt::math::cumsum_tmpl ( const CONTAINER1 &  in_data,
CONTAINER2 &  out_cumsum 
)
inline

Computes the cumulative sum of all the elements, saving the result in another container.

This works for both matrices (even mixing their types) and vectores/arrays (even mixing types), and even to store the cumsum of any matrix into any vector/array, but not in opposite direction.

See also
sum

Definition at line 86 of file ops_containers.h.

References resizeLike().

◆ dotProduct() [1/2]

template<class CONTAINER1 , class CONTAINER2 >
CONTAINER1::Scalar mrpt::math::dotProduct ( const CONTAINER1 &  v1,
const CONTAINER1 &  v2 
)
inline

v1*v2: The dot product of two containers (vectors/arrays/matrices)

Definition at line 150 of file ops_containers.h.

◆ dotProduct() [2/2]

template<size_t N, class T , class U , class V >
T mrpt::math::dotProduct ( const U &  v1,
const V &  v2 
)
inline

v1*v2: The dot product of any two objects supporting []

Definition at line 157 of file ops_containers.h.

◆ estimateJacobian()

template<class VECTORLIKE , class VECTORLIKE2 , class VECTORLIKE3 , class MATRIXLIKE , class USERPARAM >
void mrpt::math::estimateJacobian ( const VECTORLIKE &  x,
void(*)(const VECTORLIKE &x, const USERPARAM &y, VECTORLIKE3 &out)  functor,
const VECTORLIKE2 &  increments,
const USERPARAM &  userParam,
MATRIXLIKE &  out_Jacobian 
)

Estimate the Jacobian of a multi-dimensional function around a point "x", using finite differences of a given size in each input dimension.

The template argument USERPARAM is for the data can be passed to the functor. If it is not required, set to "int" or any other basic type.

This is a generic template which works with: VECTORLIKE: vector_float, CVectorDouble, CArrayNumeric<>, double [N], ... MATRIXLIKE: CMatrixTemplateNumeric, CMatrixFixedNumeric

Definition at line 26 of file num_jacobian.h.

References ASSERT_, MRPT_END, and MRPT_START.

Referenced by mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::execute(), mrpt::math::jacobians::jacob_numeric_estimate(), and mrpt::bayes::CKalmanFilterCapable< 7, 3, 3, 7 >::runOneKalmanIteration().

◆ getColumnAccessor() [1/4]

template<typename MAT >
CConstMatrixColumnAccessor<MAT> mrpt::math::getColumnAccessor ( const MAT &  m,
size_t  colIdx 
)
inline

Definition at line 556 of file matrix_adaptors.h.

◆ getColumnAccessor() [2/4]

template<typename MAT >
CConstMatrixColumnAccessorExtended<MAT> mrpt::math::getColumnAccessor ( const MAT &  m,
size_t  colIdx,
size_t  offset,
size_t  space = 1 
)
inline

Definition at line 603 of file matrix_adaptors.h.

◆ getColumnAccessor() [3/4]

template<typename MAT >
CMatrixColumnAccessor<MAT> mrpt::math::getColumnAccessor ( MAT &  m,
size_t  colIdx 
)
inline

Definition at line 449 of file matrix_adaptors.h.

◆ getColumnAccessor() [4/4]

template<typename MAT >
CMatrixColumnAccessorExtended<MAT> mrpt::math::getColumnAccessor ( MAT &  m,
size_t  colIdx,
size_t  offset,
size_t  space = 1 
)
inline

Definition at line 513 of file matrix_adaptors.h.

◆ getRowAccessor() [1/4]

template<typename MAT >
CConstMatrixRowAccessor<MAT> mrpt::math::getRowAccessor ( const MAT &  m,
size_t  rowIdx 
)
inline

Definition at line 347 of file matrix_adaptors.h.

◆ getRowAccessor() [2/4]

template<typename MAT >
CConstMatrixRowAccessorExtended<MAT> mrpt::math::getRowAccessor ( const MAT &  m,
size_t  rowIdx,
size_t  offset,
size_t  space = 1 
)
inline

Definition at line 395 of file matrix_adaptors.h.

◆ getRowAccessor() [3/4]

template<typename MAT >
CMatrixRowAccessor<MAT> mrpt::math::getRowAccessor ( MAT &  m,
size_t  rowIdx 
)
inline

Definition at line 238 of file matrix_adaptors.h.

◆ getRowAccessor() [4/4]

template<typename MAT >
CMatrixRowAccessorExtended<MAT> mrpt::math::getRowAccessor ( MAT &  m,
size_t  rowIdx,
size_t  offset,
size_t  space = 1 
)
inline

Definition at line 303 of file matrix_adaptors.h.

◆ histogram()

template<class CONTAINER >
std::vector<double> mrpt::math::histogram ( const CONTAINER &  v,
double  limit_min,
double  limit_max,
size_t  number_bins,
bool  do_normalization = false,
std::vector< double > *  out_bin_centers = NULL 
)

Computes the normalized or normal histogram of a sequence of numbers given the number of bins and the limits.

In any case this is a "linear" histogram, i.e. for matrices, all the elements are taken as if they were a plain sequence, not taking into account they were in columns or rows. If desired, out_bin_centers can be set to receive the bins centers.

Definition at line 54 of file ops_containers.h.

References mrpt::math::CHistogram::add(), mrpt::math::CHistogram::getHistogram(), and mrpt::math::CHistogram::getHistogramNormalized().

Referenced by confidenceIntervals(), and mrpt::pbmap::getMode().

◆ homogeneousMatrixInverse() [1/3]

template<class IN_ROTMATRIX , class IN_XYZ , class OUT_ROTMATRIX , class OUT_XYZ >
void mrpt::math::homogeneousMatrixInverse ( const IN_ROTMATRIX &  in_R,
const IN_XYZ &  in_xyz,
OUT_ROTMATRIX &  out_R,
OUT_XYZ &  out_xyz 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 79 of file homog_matrices.h.

References ASSERT_, MRPT_END, MRPT_START, and size().

◆ homogeneousMatrixInverse() [2/3]

template<class MATRIXLIKE1 , class MATRIXLIKE2 >
void mrpt::math::homogeneousMatrixInverse ( const MATRIXLIKE1 &  M,
MATRIXLIKE2 &  out_inverse_M 
)

Efficiently compute the inverse of a 4x4 homogeneous matrix by only transposing the rotation 3x3 part and solving the translation with dot products.

This is a generic template which works with: MATRIXLIKE: CMatrixTemplateNumeric, CMatrixFixedNumeric

Definition at line 27 of file homog_matrices.h.

References ASSERT_, MRPT_END, MRPT_START, and size().

Referenced by mrpt::poses::CPoseOrPoint< CPoint3D >::getInverseHomogeneousMatrix(), and mrpt::obs::detail::project3DPointsFromDepthImageInto().

◆ homogeneousMatrixInverse() [3/3]

template<class MATRIXLIKE >
void mrpt::math::homogeneousMatrixInverse ( MATRIXLIKE &  M)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 108 of file homog_matrices.h.

References ASSERTDEB_, size(), and t().

◆ kmeans()

template<class LIST_OF_VECTORS1 , class LIST_OF_VECTORS2 >
double mrpt::math::kmeans ( const size_t  k,
const LIST_OF_VECTORS1 &  points,
std::vector< int > &  assignments,
LIST_OF_VECTORS2 *  out_centers = NULL,
const size_t  attempts = 3 
)
inline

k-means algorithm to cluster a list of N points of arbitrary dimensionality into exactly K clusters.

The list of input points can be any template CONTAINER<POINT> with:

  • CONTAINER can be: Any STL container: std::vector,std::list,std::deque,...
  • POINT can be:
    • std::vector<double/float>
    • CArrayDouble<N> / CArrayFloat<N>
Parameters
k[IN] Number of cluster to look for.
points[IN] The list of N input points. It can be any STL-like containers of std::vector<float/double>, for example a std::vector<mrpt::math::CVectorDouble>, a std::list<CVectorFloat>, etc...
assignments[OUT] At output it will have a number [0,k-1] for each of the N input points.
out_centers[OUT] If not NULL, at output will have the centers of each group. Can be of any of the supported types of "points", but the basic coordinates should be float or double exactly as in "points".
attempts[IN] Number of attempts.
See also
A more advanced algorithm, see: kmeanspp
Note
Uses the kmeans++ implementation by David Arthur (2009, http://www.stanford.edu/~darthur/kmpp.zip).

Definition at line 118 of file kmeans.h.

References mrpt::math::detail::stub_kmeans().

◆ kmeanspp()

template<class LIST_OF_VECTORS1 , class LIST_OF_VECTORS2 >
double mrpt::math::kmeanspp ( const size_t  k,
const LIST_OF_VECTORS1 &  points,
std::vector< int > &  assignments,
LIST_OF_VECTORS2 *  out_centers = NULL,
const size_t  attempts = 3 
)
inline

k-means++ algorithm to cluster a list of N points of arbitrary dimensionality into exactly K clusters.

The list of input points can be any template CONTAINER<POINT> with:

  • CONTAINER can be: Any STL container: std::vector,std::list,std::deque,...
  • POINT can be:
    • std::vector<double/float>
    • CArrayDouble<N> / CArrayFloat<N>
Parameters
k[IN] Number of cluster to look for.
points[IN] The list of N input points. It can be any STL-like containers of std::vector<float/double>, for example a std::vector<mrpt::math::CVectorDouble>, a std::list<CVectorFloat>, etc...
assignments[OUT] At output it will have a number [0,k-1] for each of the N input points.
out_centers[OUT] If not NULL, at output will have the centers of each group. Can be of any of the supported types of "points", but the basic coordinates should be float or double exactly as in "points".
attempts[IN] Number of attempts.
See also
The standard kmeans algorithm, see: kmeans
Note
Uses the kmeans++ implementation by David Arthur (2009, http://www.stanford.edu/~darthur/kmpp.zip).

Definition at line 146 of file kmeans.h.

References mrpt::math::detail::stub_kmeans().

◆ maximum() [1/2]

template<class CONTAINER >
CONTAINER::Scalar mrpt::math::maximum ( const CONTAINER &  v)
inline

◆ maximum() [2/2]

template<typename T >
T mrpt::math::maximum ( const std::vector< T > &  v)
inline

Definition at line 113 of file ops_containers.h.

References ASSERT_, and mrpt::utils::keep_max().

◆ mean()

template<class CONTAINER >
double mrpt::math::mean ( const CONTAINER &  v)
inline

Computes the mean value of a vector.

Returns
The mean, as a double number.
See also
math::stddev,math::meanAndStd

Definition at line 178 of file ops_containers.h.

References sum().

Referenced by confidenceIntervals(), and mrpt::slam::PF_implementation< mrpt::poses::CPose3D, CMonteCarloLocalization3D >::PF_SLAM_implementation_pfAuxiliaryPFStandardAndOptimal().

◆ meanAndCovMat()

template<class MAT_IN , class VECTOR , class MAT_OUT >
void mrpt::math::meanAndCovMat ( const MAT_IN &  v,
VECTOR &  out_mean,
MAT_OUT &  out_cov 
)

Computes the mean vector and covariance from a list of samples in an NxM matrix, where each row is a sample, so the covariance is MxM.

Parameters
vThe set of data as a NxM matrix, of types: CMatrixTemplateNumeric or CMatrixFixedNumeric
out_meanThe output M-vector for the estimated mean.
out_covThe output MxM matrix for the estimated covariance matrix, this can also be either a fixed-size of dynamic size matrix.
See also
mrpt::math::meanAndCovVec, math::mean,math::stddev, math::cov

Definition at line 89 of file ops_matrices.h.

References ASSERTMSG_, and mrpt::utils::square().

Referenced by cov().

◆ meanAndCovVec()

template<class VECTOR_OF_VECTOR , class VECTORLIKE , class MATRIXLIKE >
void mrpt::math::meanAndCovVec ( const VECTOR_OF_VECTOR &  v,
VECTORLIKE &  out_mean,
MATRIXLIKE &  out_cov 
)

Computes the mean vector and covariance from a list of values given as a vector of vectors, where each row is a sample.

Parameters
vThe set of data, as a vector of N vectors of M elements.
out_meanThe output M-vector for the estimated mean.
out_covThe output MxM matrix for the estimated covariance matrix.
See also
mrpt::math::meanAndCovMat, math::mean,math::stddev, math::cov

Definition at line 287 of file ops_containers.h.

References ASSERTMSG_, and mrpt::utils::square().

Referenced by covVector().

◆ meanAndStd()

template<class VECTORLIKE >
void mrpt::math::meanAndStd ( const VECTORLIKE &  v,
double &  out_mean,
double &  out_std,
bool  unbiased = true 
)

Computes the standard deviation of a vector.

Parameters
vThe set of data
out_meanThe output for the estimated mean
out_stdThe output for the estimated standard deviation
unbiasedIf set to true or false the std is normalized by "N-1" or "N", respectively.
See also
math::mean,math::stddev

Definition at line 243 of file ops_containers.h.

References mrpt::utils::square(), and sum().

Referenced by stddev().

◆ minimum() [1/2]

template<class CONTAINER >
CONTAINER::Scalar mrpt::math::minimum ( const CONTAINER &  v)
inline

◆ minimum() [2/2]

template<typename T >
T mrpt::math::minimum ( const std::vector< T > &  v)
inline

Definition at line 120 of file ops_containers.h.

References ASSERT_, and mrpt::utils::keep_min().

◆ minimum_maximum() [1/2]

template<class Derived >
void mrpt::math::minimum_maximum ( const Eigen::MatrixBase< Derived > &  V,
typename Eigen::MatrixBase< Derived >::Scalar &  curMin,
typename Eigen::MatrixBase< Derived >::Scalar &  curMax 
)
inline

Return the maximum and minimum values of a Eigen-based vector or matrix.

Definition at line 201 of file ops_containers.h.

◆ minimum_maximum() [2/2]

template<typename T >
void mrpt::math::minimum_maximum ( const std::vector< T > &  V,
T &  curMin,
T &  curMax 
)
inline

Return the maximum and minimum values of a std::vector.

Definition at line 187 of file ops_containers.h.

References ASSERT_, mrpt::utils::keep_max(), and mrpt::utils::keep_min().

Referenced by adjustRange(), and confidenceIntervals().

◆ multiply_A_skew3()

template<class MAT_A , class SKEW_3VECTOR , class MAT_OUT >
void mrpt::math::multiply_A_skew3 ( const MAT_A &  A,
const SKEW_3VECTOR &  v,
MAT_OUT &  out 
)

Only for vectors/arrays "v" of length3, compute out = A * Skew(v), where Skew(v) is the skew symmetric matric generated from v (see mrpt::math::skew_symmetric3)

Definition at line 150 of file ops_matrices.h.

References ASSERT_EQUAL_, MRPT_END, MRPT_START, and size().

Referenced by multiply_A_skew3().

◆ multiply_HCHt()

template<typename MAT_H , typename MAT_C , typename MAT_R >
void mrpt::math::multiply_HCHt ( const MAT_H &  H,
const MAT_C &  C,
MAT_R &  R,
bool  accumResultInOutput 
)
inline

R = H * C * H^t (with C symmetric)

Definition at line 47 of file ops_matrices.h.

◆ multiply_HCHt_scalar()

template<typename VECTOR_H , typename MAT_C >
MAT_C::Scalar mrpt::math::multiply_HCHt_scalar ( const VECTOR_H &  H,
const MAT_C &  C 
)

r (a scalar) = H * C * H^t (with a vector H and a symmetric matrix C)

Definition at line 62 of file ops_matrices.h.

Referenced by mrpt::graphs::detail::graph_ops< graph_t >::auxMaha2Dist(), KLD_Gaussians(), mahalanobisDistance2(), mahalanobisDistance2AndLogPDF(), normalPDF(), and normalPDFInf().

◆ multiply_HtCH()

template<typename MAT_H , typename MAT_C , typename MAT_R >
void mrpt::math::multiply_HtCH ( const MAT_H &  H,
const MAT_C &  C,
MAT_R &  R,
bool  accumResultInOutput 
)

R = H^t * C * H (with C symmetric)

Definition at line 69 of file ops_matrices.h.

◆ multiply_skew3_A()

template<class SKEW_3VECTOR , class MAT_A , class MAT_OUT >
void mrpt::math::multiply_skew3_A ( const SKEW_3VECTOR &  v,
const MAT_A &  A,
MAT_OUT &  out 
)

Only for vectors/arrays "v" of length3, compute out = Skew(v) * A, where Skew(v) is the skew symmetric matric generated from v (see mrpt::math::skew_symmetric3)

Definition at line 169 of file ops_matrices.h.

References ASSERT_EQUAL_, MRPT_END, MRPT_START, and size().

Referenced by multiply_skew3_A().

◆ ncc_vector()

template<class CONT1 , class CONT2 >
double mrpt::math::ncc_vector ( const CONT1 &  patch1,
const CONT2 &  patch2 
)

Normalised Cross Correlation between two vector patches The Matlab code for this is a = a - mean2(a); b = b - mean2(b); r = sum(sum(a.

*b))/sqrt(sum(sum(a.*a))*sum(sum(b.*b)));

Definition at line 349 of file ops_containers.h.

References ASSERT_, ASSERTMSG_, and mrpt::utils::square().

◆ norm()

template<class CONTAINER >
CONTAINER::Scalar mrpt::math::norm ( const CONTAINER &  v)
inline

◆ norm_inf()

template<class CONTAINER >
CONTAINER::Scalar mrpt::math::norm_inf ( const CONTAINER &  v)
inline

◆ operator!=()

template<class T , std::size_t N>
bool mrpt::math::operator!= ( const CArray< T, N > &  x,
const CArray< T, N > &  y 
)

Definition at line 287 of file CArray.h.

◆ operator<()

template<class T , std::size_t N>
bool mrpt::math::operator< ( const CArray< T, N > &  x,
const CArray< T, N > &  y 
)

◆ operator<=()

template<class T , std::size_t N>
bool mrpt::math::operator<= ( const CArray< T, N > &  x,
const CArray< T, N > &  y 
)

Definition at line 295 of file CArray.h.

◆ operator==()

template<class T , std::size_t N>
bool mrpt::math::operator== ( const CArray< T, N > &  x,
const CArray< T, N > &  y 
)

◆ operator>()

template<class T , std::size_t N>
bool mrpt::math::operator> ( const CArray< T, N > &  x,
const CArray< T, N > &  y 
)

Definition at line 291 of file CArray.h.

◆ operator>=()

template<class T , std::size_t N>
bool mrpt::math::operator>= ( const CArray< T, N > &  x,
const CArray< T, N > &  y 
)

Definition at line 299 of file CArray.h.

◆ operator>>() [1/5]

BASE_IMPEXP ::mrpt::utils::CStream& mrpt::math::operator>> ( mrpt::utils::CStream in,
CMatrixBPtr &  pObj 
)

◆ operator>>() [2/5]

BASE_IMPEXP ::mrpt::utils::CStream& mrpt::math::operator>> ( mrpt::utils::CStream in,
CMatrixDPtr &  pObj 
)

◆ operator>>() [3/5]

BASE_IMPEXP ::mrpt::utils::CStream& mrpt::math::operator>> ( mrpt::utils::CStream in,
CMatrixPtr &  pObj 
)

◆ operator>>() [4/5]

BASE_IMPEXP ::mrpt::utils::CStream& mrpt::math::operator>> ( mrpt::utils::CStream in,
CPolygonPtr &  pObj 
)

◆ operator>>() [5/5]

BASE_IMPEXP ::mrpt::utils::CStream& mrpt::math::operator>> ( mrpt::utils::CStream in,
CSplineInterpolator1DPtr &  pObj 
)

◆ resizeLike() [1/2]

template<class EIGEN_CONTAINER >
void mrpt::math::resizeLike ( EIGEN_CONTAINER &  trg,
const EIGEN_CONTAINER &  src 
)

Definition at line 73 of file ops_containers.h.

Referenced by cumsum_tmpl().

◆ resizeLike() [2/2]

template<typename T >
void mrpt::math::resizeLike ( std::vector< T > &  trg,
const std::vector< T > &  src 
)

Definition at line 77 of file ops_containers.h.

◆ size()

template<class MATRIXLIKE >
size_t mrpt::math::size ( const MATRIXLIKE &  m,
int  dim 
)
inline

Returns the size of the matrix in the i'th dimension: 1=rows, 2=columns (MATLAB-compatible function)

Note
Template argument MATRIXLIKE can be: mrpt::math::CMatrixTemplate, mrpt::math::CMatrixTemplateNumeric, mrpt::math::CMatrixFixedNumeric

Definition at line 38 of file bits.h.

References THROW_EXCEPTION_CUSTOM_MSG1.

Referenced by mrpt::poses::CPose3D::CPose3D(), mrpt::maps::CMultiMetricMap::ProxyFilterContainerByClass< mrpt::maps::CHeightGridMap2D_MRFPtr, TListMaps >::empty(), end(), mrpt::pbmap::SemanticClustering::evalPartition(), mrpt::poses::CPoint< CPoint3D >::fromString(), mrpt::poses::CPose3DQuat::fromString(), mrpt::poses::CPose3DRotVec::fromString(), mrpt::poses::CPose3D::fromString(), mrpt::pbmap::getHistogramMeanShift(), mrpt::pbmap::getMultiDimMeanShift_color(), mrpt::maps::CPointsMap::getPCLPointCloud(), mrpt::maps::CColouredPointsMap::getPCLPointCloudXYZRGB(), mrpt::opengl::CPointCloudColoured::getPoint(), mrpt::opengl::CPointCloud::getPoint(), mrpt::maps::CPointsMap::getPointAllFields(), mrpt::opengl::CPointCloudColoured::getPointf(), mrpt::opengl::CPointCloud::getPointf(), mrpt::math::CPolygon::GetVertex_x(), mrpt::math::CPolygon::GetVertex_y(), homogeneousMatrixInverse(), mrpt::vision::CFeatureListKDTree< FEAT >::kdtree_distance(), mrpt::maps::CPointsMap::kdtree_distance(), mrpt::maps::CPointsMap::kdtree_get_point_count(), KLD_Gaussians(), mahalanobisDistance2(), maximum(), mean(), meanAndStdAll(), minimum(), multiply_A_skew3(), multiply_skew3_A(), normalize(), normalPDFInf(), mrpt::opengl::CPointCloudColoured::operator[](), mrpt::opengl::CPointCloud::operator[](), mrpt::vision::CFeatureList::operator[](), push_back(), mrpt::maps::CColouredPointsMap::setPoint(), mrpt::maps::CPointsMap::setPoint(), mrpt::maps::CPointsMap::setPointAllFields(), and mrpt::math::CPolygon::verticesCount().

◆ squareNorm()

template<size_t N, class T , class U >
T mrpt::math::squareNorm ( const U &  v)
inline

Compute the square norm of anything implementing [].

See also
norm

Definition at line 141 of file ops_containers.h.

References mrpt::utils::square().

◆ squareNorm_accum()

template<class CONTAINER , typename VALUE >
VALUE mrpt::math::squareNorm_accum ( const VALUE  total,
const CONTAINER &  v 
)

Accumulate the squared-norm of a vector/array/matrix into "total" (this function is compatible with std::accumulate).

Definition at line 134 of file ops_containers.h.

◆ stddev()

template<class VECTORLIKE >
double mrpt::math::stddev ( const VECTORLIKE &  v,
bool  unbiased = true 
)
inline

Computes the standard deviation of a vector.

Parameters
vThe set of data
unbiasedIf set to true or false the std is normalized by "N-1" or "N", respectively.
See also
math::mean,math::meanAndStd

Definition at line 273 of file ops_containers.h.

References meanAndStd().

Referenced by mrpt::pbmap::getHistogramMeanShift().

◆ sum() [1/2]

template<class CONTAINER >
CONTAINER::Scalar mrpt::math::sum ( const CONTAINER &  v)
inline

Computes the sum of all the elements.

Note
If used with containers of integer types (uint8_t, int, etc...) this could overflow. In those cases, use sumRetType the second argument RET to specify a larger type to hold the sum.
See also
cumsum

Definition at line 166 of file ops_containers.h.

Referenced by mrpt::pbmap::getHistogramMeanShift(), mrpt::pbmap::getMultiDimMeanShift_color(), mean(), meanAndStd(), meanAndStd(), meanAndStdAll(), and mrpt::bayes::CKalmanFilterCapable< 7, 3, 3, 7 >::runOneKalmanIteration().

◆ sum() [2/2]

template<typename T >
T mrpt::math::sum ( const std::vector< T > &  v)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 169 of file ops_containers.h.

◆ sumRetType()

template<class CONTAINER , typename RET >
RET mrpt::math::sumRetType ( const CONTAINER &  v)
inline

Computes the sum of all the elements, with a custom return type.

See also
sum, cumsum

Definition at line 173 of file ops_containers.h.




Page generated by Doxygen 1.8.17 for MRPT 1.4.0 SVN: at Tue Mar 3 09:15:16 UTC 2020