helper functions
More...
#include <utils.h>
|
static void | applyWindow (vector< double > &v) |
| Apply hamming window to v.
|
|
static vector< double > | generateWindow (int s) |
| Generate hamming window of size s.
|
|
static double | sinc (double x) |
| sinc(x) = sin(pi * x) / (pi * x)
|
|
static void | normalize (vector< vector< double > > &v) |
| Apply normalization factor, result is stored in v.
|
|
static void | normalize (vector< double > &v) |
| Apply normalization factor, result is stored in v.
|
|
static void | gain (vector< vector< double > > &v, double g) |
| Apply gain to vector, result is stored in v.
|
|
static void | convolve (vector< double > &v1, const vector< double > &v2) |
| Convolve v1 and v2 using FFT. Result is stored in v1.
|
|
static int | nextPowerOfTwo (int n) |
| Get the next power of 2 that is >= n.
|
|
static vector< complex< double > > | scaleComplex (const vector< complex< double > > &v, double k) |
| Perform scalar multiplication on each complex value.
|
|
static vector< complex< double > > | addComplex (const vector< complex< double > > &u, const vector< complex< double > > &v) |
| Perform element wise addition on complex numbers This method assumes u.size() == v.size()
|
|
◆ addComplex()
static vector< complex< double > > Utils::addComplex |
( |
const vector< complex< double > > & | u, |
|
|
const vector< complex< double > > & | v ) |
|
static |
Perform element wise addition on complex numbers This method assumes u.size() == v.size()
- Parameters
-
u | -> complex vector |
v | -> complex vector |
◆ applyWindow()
static void Utils::applyWindow |
( |
vector< double > & | v | ) |
|
|
static |
Apply hamming window to v.
- Parameters
-
◆ convolve()
static void Utils::convolve |
( |
vector< double > & | v1, |
|
|
const vector< double > & | v2 ) |
|
static |
Convolve v1 and v2 using FFT. Result is stored in v1.
- Parameters
-
v1 | -> vector one |
v2 | -> vector two |
◆ gain()
static void Utils::gain |
( |
vector< vector< double > > & | v, |
|
|
double | g ) |
|
static |
Apply gain to vector, result is stored in v.
- Parameters
-
◆ generateWindow()
static vector< double > Utils::generateWindow |
( |
int | s | ) |
|
|
static |
Generate hamming window of size s.
- Parameters
-
◆ nextPowerOfTwo()
static int Utils::nextPowerOfTwo |
( |
int | n | ) |
|
|
static |
Get the next power of 2 that is >= n.
- Parameters
-
◆ normalize() [1/2]
static void Utils::normalize |
( |
vector< double > & | v | ) |
|
|
static |
Apply normalization factor, result is stored in v.
- Parameters
-
◆ normalize() [2/2]
static void Utils::normalize |
( |
vector< vector< double > > & | v | ) |
|
|
static |
Apply normalization factor, result is stored in v.
- Parameters
-
◆ scaleComplex()
static vector< complex< double > > Utils::scaleComplex |
( |
const vector< complex< double > > & | v, |
|
|
double | k ) |
|
static |
Perform scalar multiplication on each complex value.
- Parameters
-
v | -> vector of complex numbers |
k | -> scalar |
◆ sinc()
static double Utils::sinc |
( |
double | x | ) |
|
|
static |
sinc(x) = sin(pi * x) / (pi * x)
- Parameters
-
The documentation for this class was generated from the following file: