MRPT  1.9.9

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::CMatrixFixedNumeric, mrpt::math::CMatrixTemplate.

In general, any container having a type "mrpt_autotype" self-referencing to the type itself, and a dummy struct mrpt_container<> which is only used as a way to force the compiler to assure that BOTH containers are valid ones in binary operators. This restrictions have been designed as a way to provide "polymorphism" at a template level, so the "+,-,..." operators do not generate ambiguities for ANY type, and limiting them to MRPT containers.

In some cases, the containers provide specializations of some operations, for increased performance.

Definition in file ops_containers.h.

#include <mrpt/math/types_math.h>
#include <mrpt/math/lightweight_geom_data.h>
#include <functional>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <mrpt/math/CHistogram.h>
#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.

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 , typename VALUE >
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 >
CONTAINER::Scalar mrpt::math::maximum (const CONTAINER &v)
 
template<class CONTAINER >
CONTAINER::Scalar mrpt::math::minimum (const CONTAINER &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 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. 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 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020