![]() |
Namespaces | |
mrpt | |
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. | |
Files | |
file | ops_containers.h |
This file implements several operations that operate element-wise on individual or pairs of containers. | |
Functions | |
template<class Derived > | |
const Eigen::MatrixBase< Derived >::AdjointReturnType | mrpt::math::operator~ (const Eigen::MatrixBase< Derived > &m) |
Transpose operator for matrices. More... | |
template<class Derived > | |
Eigen::MatrixBase< Derived >::PlainObject | mrpt::math::operator! (const Eigen::MatrixBase< Derived > &m) |
Unary inversion operator. More... | |
template<class T > | |
std::ostream & | mrpt::math::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 & | mrpt::math::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::CStream & | mrpt::math::operator<< (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::CStream & | mrpt::math::operator>> (mrpt::utils::CStream &istrm, CArrayNumeric< T, N > &a) |
Binary read of a CArrayNumeric<T,N> from a stream. More... | |
bool BASE_IMPEXP | mrpt::math::loadVector (utils::CFileStream &f, std::vector< int > &d) |
Loads one row of a text file as a numerical std::vector. More... | |
bool BASE_IMPEXP | mrpt::math::loadVector (utils::CFileStream &f, std::vector< double > &d) |
Loads one row of a text file as a numerical std::vector. More... | |
bool BASE_IMPEXP | mrpt::math::isNaN (float f) MRPT_NO_THROWS |
Returns true if the number is NaN. More... | |
bool BASE_IMPEXP | mrpt::math::isNaN (double f) MRPT_NO_THROWS |
Returns true if the number is NaN. More... | |
bool BASE_IMPEXP | mrpt::math::isFinite (float f) MRPT_NO_THROWS |
Returns true if the number is non infinity. More... | |
bool BASE_IMPEXP | mrpt::math::isFinite (double f) MRPT_NO_THROWS |
Returns true if the number is non infinity. More... | |
void BASE_IMPEXP | mrpt::math::medianFilter (const std::vector< double > &inV, std::vector< double > &outV, const int &winSize, const int &numberOfSigmas=2) |
template<typename T , typename VECTOR > | |
void | mrpt::math::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 > | mrpt::math::sequenceStdVec (T first, size_t length) |
Generates a sequence of values [first,first+STEP,first+2*STEP,...]. More... | |
template<class VEC1 , class VEC2 > | |
void | mrpt::math::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 | mrpt::math::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 | mrpt::math::factorial64 (unsigned int n) |
Computes the factorial of an integer number and returns it as a 64-bit integer number. More... | |
double BASE_IMPEXP | 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). More... | |
template<class T > | |
T | mrpt::math::round2up (T val) |
Round up to the nearest power of two of a given number. More... | |
template<typename EIGEN_VECTOR , typename At , size_t N> | |
EIGEN_VECTOR & | mrpt::math::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 > & | mrpt::math::loadVector (std::vector< T > &v, At(&theArray)[N]) |
template<size_t N, typename T > | |
std::vector< T > | mrpt::math::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 T > | |
void | mrpt::math::wrapTo2PiInPlace (T &a) |
Modifies the given angle to translate it into the [0,2pi[ range. More... | |
template<class T > | |
T | mrpt::math::wrapTo2Pi (T a) |
Modifies the given angle to translate it into the [0,2pi[ range. More... | |
template<class T > | |
T | mrpt::math::wrapToPi (T a) |
Modifies the given angle to translate it into the ]-pi,pi] range. More... | |
template<class T > | |
void | mrpt::math::wrapToPiInPlace (T &a) |
Modifies the given angle to translate it into the ]-pi,pi] range. More... | |
template<class VECTOR > | |
void | mrpt::math::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 > | |
T | mrpt::math::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... | |
Operators for binary streaming of MRPT matrices | |
template<size_t NROWS, size_t NCOLS> | |
mrpt::utils::CStream & | mrpt::math::operator>> (mrpt::utils::CStream &in, CMatrixFixedNumeric< float, NROWS, NCOLS > &M) |
Read operator from a CStream. More... | |
template<size_t NROWS, size_t NCOLS> | |
mrpt::utils::CStream & | mrpt::math::operator>> (mrpt::utils::CStream &in, CMatrixFixedNumeric< double, NROWS, NCOLS > &M) |
Read operator from a CStream. More... | |
template<size_t NROWS, size_t NCOLS> | |
mrpt::utils::CStream & | mrpt::math::operator<< (mrpt::utils::CStream &out, const CMatrixFixedNumeric< float, NROWS, NCOLS > &M) |
Write operator for writing into a CStream. More... | |
template<size_t NROWS, size_t NCOLS> | |
mrpt::utils::CStream & | mrpt::math::operator<< (mrpt::utils::CStream &out, const CMatrixFixedNumeric< double, NROWS, NCOLS > &M) |
Write operator for writing into a CStream. More... | |
Operators for text streaming of MRPT matrices | |
template<typename T , size_t NROWS, size_t NCOLS> | |
std::ostream & | mrpt::math::operator<< (std::ostream &s, const CMatrixFixedNumeric< T, NROWS, NCOLS > &m) |
Dumps the matrix to a text ostream, adding a final "\n" to Eigen's default output. More... | |
template<typename T > | |
std::ostream & | mrpt::math::operator<< (std::ostream &s, const CMatrixTemplateNumeric< T > &m) |
Dumps the matrix to a text ostream, adding a final "\n" to Eigen's default output. More... | |
Generic std::vector element-wise operations | |
template<typename T1 , typename T2 > | |
std::vector< T1 > & | mrpt::math::operator*= (std::vector< T1 > &a, const std::vector< T2 > &b) |
a*=b (element-wise multiplication) More... | |
template<typename T1 > | |
std::vector< T1 > & | mrpt::math::operator*= (std::vector< T1 > &a, const T1 b) |
a*=k (multiplication by a constant) More... | |
template<typename T1 , typename T2 > | |
std::vector< T1 > | mrpt::math::operator* (const std::vector< T1 > &a, const std::vector< T2 > &b) |
a*b (element-wise multiplication) More... | |
template<typename T1 , typename T2 > | |
std::vector< T1 > & | mrpt::math::operator+= (std::vector< T1 > &a, const std::vector< T2 > &b) |
a+=b (element-wise sum) More... | |
template<typename T1 > | |
std::vector< T1 > & | mrpt::math::operator+= (std::vector< T1 > &a, const T1 b) |
a+=b (sum a constant) More... | |
template<typename T1 , typename T2 > | |
std::vector< T1 > | mrpt::math::operator+ (const std::vector< T1 > &a, const std::vector< T2 > &b) |
a+b (element-wise sum) More... | |
template<typename T1 , typename T2 > | |
std::vector< T1 > | mrpt::math::operator- (const std::vector< T1 > &v1, const std::vector< T2 > &v2) |
|
inline |
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.
near +-pi) Examples: angDistance(0,pi) -> +pi; angDistance(pi,0) -> -pi; angDistance(-3.1,3.1) -> -0.08; angDistance(3.1,-3.1) -> +0.08;
Definition at line 91 of file wrap2pi.h.
References M_PI, and mrpt::math::wrapToPiInPlace().
Referenced by mrpt::nav::PoseDistanceMetric< TNodeSE2 >::distance().
|
inline |
Extract a column from a vector of vectors, and store it in another vector.
For the sake of generality, this function does NOT check the limits in the number of column, unless it's implemented in the [] operator of each of the "rows".
Definition at line 117 of file base/include/mrpt/math/utils.h.
References BASE_IMPEXP, mrpt::math::factorial(), and mrpt::math::factorial64().
double BASE_IMPEXP 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).
Referenced by mrpt::math::extractColumnFromVectorOfVectors().
uint64_t BASE_IMPEXP mrpt::math::factorial64 | ( | unsigned int | n | ) |
Computes the factorial of an integer number and returns it as a 64-bit integer number.
Referenced by mrpt::math::extractColumnFromVectorOfVectors().
bool BASE_IMPEXP mrpt::math::isFinite | ( | float | f | ) |
Returns true if the number is non infinity.
bool BASE_IMPEXP mrpt::math::isFinite | ( | double | f | ) |
Returns true if the number is non infinity.
bool BASE_IMPEXP mrpt::math::isNaN | ( | float | f | ) |
Returns true if the number is NaN.
bool BASE_IMPEXP mrpt::math::isNaN | ( | double | f | ) |
Returns true if the number is NaN.
void mrpt::math::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.
Definition at line 64 of file base/include/mrpt/math/utils.h.
bool BASE_IMPEXP mrpt::math::loadVector | ( | utils::CFileStream & | f, |
std::vector< int > & | d | ||
) |
Loads one row of a text file as a numerical std::vector.
bool BASE_IMPEXP mrpt::math::loadVector | ( | utils::CFileStream & | f, |
std::vector< double > & | d | ||
) |
Loads one row of a text file as a numerical std::vector.
EIGEN_VECTOR& mrpt::math::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).
Definition at line 189 of file base/include/mrpt/math/utils.h.
References MRPT_COMPILE_TIME_ASSERT.
std::vector<T>& mrpt::math::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.
Definition at line 199 of file base/include/mrpt/math/utils.h.
References MRPT_COMPILE_TIME_ASSERT.
std::vector<T> mrpt::math::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.
Some examples:
Definition at line 218 of file base/include/mrpt/math/utils.h.
References MRPT_COMPILE_TIME_ASSERT.
void BASE_IMPEXP mrpt::math::medianFilter | ( | const std::vector< double > & | inV, |
std::vector< double > & | outV, | ||
const int & | winSize, | ||
const int & | numberOfSigmas = 2 |
||
) |
void mrpt::math::normalize | ( | const VEC1 & | v, |
VEC2 & | out_v | ||
) |
Normalize a vector, such as its norm is the unity.
If the vector has a null norm, the output is a null vector.
Definition at line 96 of file base/include/mrpt/math/utils.h.
References mrpt::utils::square().
|
inline |
Unary inversion operator.
Definition at line 38 of file ops_matrices.h.
|
inline |
a*b (element-wise multiplication)
Definition at line 59 of file ops_vectors.h.
References ASSERT_EQUAL_.
Referenced by octomath::Quaternion::operator()(), and octomath::Pose6D::yaw().
|
inline |
a*=b (element-wise multiplication)
Definition at line 40 of file ops_vectors.h.
References ASSERT_EQUAL_.
Referenced by mrpt::poses::CPose3D::changeCoordinatesReference(), mrpt::poses::CPose3DQuat::operator-(), mrpt::poses::CPose2D::operator-(), and octomath::Pose6D::yaw().
|
inline |
a*=k (multiplication by a constant)
Definition at line 50 of file ops_vectors.h.
|
inline |
a+b (element-wise sum)
Definition at line 89 of file ops_vectors.h.
References ASSERT_EQUAL_.
Referenced by mrpt::poses::CPose3D::operator+().
|
inline |
a+=b (element-wise sum)
Definition at line 70 of file ops_vectors.h.
References ASSERT_EQUAL_.
Referenced by mrpt::poses::CPosePDFSOG::erase(), mrpt::poses::CPosePDFGaussian::getCovarianceAndMean(), mrpt::poses::CPosePDFGaussianInf::getInformationMatrix(), mrpt::obs::CSensoryFrame::insertObservationsInto(), mrpt::poses::CPose3DQuatPDFGaussian::operator-(), mrpt::poses::CPose3DQuatPDFGaussianInf::operator-(), mrpt::poses::CPose3DPDFGaussianInf::operator-(), mrpt::poses::CPose3DPDFGaussian::operator-(), mrpt::poses::CPose2D::operator-(), mrpt::poses::CPose3DPDFParticles::size(), and mrpt::poses::CPosePDFParticles::size().
|
inline |
a+=b (sum a constant)
Definition at line 80 of file ops_vectors.h.
|
inline |
Definition at line 99 of file ops_vectors.h.
References ASSERT_EQUAL_.
mrpt::utils::CStream& mrpt::math::operator<< | ( | mrpt::utils::CStream & | out, |
const CMatrixFixedNumeric< float, NROWS, NCOLS > & | M | ||
) |
Write operator for writing into a CStream.
The format is compatible with that of CMatrix & CMatrixD
Definition at line 51 of file matrix_serialization.h.
mrpt::utils::CStream& mrpt::math::operator<< | ( | mrpt::utils::CStream & | out, |
const CMatrixFixedNumeric< double, NROWS, NCOLS > & | M | ||
) |
Write operator for writing into a CStream.
The format is compatible with that of CMatrix & CMatrixD
Definition at line 58 of file matrix_serialization.h.
|
inline |
Dumps the matrix to a text ostream, adding a final "\n" to Eigen's default output.
Definition at line 73 of file matrix_serialization.h.
|
inline |
Dumps the matrix to a text ostream, adding a final "\n" to Eigen's default output.
Definition at line 81 of file matrix_serialization.h.
std::ostream& mrpt::math::operator<< | ( | std::ostream & | out, |
const std::vector< T > & | d | ||
) |
A template function for printing out the contents of a std::vector variable.
Definition at line 112 of file ops_vectors.h.
std::ostream& mrpt::math::operator<< | ( | std::ostream & | out, |
std::vector< T > * | d | ||
) |
A template function for printing out the contents of a std::vector variable.
Definition at line 127 of file ops_vectors.h.
mrpt::utils::CStream& mrpt::math::operator<< | ( | mrpt::utils::CStream & | ostrm, |
const CArrayNumeric< T, N > & | a | ||
) |
Binary dump of a CArrayNumeric<T,N> to a stream.
Definition at line 141 of file ops_vectors.h.
mrpt::utils::CStream& mrpt::math::operator>> | ( | mrpt::utils::CStream & | in, |
CMatrixFixedNumeric< float, NROWS, NCOLS > & | M | ||
) |
Read operator from a CStream.
The format is compatible with that of CMatrix & CMatrixD
Definition at line 32 of file matrix_serialization.h.
References ASSERTMSG_, mrpt::format(), and mrpt::utils::CStream::ReadObject().
mrpt::utils::CStream& mrpt::math::operator>> | ( | mrpt::utils::CStream & | in, |
CMatrixFixedNumeric< double, NROWS, NCOLS > & | M | ||
) |
Read operator from a CStream.
The format is compatible with that of CMatrix & CMatrixD
Definition at line 41 of file matrix_serialization.h.
References ASSERTMSG_, mrpt::format(), and mrpt::utils::CStream::ReadObject().
mrpt::utils::CStream& mrpt::math::operator>> | ( | mrpt::utils::CStream & | istrm, |
CArrayNumeric< T, N > & | a | ||
) |
Binary read of a CArrayNumeric<T,N> from a stream.
Definition at line 150 of file ops_vectors.h.
References ASSERTMSG_, mrpt::format(), and mrpt::utils::CStream::ReadBufferFixEndianness().
|
inline |
Transpose operator for matrices.
Definition at line 32 of file ops_matrices.h.
T mrpt::math::round2up | ( | T | val | ) |
Round up to the nearest power of two of a given number.
Definition at line 136 of file base/include/mrpt/math/utils.h.
References BASE_IMPEXP, mrpt::math::MATLAB_plotCovariance2D(), mrpt::math::mean(), and THROW_EXCEPTION.
|
inline |
Generates a sequence of values [first,first+STEP,first+2*STEP,...].
Definition at line 83 of file base/include/mrpt/math/utils.h.
void mrpt::math::unwrap2PiSequence | ( | VECTOR & | x | ) |
Modify a sequence of angle values such as no consecutive values have a jump larger than PI in absolute value.
Definition at line 70 of file wrap2pi.h.
References M_PI, and mrpt::math::wrapToPiInPlace().
|
inline |
Modifies the given angle to translate it into the [0,2pi[ range.
Definition at line 40 of file wrap2pi.h.
References mrpt::math::wrapTo2PiInPlace().
Referenced by mrpt::math::operator!=(), mrpt::math::operator==(), and mrpt::math::wrapToPi().
|
inline |
Modifies the given angle to translate it into the [0,2pi[ range.
Definition at line 28 of file wrap2pi.h.
References M_PI.
Referenced by mrpt::math::wrapTo2Pi().
|
inline |
Modifies the given angle to translate it into the ]-pi,pi] range.
Definition at line 51 of file wrap2pi.h.
References M_PI, and mrpt::math::wrapTo2Pi().
Referenced by mrpt::graphs::detail::graph_ops< graph_t >::auxEuclid2Dist(), mrpt::math::covariancesAndMeanWeighted(), mrpt::math::leastSquareLinearFit(), and mrpt::math::wrapToPiInPlace().
|
inline |
Modifies the given angle to translate it into the ]-pi,pi] range.
Definition at line 61 of file wrap2pi.h.
References mrpt::math::wrapToPi().
Referenced by mrpt::math::angDistance(), mrpt::graphs::detail::graph_ops< graph_t >::auxMaha2Dist(), and mrpt::math::unwrap2PiSequence().
Page generated by Doxygen 1.8.11 for MRPT 1.4.0 SVN:Unversioned directory at Mon May 30 18:20:32 UTC 2016 |