comparison src/DynamicBayesianArray.h @ 0:b299a65a3ad0

start project
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Tue, 16 Aug 2011 11:29:59 +0100
parents
children c7107e5c8f03
comparison
equal deleted inserted replaced
-1:000000000000 0:b299a65a3ad0
1 /*
2 * DynamicBayesianArray.h
3 * midiCannamReader
4 *
5 * Created by Andrew on 17/07/2011.
6 * Copyright 2011 QMUL. All rights reserved.
7 *
8 */
9
10 /*
11 * DynamicBayesianArray.cpp
12 * bayesianTest5
13 *
14 * Created by Andrew Robertson on 08/05/2010.
15 * Copyright 2010 __MyCompanyName__. All rights reserved.
16 *
17 */
18
19 /*
20 * DynamicBayesianArray.h
21 * bayesianTest5
22 *
23 * Created by Andrew Robertson on 08/05/2010.
24 * Copyright 2010 __MyCompanyName__. All rights reserved.
25 *
26 */
27
28 #include "ofMain.h"
29
30 #include "DynamicVector.h"
31
32 #ifndef _DYNAMIC_BAYESIAN_ARRAY
33 #define _DYNAMIC_BAYESIAN_ARRAY
34
35 #define ARRAY_SIZE 240
36
37
38 class DynamicBayesianArray{
39
40 public:
41
42 DynamicBayesianArray();
43 void initialiseArray();
44
45 // void setGaussianLikelihoodForBeats(float mean, float StdDev);
46 void setGaussianLikelihood(float mean, float StdDev);
47 void setGaussianPrior(float mean, float StdDev);
48 void setGaussianPosterior(float mean, float StdDev);
49
50 void calculatePosterior();
51 void renormalisePosterior();
52 void resetMaximumPosterior();//resets the max index
53 void decayPosteriorWithGaussianNoise();
54 void translateDistribution(int translationIndex);
55 void setDecayNoiseGaussian(float mean, float StdDev);
56 double calculateStandardDeviation();
57
58 int arraySize;
59
60
61 float getMaximum(float *ptr, int length);
62 void renormaliseArray(float *ptr, int length);
63 void resetPrior();
64 void decayPosterior();
65 float* getMaximumEstimate(float *ptr, int length);
66 double getIntegratedEstimateIndex();
67
68 // void drawArray(const int& minIndex, const int& maxIndex);
69 void drawFloatArray(float* arrayToDraw, const int& minIndex, const int& maxIndex);
70 void drawDoubleArray(double* arrayToDraw, const int& minIndex, const int& maxIndex);
71
72
73 typedef std::vector<double> DoubleVector;
74 // typedef std::vector<IntVector> DoubleMatrix;
75
76
77 // DynamicVector prior;
78 // DynamicVector posterior;
79 // DynamicVector likelihood;
80
81 DynamicVector testVector;
82 // DynamicVector prior;
83
84 float prior [ARRAY_SIZE];
85 float posterior [ARRAY_SIZE];
86 float likelihood [ARRAY_SIZE];
87 float tempPosteriorArray[ARRAY_SIZE];
88
89 float decayNoiseArray[ARRAY_SIZE];
90 float decayNoiseStdDev, decayNoiseAmount;
91
92 float likelihoodMean, likelihoodStdDev, likelihoodNoise;
93 float maximumTest, posteriorDecayRate, maximumValue;
94 float eighthNoteProportion, earlySixteenthNoteProportion, lateSixteenthNoteProportion ;
95 float maximumEstimate, maximumIndex, integratedEstimate;
96 double standardDeviation;
97
98 private:
99 };
100
101 #endif
102
103
104