Mercurial > hg > midi-score-follower
comparison hackday/DynamicVector.h @ 28:49a5b023df1e
Hackday files comitted - version as demo'd at London hackday
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Mon, 05 Dec 2011 07:00:47 +0000 |
parents | |
children | 9a70d9abdc8b |
comparison
equal
deleted
inserted
replaced
27:fa1890efa044 | 28:49a5b023df1e |
---|---|
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 | |
15 #ifndef _DYNAMIC_VECTOR | |
16 #define _DYNAMIC_VECTOR | |
17 #define GAUSSIAN_LOOKUP_LENGTH 1000000 | |
18 | |
19 class DynamicVector{ | |
20 public: | |
21 DynamicVector(); | |
22 | |
23 void createVector(int len); | |
24 void renormalise(); | |
25 void translateDistribution(int translationIndex); | |
26 typedef std::vector<double> DoubleVector; | |
27 DoubleVector array; | |
28 double getMaximum(); | |
29 double getIntegratedEstimate(); | |
30 double getLookupIndex(const int& i, const double& mean, const double& StdDev); | |
31 void addGaussianShapeByLookupTable(double& mean, double& StdDev, double factor); | |
32 double gaussianLookupTable[GAUSSIAN_LOOKUP_LENGTH]; | |
33 double gaussianLookupMean, gaussianLookupStdDev; | |
34 double integratedEstimate; | |
35 void updateIntegratedEstimate(); | |
36 | |
37 void drawVector(const int& minIndex, const int& maxIndex); | |
38 void drawConstrainedVector(const int& minIndex, const int& maxIndex, const int& minScreenIndex, const int& maxScreenIndex); | |
39 | |
40 void addConstant(const double& value); | |
41 void addGaussianShape(const double& mean, const double& stddev, double factor); | |
42 void addTriangularShape(double mean, double width, double factor); | |
43 void addToIndex(const int& index, const double& constant); | |
44 | |
45 void doProduct(DynamicVector& arrayOne, DynamicVector& arrayTwo); | |
46 | |
47 double getIndexInRealTerms(const int& index); | |
48 double getRealTermsAsIndex(double value); | |
49 double getValueAtMillis(const double& millis); | |
50 | |
51 void printArray(); | |
52 void zero(); | |
53 | |
54 void copyFromDynamicVector(const DynamicVector& dynamicVec); | |
55 | |
56 //variables | |
57 int length, arraySize; | |
58 double maximumValue; | |
59 int MAPestimate; | |
60 | |
61 double offset; | |
62 double scalar;//each array point is this much of the quantity | |
63 //i.e. array[index] contributes to (offset + scalar*index) in real terms | |
64 | |
65 }; | |
66 | |
67 #endif |