Mercurial > hg > multitrack-audio-matcher
comparison bayesianArraySrc/DynamicVector.h @ 0:c4f9e49226eb
Initialising repository. Live osc input registered. Files analysed offline.
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Tue, 31 Jan 2012 13:54:17 +0000 |
parents | |
children | 179c09199b3c |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c4f9e49226eb |
---|---|
1 /* | |
2 * DynamicVector.h | |
3 * midiCannamReader | |
4 * | |
5 * Created by Andrew on 18/07/2011. | |
6 * Copyright 2011 QMUL. All rights reserved. | |
7 * | |
8 */ | |
9 | |
10 //OPTIMIZE CONSTRAINED VECTOR | |
11 | |
12 #include "stdlib.h" | |
13 #include "ofMain.h" | |
14 #include "ofxWindowRegion.h" | |
15 | |
16 #ifndef _DYNAMIC_VECTOR | |
17 #define _DYNAMIC_VECTOR | |
18 #define GAUSSIAN_LOOKUP_LENGTH 1000000 | |
19 | |
20 class DynamicVector{ | |
21 public: | |
22 DynamicVector(); | |
23 | |
24 void createVector(int len); | |
25 void renormalise(); | |
26 void translateDistribution(int translationIndex); | |
27 typedef std::vector<double> DoubleVector; | |
28 DoubleVector array; | |
29 double getMaximum(); | |
30 double getIntegratedEstimate(); | |
31 double getLookupIndex(const int& i, const double& mean, const double& StdDev); | |
32 void addGaussianShapeByLookupTable(double& mean, double& StdDev, double factor); | |
33 double gaussianLookupTable[GAUSSIAN_LOOKUP_LENGTH]; | |
34 double gaussianLookupMean, gaussianLookupStdDev; | |
35 double integratedEstimate; | |
36 void updateIntegratedEstimate(); | |
37 void updateLimitedIntegratedEstimate(); | |
38 | |
39 void drawVector(const int& minIndex, const int& maxIndex); | |
40 void drawVector(const int& minIndex, const int& maxIndex, ofxWindowRegion window); | |
41 | |
42 void drawConstrainedVector(const int& minIndex, const int& maxIndex, const int& minScreenIndex, const int& maxScreenIndex); | |
43 | |
44 void addConstant(const double& value); | |
45 void addGaussianShape(const double& mean, const double& stddev, double factor); | |
46 void addTriangularShape(double mean, double width, double factor); | |
47 void addToIndex(const int& index, const double& constant); | |
48 | |
49 void doProduct(DynamicVector& arrayOne, DynamicVector& arrayTwo); | |
50 | |
51 double getIndexInRealTerms(const int& index); | |
52 double getRealTermsAsIndex(double value); | |
53 double getValueAtMillis(const double& millis); | |
54 | |
55 void printArray(); | |
56 void zero(); | |
57 | |
58 void copyFromDynamicVector(const DynamicVector& dynamicVec); | |
59 | |
60 //variables | |
61 int length, arraySize; | |
62 double maximumValue; | |
63 int MAPestimate; | |
64 | |
65 double offset; | |
66 double scalar;//each array point is this much of the quantity | |
67 //i.e. array[index] contributes to (offset + scalar*index) in real terms | |
68 | |
69 }; | |
70 | |
71 #endif |