Mercurial > hg > qm-dsp
comparison maths/MathUtilities.h @ 348:50fae18236ee
Some (but not all) MathUtilities unit tests, and accompanying fixes
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 04 Oct 2013 18:34:30 +0100 |
parents | d5014ab8b0e5 |
children | a067c2eeb13c |
comparison
equal
deleted
inserted
replaced
347:e3dedded9c4d | 348:50fae18236ee |
---|---|
49 NormaliseNone, | 49 NormaliseNone, |
50 NormaliseUnitSum, | 50 NormaliseUnitSum, |
51 NormaliseUnitMax | 51 NormaliseUnitMax |
52 }; | 52 }; |
53 | 53 |
54 static void normalise(double *data, int length, | 54 static void normalise(double *data, int length, |
55 NormaliseType n = NormaliseUnitMax); | 55 NormaliseType n = NormaliseUnitMax); |
56 | 56 |
57 static void normalise(std::vector<double> &data, | 57 static void normalise(std::vector<double> &data, |
58 NormaliseType n = NormaliseUnitMax); | 58 NormaliseType n = NormaliseUnitMax); |
59 | 59 |
60 // moving mean threshholding: | 60 // moving mean threshholding: |
61 static void adaptiveThreshold(std::vector<double> &data); | 61 static void adaptiveThreshold(std::vector<double> &data); |
62 | 62 |
63 static bool isPowerOfTwo(int x); | 63 static bool isPowerOfTwo(int x); |
64 static int nextPowerOfTwo(int x); // e.g. 1300 -> 2048, 2048 -> 2048 | 64 static int nextPowerOfTwo(int x); // e.g. 1300 -> 2048, 2048 -> 2048 |
65 static int previousPowerOfTwo(int x); // e.g. 1300 -> 1024, 2048 -> 2048 | 65 static int previousPowerOfTwo(int x); // e.g. 1300 -> 1024, 2048 -> 2048 |
66 static int nearestPowerOfTwo(int x); // e.g. 1300 -> 1024, 1700 -> 2048 | 66 static int nearestPowerOfTwo(int x); // e.g. 1300 -> 1024, 12 -> 16 (not 8) |
67 | |
68 static int factorial(int x); | |
67 }; | 69 }; |
68 | 70 |
69 #endif | 71 #endif |