MRPT  2.0.2
Classes | Namespaces | Functions

This file implements several operations that operate element-wise on individual or pairs of containers. More...

Detailed Description

This file implements several operations that operate element-wise on individual or pairs of containers.

Containers here means any of: mrpt::math::CVectorTemplace, mrpt::math::CArray, mrpt::math::CMatrixFixed, mrpt::math::CMatrixDynamic.

Definition in file ops_containers.h.

#include <mrpt/core/bits_math.h>
#include <mrpt/math/CHistogram.h>
#include <mrpt/math/math_frwds.h>
#include <algorithm>
#include <cmath>
#include <functional>
#include <numeric>
#include <type_traits>
#include "ops_vectors.h"
Include dependency graph for ops_containers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mrpt::math::ContainerType< CONTAINER >
 ContainerType<T>::element_t exposes the value of any STL or Eigen container. More...
 
struct  mrpt::math::ContainerType< Eigen::EigenBase< Derived > >
 Specialization for Eigen containers. More...
 
struct  mrpt::math::ContainerType< mrpt::math::MatrixVectorBase< Scalar, Derived > >
 Specialization for MRPT containers. More...
 

Namespaces

 mrpt::math
 This base provides a set of functions for maths stuff.
 

Functions

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=nullptr)
 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 mrpt::math::resizeLike (EIGEN_CONTAINER &trg, const EIGEN_CONTAINER &src)
 
template<typename T >
void mrpt::math::resizeLike (std::vector< T > &trg, const std::vector< T > &src)
 
template<class CONTAINER1 , class CONTAINER2 >
void mrpt::math::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 CONTAINER1 , class CONTAINER2 >
void mrpt::math::cumsum (const CONTAINER1 &in_data, CONTAINER2 &out_cumsum)
 
template<class CONTAINER >
CONTAINER mrpt::math::cumsum (const CONTAINER &in_data)
 Computes the cumulative sum of all the elements. More...
 
template<class CONTAINER >
CONTAINER::Scalar mrpt::math::norm_inf (const CONTAINER &v)
 
template<class CONTAINER >
CONTAINER::Scalar mrpt::math::norm (const CONTAINER &v)
 
template<class CONTAINER , int = CONTAINER::is_mrpt_type>
CONTAINER::Scalar mrpt::math::maximum (const CONTAINER &v)
 
template<class CONTAINER , int = CONTAINER::is_mrpt_type>
CONTAINER::Scalar mrpt::math::minimum (const CONTAINER &v)
 
template<class Derived >
Derived::Scalar mrpt::math::maximum (const Eigen::MatrixBase< Derived > &v)
 
template<class Derived >
Derived::Scalar mrpt::math::minimum (const Eigen::MatrixBase< Derived > &v)
 
template<typename T >
mrpt::math::maximum (const std::vector< T > &v)
 
template<typename T >
mrpt::math::minimum (const std::vector< T > &v)
 
Generic container element-wise operations - Miscelaneous
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). More...
 
template<size_t N, class T , class U >
mrpt::math::squareNorm (const U &v)
 Compute the square norm of anything implementing []. More...
 
template<class CONTAINER1 , class CONTAINER2 >
CONTAINER1::Scalar mrpt::math::dotProduct (const CONTAINER1 &v1, const CONTAINER1 &v2)
 v1*v2: The dot product of two containers (vectors/arrays/matrices) More...
 
template<size_t N, class T , class U , class V >
mrpt::math::dotProduct (const U &v1, const V &v2)
 v1*v2: The dot product of any two objects supporting [] More...
 
template<class CONTAINER >
CONTAINER::Scalar mrpt::math::sum (const CONTAINER &v)
 Computes the sum of all the elements. More...
 
template<typename T >
mrpt::math::sum (const std::vector< T > &v)
 
template<class CONTAINER , typename RET >
RET mrpt::math::sumRetType (const CONTAINER &v)
 Computes the sum of all the elements, with a custom return type. More...
 
template<class CONTAINER >
double mrpt::math::mean (const CONTAINER &v)
 Computes the mean value of a vector. More...
 
template<typename T >
void mrpt::math::minimum_maximum (const std::vector< T > &V, T &curMin, T &curMax)
 Return the maximum and minimum values of a std::vector. More...
 
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)
 Return the maximum and minimum values of a Eigen-based vector or matrix. More...
 
template<class CONTAINER , typename Scalar >
void mrpt::math::normalize (CONTAINER &c, Scalar valMin, Scalar valMax)
 Scales all elements such as the minimum & maximum values are shifted to the given values. More...
 
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. More...
 
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. More...
 
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 (or all elements of a matrix) More...
 
template<class VECTORLIKE >
double mrpt::math::stddev (const VECTORLIKE &v, bool unbiased=true)
 Computes the standard deviation of a vector. More...
 
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. More...
 
template<class VECTOR_OF_VECTOR , class RETURN_MATRIX >
RETURN_MATRIX mrpt::math::covVector (const VECTOR_OF_VECTOR &v)
 Computes the covariance matrix from a list of values given as a vector of vectors, where each row is a sample. More...
 
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. More...
 



Page generated by Doxygen 1.8.14 for MRPT 2.0.2 Git: 9b4fd2465 Mon May 4 16:59:08 2020 +0200 at lun may 4 17:26:07 CEST 2020