Enumerations | Functions
UMath.h File Reference

Basic mathematics functions. More...

#include "rtabmap/utilite/UtiLiteExp.h"
#include <cmath>
#include <list>
#include <vector>
Include dependency graph for UMath.h:

Go to the source code of this file.

Enumerations

enum  UXMatchMethod {
  UXCorrRaw, UXCorrBiased, UXCorrUnbiased, UXCorrCoeff,
  UXCovRaw, UXCovBiased, UXCovUnbiased, UXCovCoeff
}
 

Functions

std::vector< float > uHamming (unsigned int L)
 
template<class T >
bool uIsFinite (const T &value)
 
template<typename T >
bool uIsInBounds (const T &value, const T &low, const T &high)
 
template<class T >
bool uIsNan (const T &value)
 
template<class T >
std::list< unsigned int > uLocalMaxima (const T *v, unsigned int size)
 
template<class T >
std::list< unsigned int > uLocalMaxima (const std::vector< T > &v)
 
template<class T >
T uMax (const T *v, unsigned int size, unsigned int &index)
 
template<class T >
T uMax (const std::vector< T > &v, unsigned int &index)
 
template<class T >
T uMax (const T *v, unsigned int size)
 
template<class T >
T uMax (const std::vector< T > &v)
 
template<class T >
T uMax3 (const T &a, const T &b, const T &c)
 
template<class T >
T uMean (const T *v, unsigned int size)
 
template<class T >
T uMean (const std::list< T > &list)
 
template<class T >
T uMean (const std::vector< T > &v)
 
template<class T >
T uMeanSquaredError (const T *x, unsigned int sizeX, const T *y, unsigned int sizeY)
 
template<class T >
T uMeanSquaredError (const std::vector< T > &x, const std::vector< T > &y)
 
template<class T >
T uMin (const T *v, unsigned int size, unsigned int &index)
 
template<class T >
T uMin (const std::vector< T > &v, unsigned int &index)
 
template<class T >
T uMin (const T *v, unsigned int size)
 
template<class T >
T uMin (const std::vector< T > &v)
 
template<class T >
T uMin3 (const T &a, const T &b, const T &c)
 
template<class T >
void uMinMax (const T *v, unsigned int size, T &min, T &max, unsigned int &indexMin, unsigned int &indexMax)
 
template<class T >
void uMinMax (const std::vector< T > &v, T &min, T &max, unsigned int &indexMin, unsigned int &indexMax)
 
template<class T >
void uMinMax (const T *v, unsigned int size, T &min, T &max)
 
template<class T >
void uMinMax (const std::vector< T > &v, T &min, T &max)
 
template<class T >
T uNorm (const std::vector< T > &v)
 
template<class T >
T uNorm (const T &x1, const T &x2)
 
template<class T >
T uNorm (const T &x1, const T &x2, const T &x3)
 
template<class T >
std::vector< TuNormalize (const std::vector< T > &v)
 
template<class T >
T uNormSquared (const std::vector< T > &v)
 
template<class T >
T uNormSquared (const T &x1, const T &x2)
 
template<class T >
T uNormSquared (const T &x1, const T &x2, const T &x3)
 
template<class T >
int uSign (const T &v)
 
template<class T >
T uSum (const std::list< T > &list)
 
template<class T >
T uSum (const T *v, unsigned int size)
 
template<class T >
T uSum (const std::vector< T > &v)
 
template<class T >
T uSumSquared (const T *v, unsigned int size, T subtract=T())
 
template<class T >
T uSumSquared (const std::vector< T > &v, T subtract=T())
 
template<class T >
T uVariance (const T *v, unsigned int size, T meanV)
 
template<class T >
T uVariance (const std::list< T > &list, const T &m)
 
template<class T >
T uVariance (const T *v, unsigned int size)
 
template<class T >
T uVariance (const std::vector< T > &v, const T &m)
 
template<class T >
std::vector< TuXMatch (const T *vA, const T *vB, unsigned int sizeA, unsigned int sizeB, UXMatchMethod method)
 
template<class T >
std::vector< TuXMatch (const std::vector< T > &vA, const std::vector< T > &vB, UXMatchMethod method)
 
template<class T >
T uXMatch (const T *vA, const T *vB, unsigned int sizeA, unsigned int sizeB, unsigned int index, UXMatchMethod method)
 
template<class T >
T uXMatch (const std::vector< T > &vA, const std::vector< T > &vB, unsigned int index, UXMatchMethod method)
 

Detailed Description

Basic mathematics functions.

Definition in file UMath.h.

Enumeration Type Documentation

◆ UXMatchMethod

Enum of cross matching methods (cross-correlation, cross-covariance) : UXCorrRaw, UXCorrBiased, UXCorrUnbiased, UXCorrCoeff, UXCovRaw, UXCovBiased, UXCovUnbiased, UXCovCoeff.

Enumerator
UXCorrRaw 
UXCorrBiased 
UXCorrUnbiased 
UXCorrCoeff 
UXCovRaw 
UXCovBiased 
UXCovUnbiased 
UXCovCoeff 

Definition at line 698 of file UMath.h.

Function Documentation

◆ uHamming()

std::vector<float> uHamming ( unsigned int  L)
inline

Return Hamming window of length L.

Parameters
Lthe window length
Returns
the Hamming window (values are between 0 and 1)

Definition at line 921 of file UMath.h.

◆ uIsFinite()

template<class T >
bool uIsFinite ( const T value)
inline

Return true if the number is finite.

Definition at line 55 of file UMath.h.

◆ uIsInBounds()

template<typename T >
bool uIsInBounds ( const T value,
const T low,
const T high 
)

Definition at line 934 of file UMath.h.

◆ uIsNan()

template<class T >
bool uIsNan ( const T value)
inline

Return true if the number is NAN.

Definition at line 42 of file UMath.h.

◆ uLocalMaxima() [1/2]

template<class T >
std::list<unsigned int> uLocalMaxima ( const T v,
unsigned int  size 
)
inline

Find all local maxima.

Definition at line 647 of file UMath.h.

◆ uLocalMaxima() [2/2]

template<class T >
std::list<unsigned int> uLocalMaxima ( const std::vector< T > &  v)
inline

Find all local maxima.

Definition at line 689 of file UMath.h.

◆ uMax() [1/4]

template<class T >
T uMax ( const T v,
unsigned int  size,
unsigned int &  index 
)
inline

Get the maximum of a vector.

Parameters
vthe array
sizethe size of the array
indexthe index of the maximum value in the vector.
Returns
the maximum value of the array

Definition at line 94 of file UMath.h.

◆ uMax() [2/4]

template<class T >
T uMax ( const std::vector< T > &  v,
unsigned int &  index 
)
inline

Get the maximum of a vector.

Parameters
vthe array
indexthe index of the maximum value in the vector.
Returns
the maximum value of the array

Definition at line 122 of file UMath.h.

◆ uMax() [3/4]

template<class T >
T uMax ( const T v,
unsigned int  size 
)
inline

Get the maximum of a vector.

Parameters
vthe array
sizethe size of the array
Returns
the maximum value of the array

Definition at line 134 of file UMath.h.

◆ uMax() [4/4]

template<class T >
T uMax ( const std::vector< T > &  v)
inline

Get the maximum of a vector.

Parameters
vthe array
Returns
the maximum value of the array

Definition at line 146 of file UMath.h.

◆ uMax3()

template<class T >
T uMax3 ( const T a,
const T b,
const T c 
)
inline

Get the maximum of the 3 values.

Returns
the maximum value

Definition at line 80 of file UMath.h.

◆ uMean() [1/3]

template<class T >
T uMean ( const T v,
unsigned int  size 
)
inline

Compute the mean of an array.

Parameters
vthe array
sizethe size of the array
Returns
the mean

Definition at line 401 of file UMath.h.

◆ uMean() [2/3]

template<class T >
T uMean ( const std::list< T > &  list)
inline

Get the mean of a list. Provided for convenience.

Parameters
listthe list
Returns
the mean

Definition at line 421 of file UMath.h.

◆ uMean() [3/3]

template<class T >
T uMean ( const std::vector< T > &  v)
inline

Get the mean of a vector. Provided for convenience.

Parameters
vthe vector
Returns
the mean

Definition at line 441 of file UMath.h.

◆ uMeanSquaredError() [1/2]

template<class T >
T uMeanSquaredError ( const T x,
unsigned int  sizeX,
const T y,
unsigned int  sizeY 
)
inline

Compute mean squared error between two arrays: mean((x-y).^2).

Parameters
xthe first array
sizeXthe size of the array x
ythe second array
sizeYthe size of the array y (must be same size as x)
Returns
the mean squared error (return -1 if error cannot be computed)

Definition at line 455 of file UMath.h.

◆ uMeanSquaredError() [2/2]

template<class T >
T uMeanSquaredError ( const std::vector< T > &  x,
const std::vector< T > &  y 
)
inline

Compute mean squared error between two arrays: mean((x-y).^2).

Parameters
xthe first array
ythe second array (must be same size as x)
Returns
the mean squared error (return -1 if error cannot be computed)

Definition at line 477 of file UMath.h.

◆ uMin() [1/4]

template<class T >
T uMin ( const T v,
unsigned int  size,
unsigned int &  index 
)
inline

Get the minimum of a vector.

Parameters
vthe array
sizethe size of the array
indexthe index of the minimum value in the vector.
Returns
the minimum value of the array

Definition at line 159 of file UMath.h.

◆ uMin() [2/4]

template<class T >
T uMin ( const std::vector< T > &  v,
unsigned int &  index 
)
inline

Get the minimum of a vector.

Parameters
vthe array
indexthe index of the minimum value in the vector.
Returns
the minimum value of the array

Definition at line 187 of file UMath.h.

◆ uMin() [3/4]

template<class T >
T uMin ( const T v,
unsigned int  size 
)
inline

Get the minimum of a vector.

Parameters
vthe array
sizethe size of the array
Returns
the minimum value of the array

Definition at line 199 of file UMath.h.

◆ uMin() [4/4]

template<class T >
T uMin ( const std::vector< T > &  v)
inline

Get the minimum of a vector.

Parameters
vthe array
Returns
the minimum value of the array

Definition at line 211 of file UMath.h.

◆ uMin3()

template<class T >
T uMin3 ( const T a,
const T b,
const T c 
)
inline

Get the minimum of the 3 values.

Returns
the minimum value

Definition at line 69 of file UMath.h.

◆ uMinMax() [1/4]

template<class T >
void uMinMax ( const T v,
unsigned int  size,
T min,
T max,
unsigned int &  indexMin,
unsigned int &  indexMax 
)
inline

Get the minimum and maximum of a vector.

Parameters
vthe array
sizethe size of the array
minreference to output minimum
maxreference to output maximum
minreference to output minimum index
maxreference to output maximum index

Definition at line 226 of file UMath.h.

◆ uMinMax() [2/4]

template<class T >
void uMinMax ( const std::vector< T > &  v,
T min,
T max,
unsigned int &  indexMin,
unsigned int &  indexMax 
)
inline

Get the minimum and maximum of a vector.

Parameters
vthe array
minreference to output minimum
maxreference to output maximum
minreference to output minimum index
maxreference to output maximum index

Definition at line 264 of file UMath.h.

◆ uMinMax() [3/4]

template<class T >
void uMinMax ( const T v,
unsigned int  size,
T min,
T max 
)
inline

Get the minimum and maximum of a vector.

Parameters
vthe array
sizethe size of the array
minreference to output minimum
maxreference to output maximum

Definition at line 277 of file UMath.h.

◆ uMinMax() [4/4]

template<class T >
void uMinMax ( const std::vector< T > &  v,
T min,
T max 
)
inline

Get the minimum and maximum of a vector.

Parameters
vthe array
minreference to output minimum
maxreference to output maximum

Definition at line 291 of file UMath.h.

◆ uNorm() [1/3]

template<class T >
T uNorm ( const std::vector< T > &  v)
inline

Get the norm of the vector : return sqrt(x1*x1 + x2*x2 + x3*x3 + ...)

Returns
the norm of the vector

Definition at line 575 of file UMath.h.

◆ uNorm() [2/3]

template<class T >
T uNorm ( const T x1,
const T x2 
)
inline

Get the norm of the vector : return sqrt(x1*x1 + x2*x2 + x3*x3)

Returns
the norm of the vector

Definition at line 595 of file UMath.h.

◆ uNorm() [3/3]

template<class T >
T uNorm ( const T x1,
const T x2,
const T x3 
)
inline

Get the norm of the vector : return sqrt(x1*x1 + x2*x2 + x3*x3)

Returns
the norm of the vector

Definition at line 615 of file UMath.h.

◆ uNormalize()

template<class T >
std::vector<T> uNormalize ( const std::vector< T > &  v)
inline

Normalize the vector : [x1 x2 x3 ...] ./ uNorm([x1 x2 x3 ...])

Returns
the vector normalized

Definition at line 625 of file UMath.h.

◆ uNormSquared() [1/3]

template<class T >
T uNormSquared ( const std::vector< T > &  v)
inline

Get the squared norm of the vector : return x1*x1 + x2*x2 + x3*x3 + ...

Returns
the squared norm of the vector

Definition at line 560 of file UMath.h.

◆ uNormSquared() [2/3]

template<class T >
T uNormSquared ( const T x1,
const T x2 
)
inline

Get the squared norm of the vector : return x1*x1 + x2*x2

Returns
the squared norm of the vector

Definition at line 585 of file UMath.h.

◆ uNormSquared() [3/3]

template<class T >
T uNormSquared ( const T x1,
const T x2,
const T x3 
)
inline

Get the squared norm of the vector : return x1*x1 + x2*x2 + x3*x3

Returns
the squared norm of the vector

Definition at line 605 of file UMath.h.

◆ uSign()

template<class T >
int uSign ( const T v)
inline

Get the sign of value.

Parameters
vthe value
Returns
-1 if v<0, otherwise 1

Definition at line 302 of file UMath.h.

◆ uSum() [1/3]

template<class T >
T uSum ( const std::list< T > &  list)
inline

Get the sum of all values contained in a list. Provided for convenience.

Parameters
listthe list
Returns
the sum of values of the list

Definition at line 320 of file UMath.h.

◆ uSum() [2/3]

template<class T >
T uSum ( const T v,
unsigned int  size 
)
inline

Get the sum of all values contained in an array: sum(x).

Parameters
vthe array
sizethe size of the array
Returns
the sum of values of the array

Definition at line 337 of file UMath.h.

◆ uSum() [3/3]

template<class T >
T uSum ( const std::vector< T > &  v)
inline

Get the sum of all values contained in a vector. Provided for convenience.

Parameters
vthe vector
Returns
the sum of values of the vector

Definition at line 356 of file UMath.h.

◆ uSumSquared() [1/2]

template<class T >
T uSumSquared ( const T v,
unsigned int  size,
T  subtract = T() 
)
inline

Get the sum of all squared values contained in an array: sum(x.^2).

Parameters
vthe array
sizethe size of the array
subtractan optional value to remove to v before squaring v: sum((x-sub).^2)
Returns
the sum of values of the array

Definition at line 369 of file UMath.h.

◆ uSumSquared() [2/2]

template<class T >
T uSumSquared ( const std::vector< T > &  v,
T  subtract = T() 
)
inline

Get the sum of all squared values contained in an array: sum(x.^2).

Parameters
vthe array
subtractan optional value to remove to v before squaring v: sum((x-sub).^2)
Returns
the sum of values of the array

Definition at line 389 of file UMath.h.

◆ uVariance() [1/4]

template<class T >
T uVariance ( const T v,
unsigned int  size,
T  meanV 
)
inline

Compute the variance of an array.

Parameters
vthe array
sizethe size of the array
meanVthe mean of the array
Returns
the variance
See also
mean()

Definition at line 491 of file UMath.h.

◆ uVariance() [2/4]

template<class T >
T uVariance ( const std::list< T > &  list,
const T m 
)
inline

Get the variance of a list. Provided for convenience.

Parameters
listthe list
mthe mean of the list
Returns
the variance
See also
mean()

Definition at line 514 of file UMath.h.

◆ uVariance() [3/4]

template<class T >
T uVariance ( const T v,
unsigned int  size 
)
inline

Compute the variance of an array.

Parameters
vthe array
sizethe size of the array
Returns
the variance

Definition at line 536 of file UMath.h.

◆ uVariance() [4/4]

template<class T >
T uVariance ( const std::vector< T > &  v,
const T m 
)
inline

Get the variance of a vector. Provided for convenience.

Parameters
vthe vector
mthe mean of the vector
Returns
the variance
See also
mean()

Definition at line 550 of file UMath.h.

◆ uXMatch() [1/4]

template<class T >
std::vector<T> uXMatch ( const T vA,
const T vB,
unsigned int  sizeA,
unsigned int  sizeB,
UXMatchMethod  method 
)
inline

Do a full cross-correlation or cross-covariance between 2 arrays.

Parameters
vAthe first array
vBthe second array
sizeAthe size of the first array
sizeBthe size of the second array
methodsee UXMatchMethod
Returns
the resulting correlation/covariance vector of size = sizeA + sizeB - 1

Definition at line 710 of file UMath.h.

◆ uXMatch() [2/4]

template<class T >
std::vector<T> uXMatch ( const std::vector< T > &  vA,
const std::vector< T > &  vB,
UXMatchMethod  method 
)
inline

Do a full cross-correlation or cross-covariance between 2 arrays.

Parameters
vAthe first array
vBthe second array
methodsee UXMatchMethod
Returns
the resulting correlation/covariance vector of size = sizeA + sizeB - 1

Definition at line 822 of file UMath.h.

◆ uXMatch() [3/4]

template<class T >
T uXMatch ( const T vA,
const T vB,
unsigned int  sizeA,
unsigned int  sizeB,
unsigned int  index,
UXMatchMethod  method 
)
inline

Do a cross correlation between 2 arrays at a specified index.

Parameters
vAthe first array
vBthe second array
sizeAthe size of the first array
sizeBthe size of the second array
indexthe index to correlate
methodsee UXMatchMethod
Returns
the resulting correlation value

Definition at line 838 of file UMath.h.

◆ uXMatch() [4/4]

template<class T >
T uXMatch ( const std::vector< T > &  vA,
const std::vector< T > &  vB,
unsigned int  index,
UXMatchMethod  method 
)
inline

Do a cross correlation between 2 arrays at a specified index.

Parameters
vAthe first array
vBthe second array
sizeAthe size of the first array
sizeBthe size of the second array
indexthe index to correlate
methodsee UXMatchMethod
Returns
the resulting correlation value

Definition at line 911 of file UMath.h.



rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Jan 23 2023 03:38:59