c@241
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
c@241
|
2
|
c@241
|
3 /*
|
c@241
|
4 QM DSP Library
|
c@241
|
5
|
c@241
|
6 Centre for Digital Music, Queen Mary, University of London.
|
c@241
|
7 This file copyright 2005-2006 Christian Landone.
|
c@241
|
8 All rights reserved.
|
c@241
|
9 */
|
c@241
|
10
|
c@241
|
11 #ifndef MATHUTILITIES_H
|
c@241
|
12 #define MATHUTILITIES_H
|
c@241
|
13
|
c@241
|
14 #include <vector>
|
c@241
|
15
|
c@241
|
16 class MathUtilities
|
c@241
|
17 {
|
c@241
|
18 public:
|
c@241
|
19 static double round( double x );
|
c@259
|
20
|
c@241
|
21 static void getFrameMinMax( const double* data, unsigned int len, double* min, double* max );
|
c@259
|
22
|
c@241
|
23 static double mean( const double* src, unsigned int len );
|
c@241
|
24 static double sum( const double* src, unsigned int len );
|
c@259
|
25 static double median( const double* src, unsigned int len );
|
c@259
|
26
|
c@241
|
27 static double princarg( double ang );
|
c@241
|
28 static double mod( double x, double y);
|
c@259
|
29
|
c@241
|
30 static void getAlphaNorm(const double *data, unsigned int len, unsigned int alpha, double* ANorm);
|
c@241
|
31 static double getAlphaNorm(const std::vector <double> &data, unsigned int alpha );
|
c@259
|
32
|
c@241
|
33 static void circShift( double* data, int length, int shift);
|
c@259
|
34
|
c@241
|
35 static int getMax( double* data, unsigned int length, double* max );
|
c@241
|
36 static int compareInt(const void * a, const void * b);
|
c@259
|
37
|
c@259
|
38 enum NormaliseType {
|
c@259
|
39 NormaliseNone,
|
c@259
|
40 NormaliseUnitSum,
|
c@259
|
41 NormaliseUnitMax
|
c@259
|
42 };
|
c@259
|
43
|
c@259
|
44 static void normalise(double *data, int length,
|
c@259
|
45 NormaliseType n = NormaliseUnitMax);
|
c@259
|
46
|
c@259
|
47 static void normalise(std::vector<double> &data,
|
c@259
|
48 NormaliseType n = NormaliseUnitMax);
|
c@241
|
49 };
|
c@241
|
50
|
c@241
|
51 #endif
|