com.tagtraum.jipes.math

## Class MapFunctions

• ### Field Summary

Fields
Modifier and Type Field and Description
`static MapFunction<float[]>` `AUTO_CORRELATION`
`static MapFunction<float[]>` `AUTO_CORRELATION_BIASED`
Auto correlation function normalized with the number of samples, i.e.
`static MapFunction<float[]>` `AUTO_CORRELATION_COEFF`
Auto correlation function normalized with the first coefficient (global maximum).
`static MapFunction<float[]>` `AUTO_CORRELATION_UNBIASED`
Auto correlation function normalized with the number of samples minus abs(t), i.e.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static MapFunction<float[]>` `createAbsFunction()`
Removes sign.
`static StatefulMapFunction<Float>` `createArithmeticMeanFunction()`
Maps consecutive samples to their arithmetic mean.
`static MapFunction<float[]>` `createDivByMaxNormalization()`
Divides all values by the max value in the given buffer.
`static MapFunction<float[]>` `createEuclideanNormalization()`
Divides all values by the Euclidean norm of the the given buffer.
`static StatefulMapFunction<Float>` `createFractionFunction(float threshold)`
Keeps track of values that are below a given threshold and returns the fraction of values that were below this threshold.
`static MapFunction<float[]>` ```createInterpolateFunction(float shift, int indicesPerOneShift)```
Creates a linear interpolation function.
`static MapFunction<float[]>` `createReverseFunction()`
Reverses the order of the elements in each array.
`static MapFunction<float[]>` `createShortToOneNormalization()`
Assumes that all values are signed 16bit values and divides them by `Short.MAX_VALUE`+1 in order to map them to a range of -1 to 1.
`static MapFunction<float[]>` `createSquareFunction()`
Squares all values.
`static StatefulMapFunction<Float>` `createStandardDeviationFunction()`
Maps consecutive samples to their standard deviation.
`static StatefulMapFunction<Float>` `createTemporalCentroidFunction()`
Maps consecutive samples to their temporal centroid.
`static StatefulMapFunction<Float>` `createVarianceFunction()`
Maps consecutive samples to their variance.
`static MapFunction<float[]>` `createWrapFunction(int length)`
Creates wrap function.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### AUTO_CORRELATION_COEFF

`public static final MapFunction<float[]> AUTO_CORRELATION_COEFF`
Auto correlation function normalized with the first coefficient (global maximum). I.e. all values are between 0 and 1.
Matlab™ function `xcorr(..., 'coeff')`
• #### AUTO_CORRELATION_BIASED

`public static final MapFunction<float[]> AUTO_CORRELATION_BIASED`
Auto correlation function normalized with the number of samples, i.e. `biased(t) = r(t)/N`.
Matlab™ function `xcorr(..., 'biased')`
• #### AUTO_CORRELATION_UNBIASED

`public static final MapFunction<float[]> AUTO_CORRELATION_UNBIASED`
Auto correlation function normalized with the number of samples minus abs(t), i.e. `unbiased(t) = r(t)/(N-|t|)`
Matlab™ function `xcorr(..., 'unbiased')`
• ### Method Detail

• #### createAbsFunction

`public static MapFunction<float[]> createAbsFunction()`
Removes sign.
Returns:
array with absolute values
• #### createSquareFunction

`public static MapFunction<float[]> createSquareFunction()`
Squares all values.
Returns:
arrays of squared values
• #### createEuclideanNormalization

`public static MapFunction<float[]> createEuclideanNormalization()`
Divides all values by the Euclidean norm of the the given buffer.
Returns:
normalization
• #### createDivByMaxNormalization

`public static MapFunction<float[]> createDivByMaxNormalization()`
Divides all values by the max value in the given buffer.
Returns:
normalization
• #### createShortToOneNormalization

`public static MapFunction<float[]> createShortToOneNormalization()`
Assumes that all values are signed 16bit values and divides them by `Short.MAX_VALUE`+1 in order to map them to a range of -1 to 1.
Returns:
normalization
• #### createReverseFunction

`public static MapFunction<float[]> createReverseFunction()`
Reverses the order of the elements in each array.
Returns:
array with reversed order
• #### createWrapFunction

`public static MapFunction<float[]> createWrapFunction(int length)`
Creates wrap function.
Parameters:
`length` - length
Returns:
wrap function
• #### createInterpolateFunction

```public static MapFunction<float[]> createInterpolateFunction(float shift,
int indicesPerOneShift)```
Creates a linear interpolation function.
Parameters:
`shift` - shift amount between -1 and 1
`indicesPerOneShift` - number of indices the values need to be shifted, when the (normalized) shift is 1.
Returns:
linear interpolation function
• #### createTemporalCentroidFunction

`public static StatefulMapFunction<Float> createTemporalCentroidFunction()`
Maps consecutive samples to their temporal centroid. This can e.g. be used in a `Mapping`.
Returns:
mean function
• #### createVarianceFunction

`public static StatefulMapFunction<Float> createVarianceFunction()`
Maps consecutive samples to their variance. This can e.g. be used in a `Mapping`.
Returns:
variance function
• #### createStandardDeviationFunction

`public static StatefulMapFunction<Float> createStandardDeviationFunction()`
Maps consecutive samples to their standard deviation. This can e.g. be used in a `Mapping`.
Returns:
standard deviation function
• #### createArithmeticMeanFunction

`public static StatefulMapFunction<Float> createArithmeticMeanFunction()`
Maps consecutive samples to their arithmetic mean. This can e.g. be used in a `Mapping`.
Returns:
mean function
• #### createFractionFunction

`public static StatefulMapFunction<Float> createFractionFunction(float threshold)`
Keeps track of values that are below a given threshold and returns the fraction of values that were below this threshold.
Parameters:
`threshold` - threshold (excl.)
Returns:
fraction function