UtiLite
0.3.1
A lite utilities library
|
Basic mathematics functions. More...
#include "utilite/UtiLiteExp.h"
#include <cmath>
#include <list>
#include <vector>
Go to the source code of this file.
Enumerations | |
enum | UXMatchMethod |
Functions | |
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 | 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 > | |
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 > | |
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 | 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 | uStdDev (const T *v, unsigned int size, T meanV) |
template<class T > | |
T | uStdDev (const std::list< T > &list, const T &m) |
template<class T > | |
T | uStdDev (const T *v, unsigned int size) |
template<class T > | |
T | uStdDev (const std::vector< T > &v, const T &m) |
template<class T > | |
T | uNorm (const std::vector< T > &v) |
template<class T > | |
std::vector< T > | uNormalize (const std::vector< T > &v) |
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 > | |
std::vector< T > | uXMatch (const T *vA, const T *vB, unsigned int sizeA, unsigned int sizeB, UXMatchMethod method) |
template<class T > | |
std::vector< T > | uXMatch (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) |
std::vector< float > | uHamming (unsigned int L) |
Basic mathematics functions.
enum UXMatchMethod |
Enum of cross matching methods (cross-correlation, cross-covariance) : UXCorrRaw, UXCorrBiased, UXCorrUnbiased, UXCorrCoeff, UXCovRaw, UXCovBiased, UXCovUnbiased, UXCovCoeff.
std::vector<float> uHamming | ( | unsigned int | L | ) | [inline] |
Return Hamming window of length L.
L | the window length |
std::list<unsigned int> uLocalMaxima | ( | const T * | v, |
unsigned int | size | ||
) | [inline] |
Find all local maxima.
std::list<unsigned int> uLocalMaxima | ( | const std::vector< T > & | v | ) | [inline] |
Find all local maxima.
T uMax | ( | const T * | v, |
unsigned int | size, | ||
unsigned int & | index | ||
) | [inline] |
Get the maximum of a vector.
v | the array |
size | the size of the array |
index | the index of the maximum value in the vector. |
T uMax | ( | const std::vector< T > & | v, |
unsigned int & | index | ||
) | [inline] |
Get the maximum of a vector.
v | the array |
index | the index of the maximum value in the vector. |
T uMax | ( | const T * | v, |
unsigned int | size | ||
) | [inline] |
Get the maximum of a vector.
v | the array |
size | the size of the array |
T uMax | ( | const std::vector< T > & | v | ) | [inline] |
Get the maximum of a vector.
v | the array |
T uMean | ( | const T * | v, |
unsigned int | size | ||
) | [inline] |
Compute the mean of an array.
v | the array |
size | the size of the array |
T uMean | ( | const std::list< T > & | list | ) | [inline] |
Get the mean of a list. Provided for convenience.
list | the list |
T uMean | ( | const std::vector< T > & | v | ) | [inline] |
Get the mean of a vector. Provided for convenience.
v | the vector |
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).
x | the first array |
sizeX | the size of the array x |
y | the second array |
sizeY | the size of the array y (must be same size as x) |
T uMeanSquaredError | ( | const std::vector< T > & | x, |
const std::vector< T > & | y | ||
) | [inline] |
Compute mean squared error between two arrays: mean((x-y).^2).
x | the first array |
y | the second array (must be same size as x) |
T uMin | ( | const T * | v, |
unsigned int | size, | ||
unsigned int & | index | ||
) | [inline] |
Get the minimum of a vector.
v | the array |
size | the size of the array |
index | the index of the minimum value in the vector. |
T uMin | ( | const std::vector< T > & | v, |
unsigned int & | index | ||
) | [inline] |
Get the minimum of a vector.
v | the array |
index | the index of the minimum value in the vector. |
T uMin | ( | const T * | v, |
unsigned int | size | ||
) | [inline] |
Get the minimum of a vector.
v | the array |
size | the size of the array |
T uMin | ( | const std::vector< T > & | v | ) | [inline] |
Get the minimum of a vector.
v | the array |
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.
v | the array |
size | the size of the array |
min | reference to output minimum |
max | reference to output maximum |
min | reference to output minimum index |
max | reference to output maximum index |
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.
v | the array |
min | reference to output minimum |
max | reference to output maximum |
min | reference to output minimum index |
max | reference to output maximum index |
void uMinMax | ( | const T * | v, |
unsigned int | size, | ||
T & | min, | ||
T & | max | ||
) | [inline] |
Get the minimum and maximum of a vector.
v | the array |
size | the size of the array |
min | reference to output minimum |
max | reference to output maximum |
void uMinMax | ( | const std::vector< T > & | v, |
T & | min, | ||
T & | max | ||
) | [inline] |
Get the minimum and maximum of a vector.
v | the array |
min | reference to output minimum |
max | reference to output maximum |
T uNorm | ( | const std::vector< T > & | v | ) | [inline] |
Get the norm of the vector : return sqrt(x1*x1 + x2*x2 + x3*x3 + ...)
std::vector<T> uNormalize | ( | const std::vector< T > & | v | ) | [inline] |
Normalize the vector : [x1 x2 x3 ...] ./ uNorm([x1 x2 x3 ...])
int uSign | ( | const T & | v | ) | [inline] |
Get the sign of value.
v | the value |
T uStdDev | ( | const T * | v, |
unsigned int | size, | ||
T | meanV | ||
) | [inline] |
Compute the standard deviation of an array.
v | the array |
size | the size of the array |
meanV | the mean of the array |
T uStdDev | ( | const std::list< T > & | list, |
const T & | m | ||
) | [inline] |
Get the standard deviation of a list. Provided for convenience.
list | the list |
m | the mean of the list |
T uStdDev | ( | const T * | v, |
unsigned int | size | ||
) | [inline] |
Compute the standard deviation of an array.
v | the array |
size | the size of the array |
T uStdDev | ( | const std::vector< T > & | v, |
const T & | m | ||
) | [inline] |
Get the standard deviation of a vector. Provided for convenience.
v | the vector |
m | the mean of the vector |
T uSum | ( | const std::list< T > & | list | ) | [inline] |
Get the sum of all values contained in a list. Provided for convenience.
list | the list |
T uSum | ( | const T * | v, |
unsigned int | size | ||
) | [inline] |
Get the sum of all values contained in an array: sum(x).
v | the array |
size | the size of the array |
T uSum | ( | const std::vector< T > & | v | ) | [inline] |
Get the sum of all values contained in a vector. Provided for convenience.
v | the vector |
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).
v | the array |
size | the size of the array |
subtract | an optional value to remove to v before squaring v: sum((x-sub).^2) |
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).
v | the array |
subtract | an optional value to remove to v before squaring v: sum((x-sub).^2) |
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.
vA | the first array |
vB | the second array |
sizeA | the size of the first array |
sizeB | the size of the second array |
method | see UXMatchMethod |
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.
vA | the first array |
vB | the second array |
method | see UXMatchMethod |
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.
vA | the first array |
vB | the second array |
sizeA | the size of the first array |
sizeB | the size of the second array |
index | the index to correlate |
method | see UXMatchMethod |
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.
vA | the first array |
vB | the second array |
sizeA | the size of the first array |
sizeB | the size of the second array |
index | the index to correlate |
method | see UXMatchMethod |