comparison hackday/DynamicVector.cpp @ 31:9a70d9abdc8b

examining the tempo speed process
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Sun, 11 Dec 2011 17:19:34 +0000
parents 49a5b023df1e
children
comparison
equal deleted inserted replaced
30:be2e779d76b5 31:9a70d9abdc8b
86 } 86 }
87 if (integratedTotal > 0){ 87 if (integratedTotal > 0){
88 integratedEstimate /= integratedTotal; 88 integratedEstimate /= integratedTotal;
89 } 89 }
90 90
91 }
92
93 void DynamicVector::updateLimitedIntegratedEstimate(){
94 //returns the index of the integrated average - where the probability distribution is centred
95 //but limited round the MAP estimate
96 double tmp = getMaximum();
97 int limit = min(MAPestimate, length - MAPestimate);
98 int start = max(0, MAPestimate - limit);
99 int end = min(MAPestimate + limit, length-1);
100
101 integratedEstimate = 0;
102 double integratedTotal = 0;
103 for (int i = start;i <= end;i++){
104 integratedEstimate += array[i]*i;
105 integratedTotal += array[i];
106 }
107 if (integratedTotal > 0){
108 integratedEstimate /= integratedTotal;
109 }
110
91 } 111 }
92 112
93 113
94 void DynamicVector::zero(){ 114 void DynamicVector::zero(){
95 for (int i = 0;i < array.size();i++) 115 for (int i = 0;i < array.size();i++)