Mercurial > hg > qm-dsp
comparison maths/MathUtilities.h @ 34:ad645e404d0c
* Add range of normalise options to chromagram
* bit of tidying
author | cannam |
---|---|
date | Tue, 22 Jan 2008 17:27:07 +0000 |
parents | 2e3f5d2d62c1 |
children | 5bec06ecc88a |
comparison
equal
deleted
inserted
replaced
33:499d438b52ba | 34:ad645e404d0c |
---|---|
15 | 15 |
16 class MathUtilities | 16 class MathUtilities |
17 { | 17 { |
18 public: | 18 public: |
19 static double round( double x ); | 19 static double round( double x ); |
20 | |
20 static void getFrameMinMax( const double* data, unsigned int len, double* min, double* max ); | 21 static void getFrameMinMax( const double* data, unsigned int len, double* min, double* max ); |
22 | |
21 static double mean( const double* src, unsigned int len ); | 23 static double mean( const double* src, unsigned int len ); |
22 static double sum( const double* src, unsigned int len ); | 24 static double sum( const double* src, unsigned int len ); |
25 static double median( const double* src, unsigned int len ); | |
26 | |
23 static double princarg( double ang ); | 27 static double princarg( double ang ); |
24 static double median( const double* src, unsigned int len ); | |
25 static double mod( double x, double y); | 28 static double mod( double x, double y); |
29 | |
26 static void getAlphaNorm(const double *data, unsigned int len, unsigned int alpha, double* ANorm); | 30 static void getAlphaNorm(const double *data, unsigned int len, unsigned int alpha, double* ANorm); |
27 static double getAlphaNorm(const std::vector <double> &data, unsigned int alpha ); | 31 static double getAlphaNorm(const std::vector <double> &data, unsigned int alpha ); |
32 | |
28 static void circShift( double* data, int length, int shift); | 33 static void circShift( double* data, int length, int shift); |
34 | |
29 static int getMax( double* data, unsigned int length, double* max ); | 35 static int getMax( double* data, unsigned int length, double* max ); |
30 static int compareInt(const void * a, const void * b); | 36 static int compareInt(const void * a, const void * b); |
37 | |
38 enum NormaliseType { | |
39 NormaliseNone, | |
40 NormaliseUnitSum, | |
41 NormaliseUnitMax | |
42 }; | |
43 | |
44 static void normalise(double *data, int length, | |
45 NormaliseType n = NormaliseUnitMax); | |
46 | |
47 static void normalise(std::vector<double> &data, | |
48 NormaliseType n = NormaliseUnitMax); | |
31 }; | 49 }; |
32 | 50 |
33 #endif | 51 #endif |