andrew@0
|
1 /*
|
andrew@0
|
2 * bayesianArray.h
|
andrew@0
|
3 * bayesianTest5
|
andrew@0
|
4 *
|
andrew@0
|
5 * Created by Andrew Robertson on 08/05/2010.
|
andrew@0
|
6 * Copyright 2010 __MyCompanyName__. All rights reserved.
|
andrew@0
|
7 *
|
andrew@0
|
8 */
|
andrew@0
|
9
|
andrew@0
|
10 #ifndef _BAYESIAN_ARRAY
|
andrew@0
|
11 #define _BAYESIAN_ARRAY
|
andrew@0
|
12
|
andrew@0
|
13 #define ARRAY_SIZE 240
|
andrew@0
|
14
|
andrew@0
|
15
|
andrew@0
|
16 class bayesianArray{
|
andrew@0
|
17
|
andrew@0
|
18 public:
|
andrew@0
|
19
|
andrew@0
|
20 bayesianArray();
|
andrew@0
|
21 void initialiseArray();
|
andrew@0
|
22
|
andrew@0
|
23 void setGaussianLikelihoodForBeats(float mean, float StdDev);
|
andrew@0
|
24 void setGaussianLikelihood(float mean, float StdDev);
|
andrew@0
|
25 void setGaussianPrior(float mean, float StdDev);
|
andrew@0
|
26 void setGaussianPosterior(float mean, float StdDev);
|
andrew@0
|
27
|
andrew@0
|
28 void calculatePosterior();
|
andrew@0
|
29 void renormalisePosterior();
|
andrew@0
|
30 void resetMaximumPosterior();//resets the max index
|
andrew@0
|
31 void decayPosteriorWithGaussianNoise();
|
andrew@0
|
32 void translateDistribution(int translationIndex);
|
andrew@0
|
33 void setDecayNoiseGaussian(float mean, float StdDev);
|
andrew@0
|
34 double calculateStandardDeviation();
|
andrew@0
|
35
|
andrew@0
|
36
|
andrew@0
|
37 float getMaximum(float *ptr, int length);
|
andrew@0
|
38 void renormaliseArray(float *ptr, int length);
|
andrew@0
|
39 void resetPrior();
|
andrew@0
|
40 void decayPosterior();
|
andrew@0
|
41 float* getMaximumEstimate(float *ptr, int length);
|
andrew@0
|
42 double getIntegratedEstimateIndex();
|
andrew@0
|
43
|
andrew@0
|
44 float prior [ARRAY_SIZE];
|
andrew@0
|
45 float posterior [ARRAY_SIZE];
|
andrew@0
|
46 float likelihood [ARRAY_SIZE];
|
andrew@0
|
47 float tempPosteriorArray[ARRAY_SIZE];
|
andrew@0
|
48
|
andrew@0
|
49 float decayNoiseArray[ARRAY_SIZE];
|
andrew@0
|
50 float decayNoiseStdDev, decayNoiseAmount;
|
andrew@0
|
51
|
andrew@0
|
52 float likelihoodMean, likelihoodStdDev, likelihoodNoise;
|
andrew@0
|
53 float maximumTest, posteriorDecayRate, maximumValue;
|
andrew@0
|
54 float eighthNoteProportion, earlySixteenthNoteProportion, lateSixteenthNoteProportion ;
|
andrew@0
|
55 float maximumEstimate, maximumIndex, integratedEstimate;
|
andrew@0
|
56 double standardDeviation;
|
andrew@0
|
57
|
andrew@0
|
58 private:
|
andrew@0
|
59 };
|
andrew@0
|
60
|
andrew@0
|
61 #endif
|
andrew@0
|
62 |