comparison src/DynamicVector.cpp @ 22:9860abc92a30

follower has confidence measure now just using best match. Difficulty in visualising the speed likelihood fn
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Wed, 30 Nov 2011 11:48:35 +0000
parents 75dcd1308658
children 032edf186a68
comparison
equal deleted inserted replaced
21:11e3119ce6b4 22:9860abc92a30
135 } 135 }
136 tmpArray.clear(); 136 tmpArray.clear();
137 //now delete tmp array 137 //now delete tmp array
138 } 138 }
139 139
140 void DynamicVector::addGaussianShape(double mean, double StdDev, double factor){ 140 void DynamicVector::addGaussianShape(const double& mean, const double& StdDev, double factor){
141 141
142 int i; 142 int i;
143 double std_dev_factor = (2*StdDev*StdDev); 143 double std_dev_factor = (2*StdDev*StdDev);
144 factor *= (1/(StdDev*sqrt(2*PI))); 144 factor *= (1/(StdDev*sqrt(2*PI)));
145 int maxVal = min((int) array.size(), (int)(mean + 4.8*StdDev)); 145 int maxVal = min((int) array.size(), (int)(mean + 4.8*StdDev));
150 } 150 }
151 151
152 // addGaussianShapeByLookupTable(mean, StdDev, factor); 152 // addGaussianShapeByLookupTable(mean, StdDev, factor);
153 } 153 }
154 154
155 void DynamicVector::addGaussianShapeByLookupTable(double& mean, double& StdDev, double& factor){ 155 void DynamicVector::addGaussianShapeByLookupTable(double& mean, double& StdDev, double factor){
156 int i; 156 int i;
157 int lookupIndex ; 157 int lookupIndex ;
158 factor *= (1/(StdDev*sqrt(2*PI))); 158 factor *= (1/(StdDev*sqrt(2*PI)));
159 for (i=0;i<array.size()-1;i++){ 159 for (i=0;i<array.size()-1;i++){
160 lookupIndex = round(getLookupIndex(i, mean, StdDev)); 160 lookupIndex = round(getLookupIndex(i, mean, StdDev));
185 array[i] += factor * abs(i - mean) / mean; 185 array[i] += factor * abs(i - mean) / mean;
186 } 186 }
187 187
188 } 188 }
189 189
190 void DynamicVector::addConstant(double value){ 190 void DynamicVector::addConstant(const double& value){
191 for (int i=0;i<array.size();i++){ 191 for (int i=0;i<array.size();i++){
192 array[i] += value; 192 array[i] += value;
193 } 193 }
194 } 194 }
195 195
196 196
197 void DynamicVector::addToIndex(int index, double constant){ 197 void DynamicVector::addToIndex(const int& index, const double& constant){
198 array[index] += constant; 198 array[index] += constant;
199 } 199 }
200 200
201 201
202 double DynamicVector::getIndexInRealTerms(const int& index){ 202 double DynamicVector::getIndexInRealTerms(const int& index){