SPRAAK
Functions
sspmod_math_fun.c File Reference

Execute some mathematical functions in a (ssp-)standard way, checking/updating keys if necessary. More...

Functions

void spr_math_fun_free (SprSspInfo *Info)
 
int spr_math_fun_setup (SprSspInfo *Info, const char **descript, void *aux_info)
 
int spr_math_fun_process (SprSspInfo *Info, const void *frame_in, void *frame_out)
 

Detailed Description

Execute some mathematical functions in a (ssp-)standard way, checking/updating keys if necessary.


[math_fun]
dB2pow [given/jah/normal] [b]
Calculates exp10(input/10.0)/b, with 'b' [given/2^(-15)(jah)/1.0(normal)]. Default normal.
pow2dB [given/jah/normal] [a] [b]
Calculates 10.0*log10(a+b*input), with 'a' [given/1.0(jah)/0.0(normal)] and 'b' [given/2^(-15)/1.0]. Default normal.
floor <low_val> [replace_val]
Replace values smaller than <low_val> by <replace_val> (default: <low_val>).
clip [low_val](0.0) [hi_val](1.0)
Replace values smaller than <low_val> by <low_val>. Replace values higher than <hi_val> by <hi_val>.
nan <replace/error> [replace_val](0.0)
Check for NaNs in the input. Either replace them silently with <replace_val> or given an error.
energy
Calculates energy in input vector: sum(x[i]^2).
magnitude
Calculates the magnitude of the input vector: sum(|x[i]|).
min
Get the lowest value from the input vector: min_i(x[i]).
max
Get the highest value from the input vector: max_i(x[i]).
min max
Get the lowest and highest value from the input vector: [min_i(x[i]),max_i(x[i])].
pow <p> [sign/abs](abs)
Compute sign(x[i])*|x[i]|^p or |x[i]|^p.
norm [p](1)
Compute the p-norm and normalize the vector.
softmax [a](1.0)
Compute the softmax of the input after scaling with <a>.
sigmoid [a](1.0)
Compute sigmoid(x[i]*a).

See also
ssp_master.c
Date
21 Nov 1994
Author
Jacques Duchateau
Revision History:
12/07/2019 - KD
Added a whole lot of extra functions + full code rewrite (efficiency)