Enumerations | Functions
UMath.h File Reference

Basic mathematics functions. More...

#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< floatuHamming (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 intuLocalMaxima (const std::vector< T > &v)
 
template<class T >
std::list< unsigned intuLocalMaxima (const T *v, unsigned int size)
 
template<class T >
T uMax (const std::vector< T > &v)
 
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 T *v, unsigned int size, unsigned int &index)
 
template<class T >
T uMax3 (const T &a, const T &b, const T &c)
 
template<class T >
T uMean (const std::list< T > &list)
 
template<class T >
T uMean (const std::vector< T > &v)
 
template<class T >
T uMean (const T *v, unsigned int size)
 
template<class T >
T uMeanSquaredError (const std::vector< T > &x, const std::vector< T > &y)
 
template<class T >
T uMeanSquaredError (const T *x, unsigned int sizeX, const T *y, unsigned int sizeY)
 
template<class T >
T uMin (const std::vector< T > &v)
 
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 T *v, unsigned int size, unsigned int &index)
 
template<class T >
T uMin3 (const T &a, const T &b, const T &c)
 
template<class T >
void uMinMax (const std::vector< T > &v, T &min, T &max)
 
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 T *v, unsigned int size, T &min, T &max, unsigned int &indexMin, unsigned int &indexMax)
 
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 std::vector< T > &v)
 
template<class T >
T uSum (const T *v, unsigned int size)
 
template<class T >
T uSumSquared (const std::vector< T > &v, T subtract=T())
 
template<class T >
T uSumSquared (const T *v, unsigned int size, T subtract=T())
 
template<class T >
T uVariance (const std::list< T > &list, const T &m)
 
template<class T >
T uVariance (const std::vector< T > &v, const T &m)
 
template<class T >
T uVariance (const T *v, unsigned int size)
 
template<class T >
T uVariance (const T *v, unsigned int size, T meanV)
 
template<class T >
T uXMatch (const std::vector< T > &vA, const std::vector< T > &vB, unsigned int index, 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 >
std::vector< TuXMatch (const T *vA, const T *vB, unsigned int sizeA, unsigned int sizeB, 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 696 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 919 of file UMath.h.

◆ uIsFinite()

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

Return true if the number is finite.

Definition at line 53 of file UMath.h.

◆ uIsInBounds()

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

Definition at line 932 of file UMath.h.

◆ uIsNan()

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

Return true if the number is NAN.

Definition at line 40 of file UMath.h.

◆ uLocalMaxima() [1/2]

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

Find all local maxima.

Definition at line 687 of file UMath.h.

◆ uLocalMaxima() [2/2]

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

Find all local maxima.

Definition at line 645 of file UMath.h.

◆ uMax() [1/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 144 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 120 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 132 of file UMath.h.

◆ uMax() [4/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 92 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 78 of file UMath.h.

◆ uMean() [1/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 419 of file UMath.h.

◆ uMean() [2/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 439 of file UMath.h.

◆ uMean() [3/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 399 of file UMath.h.

◆ uMeanSquaredError() [1/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 475 of file UMath.h.

◆ uMeanSquaredError() [2/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 453 of file UMath.h.

◆ uMin() [1/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 209 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 185 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 197 of file UMath.h.

◆ uMin() [4/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 157 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 67 of file UMath.h.

◆ uMinMax() [1/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 289 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 262 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 275 of file UMath.h.

◆ uMinMax() [4/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 224 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 573 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 593 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 613 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 623 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 558 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 583 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 603 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 300 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 318 of file UMath.h.

◆ uSum() [2/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 354 of file UMath.h.

◆ uSum() [3/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 335 of file UMath.h.

◆ uSumSquared() [1/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 387 of file UMath.h.

◆ uSumSquared() [2/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 367 of file UMath.h.

◆ uVariance() [1/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 512 of file UMath.h.

◆ uVariance() [2/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 548 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 534 of file UMath.h.

◆ uVariance() [4/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 489 of file UMath.h.

◆ uXMatch() [1/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 909 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 820 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 836 of file UMath.h.

◆ uXMatch() [4/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 708 of file UMath.h.



rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Jul 1 2024 02:42:42