SAF
Loading...
Searching...
No Matches
saf_utility_misc.h File Reference

A collection of miscellaneous functions. More...

Go to the source code of this file.

Macros

#define SAF_CASSERT(predicate, file)   _impl_CASSERT_LINE(predicate,__LINE__,file)
 A compile time assertion check.
 
#define _impl_PASTE(a, b)   a##b
 CASSERT helper macro.
 
#define _impl_CASSERT_LINE(predicate, line, file)    typedef char _impl_PASTE(assertion_failed_##file##_,line)[2*!!(predicate)-1];
 CASSERT helper macro.
 

Functions

void convert_0_360To_m180_180 (float *dirs_deg, int nDirs)
 Wraps around any angles exeeding 180 degrees (e.g., 200-> -160)
 
int nextpow2 (int numsamp)
 A simple function which returns the next power of 2.
 
void lagrangeWeights (int N, float *x, int len_x, float *weights)
 Computes Lagrange interpolation weights of order 'N' for value 'x'.
 
void findERBpartitions (float *centerFreq, int nBands, float maxFreqLim, int **erb_idx, float **erb_freqs, int *nERBBands)
 This function takes a frequency vector and groups its frequencies into critical bands [Equivalent-Rectangular Bandwidth (ERB)].
 
void randperm (int len, int *randperm_inds)
 Returns the indices required to randomly permute a vector of length 'len'.
 
long double factorial (int n)
 Factorial, accurate up to n<=25.
 
float matlab_fmodf (float x, float y)
 C fmodf function, except it behaves like 'mod' in Matlab (i.e.
 
void cxcorr (float *a, float *b, float *x_ab, size_t la, size_t lb)
 Calculates the cross correlation between two vectors.
 
void rand_m1_1 (float *vector, int length)
 Generates random numbers between -1 and 1 and stores them in the input vector.
 
void rand_cmplx_m1_1 (float_complex *vector, int length)
 Generates random numbers between -1 and 1 and stores them in the input vector for both the real and imaginary parts.
 
void rand_0_1 (float *vector, int length)
 Generates random numbers between 0 and 1 and stores them in the input vector.
 
void convd (double *x, double *h, int len_x, int len_h, double *y)
 Basic 1-D direct convolution in the time-domain (real double precision)
 
void convz (double_complex *x, double_complex *h, int len_x, int len_h, double_complex *y)
 Basic 1-D direct convolution in the time-domain (complex double precision)
 
void polyd_v (double *x, double *poly, int len_x)
 Convert roots of a vector to polynomial (real double precision)
 
void polyz_v (double_complex *x, double_complex *poly, int len_x)
 Convert roots of a vector to polynomial (complex double precision)
 
void polyd_m (double *X, double_complex *poly, int size_x)
 Convert roots of a matrix to polynomial (real double precision)
 
float sumf (float *values, int nValues)
 Returns the sum of all values.
 
int anyLessThanf (float *values, int nValues, float threshold)
 Returns 1, if any value in 'values' (nValues x 1) is less than 'threshold', otherwise, it returns 0.
 
void unique_i (int *input, int nInputs, int **uniqueVals, int **uniqueInds, int *nUnique)
 Finds the unique values (and their indices) of the input vector.
 
void findCombinations (int *arrValues, int nValues, int nElements, int **comb, int *nComb)
 Given an array of values, find all the possible combinations (nCr) for subgroups of "nElements"; derived based on [1].
 
void gexpm (float *D, int sizeD, int m1, float *Y)
 Numerically solves first-order, linear, homogeneous differential equation systems, with non-constant coefficients, by generalization of the Pade- approximant method for exponential matrices.
 

Detailed Description

A collection of miscellaneous functions.

Author
Leo McCormack
Date
29.01.2020
License
ISC

Definition in file saf_utility_misc.h.