comparison maths/MathUtilities.h @ 123:a37635bbb2c1

Some (but not all) MathUtilities unit tests, and accompanying fixes
author Chris Cannam
date Fri, 04 Oct 2013 18:34:30 +0100
parents e5907ae6de17
children 5351b5e9ad9f
comparison
equal deleted inserted replaced
122:2b5b37255db2 123:a37635bbb2c1
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