|
Namespaces |
namespace | mrpt |
| The main namespace for all the Mobile Robot Programming Toolkit (MRPT) C++ libraries.
|
namespace | mrpt::math |
| This base provides a set of functions for maths stuff.
|
Functions |
bool MRPTDLLIMPEXP | mrpt::math::loadVector (utils::CFileStream &f, std::vector< int > &d) |
| Loads one row of a text file as a numerical std::vector.
|
bool MRPTDLLIMPEXP | mrpt::math::loadVector (utils::CFileStream &f, std::vector< double > &d) |
| Loads one row of a text file as a numerical std::vector.
|
bool MRPTDLLIMPEXP | mrpt::math::isNan (float v) |
| Returns true if value is Not-a-number (NAN).
|
bool MRPTDLLIMPEXP | mrpt::math::isNan (double v) |
| Returns true if value is Not-a-number (NAN).
|
bool MRPTDLLIMPEXP | mrpt::math::isFinite (float v) |
| Returns true if value is finite.
|
bool MRPTDLLIMPEXP | mrpt::math::isFinite (double v) |
| Returns true if value is finite.
|
template<class T > |
size_t | mrpt::math::countNonZero (const std::vector< T > &a) |
| A template for counting how many elements in an array are non-Zero.
|
template<class T > |
T | mrpt::math::maximum (const std::vector< T > &v, unsigned int *maxIndex=NULL) |
| Finds the maximum value (and the corresponding zero-based index) from a given vector.
|
template<class T > |
T | mrpt::math::norm_inf (const std::vector< T > &v, unsigned int *maxIndex=NULL) |
| Compute the norm-infinite of a vector ($f[ ||{v}||_ $f]), ie the maximum absolute value of the elements.
|
template<class T > |
T | mrpt::math::norm (const std::vector< T > &v) |
| Compute the 2-norm of the vector (the Euclidean distance to the origin).
|
template<class T > |
T | mrpt::math::minimum (const std::vector< T > &v, unsigned int *minIndex=NULL) |
| Finds the maximum value (and the corresponding zero-based index) from a given vector.
|
template<class T > |
void | mrpt::math::minimum_maximum (const std::vector< T > &v, T &out_min, T &out_max, unsigned int *minIndex=NULL, unsigned int *maxIndex=NULL) |
| Compute the minimum and maximum of a vector at once.
|
template<class T > |
double | mrpt::math::mean (const std::vector< T > &v) |
| Computes the mean value of a vector.
|
template<class T > |
T | mrpt::math::sum (const std::vector< T > &v) |
| Computes the sum of all the elements of a vector.
|
template<typename T , typename K > |
void | mrpt::math::linspace (T first, T last, size_t count, std::vector< K > &out_vector) |
| Generates an equidistant sequence of numbers given the first one, the last one and the desired number of points.
|
template<class T > |
std::vector< T > | mrpt::math::linspace (T first, T last, size_t count) |
| Generates an equidistant sequence of numbers given the first one, the last one and the desired number of points.
|
template<class T > |
std::vector< T > | mrpt::math::ones (size_t count) |
| Generates a vector of all ones of the given length.
|
template<class T > |
std::vector< T > | mrpt::math::zeros (size_t count) |
| Generates a vector of all zeros of the given length.
|
template<class T > |
void | mrpt::math::normalize (const std::vector< T > &v, std::vector< T > &out_v) |
| Normalize a vector, such as its norm is the unity.
|
template<class T > |
std::vector< T > | mrpt::math::cumsum (const std::vector< T > &v) |
| Computes the cumulative sum of all the elements of a vector.
|
template<class T > |
void | mrpt::math::cumsum (const std::vector< T > &v, std::vector< T > &out_cumsum) |
| Computes the cumulative sum of all the elements of a vector, saving the result in a given vector.
|
template<class T > |
double | mrpt::math::stddev (const std::vector< T > &v, bool unbiased=true) |
| Computes the standard deviation of a vector.
|
template<class T > |
void | mrpt::math::meanAndStd (const std::vector< T > &v, double &out_mean, double &out_std, bool unbiased=true) |
| Computes the standard deviation of a vector.
|
template<class T > |
void | mrpt::math::weightedHistogram (const std::vector< T > &values, const std::vector< T > &weights, float binWidth, std::vector< float > &out_binCenters, std::vector< float > &out_binValues) |
| Computes the weighted histogram for a vector of values and their corresponding weights.
|
uint64_t MRPTDLLIMPEXP | mrpt::math::factorial64 (unsigned int n) |
| Computes the factorial of an integer number and returns it as a 64-bit integer number.
|
double MRPTDLLIMPEXP | mrpt::math::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).
|
template<class T > |
void | mrpt::math::wrapTo2PiInPlace (T &a) |
| Modifies the given angle to translate it into the [0,2pi[ range.
|
template<class T > |
T | mrpt::math::wrapTo2Pi (T a) |
| Modifies the given angle to translate it into the [0,2pi[ range.
|
template<class T > |
T | mrpt::math::wrapToPi (T a) |
| Modifies the given angle to translate it into the ]-pi,pi] range.
|
template<class T > |
void | mrpt::math::wrapToPiInPlace (T &a) |
| Modifies the given angle to translate it into the ]-pi,pi] range.
|
template<class T > |
T | mrpt::math::round2up (T val) |
| Round up to the nearest power of two of a given number.
|
template<class T > |
T | mrpt::math::round_10power (T val, int power10) |
| Round a decimal number up to the given 10'th power (eg, to 1000,100,10, and also fractions) power10 means round up to: 1 -> 10, 2 -> 100, 3 -> 1000, .
|
template<class T > |
void | mrpt::math::chol (const CMatrixTemplateNumeric< T > &in, CMatrixTemplateNumeric< T > &out) |
| Cholesky factorization: in = out' ยท out Given a positive-definite symmetric matrix, this routine constructs its Cholesky decomposition.
|
template<class T > |
double | mrpt::math::correlate_matrix (const CMatrixTemplateNumeric< T > &a1, const CMatrixTemplateNumeric< T > &a2) |
| Calculate the correlation between two matrices (by AJOGD @ JAN-2007).
|
template<class T > |
void MRPTDLLIMPEXP | mrpt::math::qr_decomposition (CMatrixTemplateNumeric< T > &A, CMatrixTemplateNumeric< T > &R, CMatrixTemplateNumeric< T > &Q, CVectorTemplate< T > &c, int &sing) |
| Matrix QR decomposition.
|
template<class T > |
void MRPTDLLIMPEXP | mrpt::math::UpdateCholesky (CMatrixTemplateNumeric< T > &chol, CVectorTemplate< T > &r1Modification) |
| If R = CHOL(A) is the original Cholesky factorization of A, then R1 = CHOLUPDATE(R,X) returns the upper triangular Cholesky factor of A + X*X', where X is a column vector of appropriate length.
|
void MRPTDLLIMPEXP | mrpt::math::computeEigenValues2x2 (const CMatrixFloat &in_matrix, float &min_eigenvalue, float &max_eigenvalue) |
| Compute the two eigenvalues of a 2x2 matrix.
|
template<class T > |
std::vector< T > | mrpt::math::Exp (const std::vector< T > &v) |
| Computes the 'exp' of all the elements of a vector.
|
template<class T > |
std::vector< T > | mrpt::math::Log (const std::vector< T > &v) |
| Computes the 'log' of all the elements of a vector.
|
double MRPTDLLIMPEXP | mrpt::math::averageLogLikelihood (const vector_double &logLikelihoods) |
| A numerically-stable method to compute average likelihood values with strongly different ranges (unweighted likelihoods: compute the arithmetic mean).
|
double MRPTDLLIMPEXP | mrpt::math::averageLogLikelihood (const vector_double &logWeights, const vector_double &logLikelihoods) |
| A numerically-stable method to average likelihood values with strongly different ranges (weighted likelihoods).
|
std::string MRPTDLLIMPEXP | mrpt::math::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).
|
void MRPTDLLIMPEXP | mrpt::math::homogeneousMatrixInverse (const CMatrixDouble &M, CMatrixDouble &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.
|
template<class T > |
size_t | mrpt::math::countCommonElements (const std::vector< T > &a, const std::vector< T > &b) |
| Counts the number of elements that appear in both vectors (comparison through the == operator) It is assumed that no repeated elements appear within each of the vectors.
|
template<class T > |
T | mrpt::math::interpolate (const T &x, const std::vector< T > &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".
|
void MRPTDLLIMPEXP | mrpt::math::estimateJacobian (const vector_double &x, utils::TFunctor_retVecDbl_inp2VecDbl functor, const vector_double &increments, const vector_double &userParam, math::CMatrixDouble &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.
|
double MRPTDLLIMPEXP | mrpt::math::spline (const double t, const std::vector< double > &x, const std::vector< double > &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).
|
template<class T > |
vector_double | mrpt::math::histogram (const std::vector< T > &v, double limit_min, double limit_max, size_t number_bins, bool do_normalization=false) |
| Computes the normalized or normal histogram of a sequence of numbers given the number of bins and the limits.
|
template<typename T , typename At , size_t N> |
std::vector< T > & | mrpt::math::loadVector (std::vector< T > &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).
|
template<class T > |
std::vector< T > | mrpt::math::Abs (const std::vector< T > &a) |
| Absolute value of a vector.
|