| 35 |
|
* |
| 36 |
|
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
| 37 |
|
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
| 38 |
< |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
| 38 |
> |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). |
| 39 |
|
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
| 40 |
|
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
| 41 |
|
*/ |
| 59 |
|
virtual size_t count() { |
| 60 |
|
return Count_; |
| 61 |
|
} |
| 62 |
+ |
virtual ~BaseAccumulator() {}; |
| 63 |
|
protected: |
| 64 |
|
size_t Count_; |
| 65 |
|
|
| 80 |
|
Accumulator() : BaseAccumulator() { |
| 81 |
|
this->clear(); |
| 82 |
|
} |
| 83 |
+ |
|
| 84 |
+ |
~Accumulator() {}; |
| 85 |
|
|
| 86 |
|
/** |
| 87 |
|
* Accumulate another value |
| 163 |
|
void getMin(ElementType &ret) { |
| 164 |
|
assert(Count_ != 0); |
| 165 |
|
ret = Max_; |
| 166 |
+ |
return; |
| 167 |
+ |
} |
| 168 |
+ |
|
| 169 |
+ |
/** |
| 170 |
+ |
* return the 95% confidence interval: |
| 171 |
+ |
* |
| 172 |
+ |
* That is returns c, such that we have 95% confidence that the |
| 173 |
+ |
* true mean is within 2c of the Average (x): |
| 174 |
+ |
* |
| 175 |
+ |
* x - c <= true mean <= x + c |
| 176 |
+ |
* |
| 177 |
+ |
*/ |
| 178 |
+ |
void get95percentConfidenceInterval(ResultType &ret) { |
| 179 |
+ |
assert(Count_ != 0); |
| 180 |
+ |
RealType sd; |
| 181 |
+ |
this->getStdDev(sd); |
| 182 |
+ |
ret = 1.960 * sd / sqrt(RealType(Count_)); |
| 183 |
|
return; |
| 184 |
|
} |
| 185 |
|
|
| 280 |
|
} |
| 281 |
|
|
| 282 |
|
/** |
| 283 |
+ |
* return the 95% confidence interval: |
| 284 |
+ |
* |
| 285 |
+ |
* That is returns c, such that we have 95% confidence that the |
| 286 |
+ |
* true mean is within 2c of the Average (x): |
| 287 |
+ |
* |
| 288 |
+ |
* x - c <= true mean <= x + c |
| 289 |
+ |
* |
| 290 |
+ |
*/ |
| 291 |
+ |
void get95percentConfidenceInterval(ResultType &ret) { |
| 292 |
+ |
assert(Count_ != 0); |
| 293 |
+ |
ResultType sd; |
| 294 |
+ |
this->getStdDev(sd); |
| 295 |
+ |
ret[0] = 1.960 * sd[0] / sqrt(RealType(Count_)); |
| 296 |
+ |
ret[1] = 1.960 * sd[1] / sqrt(RealType(Count_)); |
| 297 |
+ |
ret[2] = 1.960 * sd[2] / sqrt(RealType(Count_)); |
| 298 |
+ |
return; |
| 299 |
+ |
} |
| 300 |
+ |
|
| 301 |
+ |
/** |
| 302 |
|
* return the largest length |
| 303 |
|
*/ |
| 304 |
|
void getMaxLength(RealType &ret) { |
| 344 |
|
ret = sqrt(var); |
| 345 |
|
return; |
| 346 |
|
} |
| 347 |
< |
|
| 348 |
< |
protected: |
| 349 |
< |
size_t Count_; |
| 347 |
> |
|
| 348 |
> |
/** |
| 349 |
> |
* return the 95% confidence interval: |
| 350 |
> |
* |
| 351 |
> |
* That is returns c, such that we have 95% confidence that the |
| 352 |
> |
* true mean is within 2c of the Average (x): |
| 353 |
> |
* |
| 354 |
> |
* x - c <= true mean <= x + c |
| 355 |
> |
* |
| 356 |
> |
*/ |
| 357 |
> |
void getLength95percentConfidenceInterval(ResultType &ret) { |
| 358 |
> |
assert(Count_ != 0); |
| 359 |
> |
RealType sd; |
| 360 |
> |
this->getLengthStdDev(sd); |
| 361 |
> |
ret = 1.960 * sd / sqrt(RealType(Count_)); |
| 362 |
> |
return; |
| 363 |
> |
} |
| 364 |
> |
|
| 365 |
> |
|
| 366 |
|
private: |
| 367 |
|
ResultType Val_; |
| 368 |
|
ResultType Avg_; |
| 452 |
|
} |
| 453 |
|
return; |
| 454 |
|
} |
| 455 |
< |
|
| 456 |
< |
protected: |
| 457 |
< |
size_t Count_; |
| 455 |
> |
|
| 456 |
> |
/** |
| 457 |
> |
* return the 95% confidence interval: |
| 458 |
> |
* |
| 459 |
> |
* That is returns c, such that we have 95% confidence that the |
| 460 |
> |
* true mean is within 2c of the Average (x): |
| 461 |
> |
* |
| 462 |
> |
* x - c <= true mean <= x + c |
| 463 |
> |
* |
| 464 |
> |
*/ |
| 465 |
> |
void get95percentConfidenceInterval(ResultType &ret) { |
| 466 |
> |
assert(Count_ != 0); |
| 467 |
> |
Mat3x3d sd; |
| 468 |
> |
this->getStdDev(sd); |
| 469 |
> |
for (unsigned int i = 0; i < 3; i++) { |
| 470 |
> |
for (unsigned int j = 0; j < 3; j++) { |
| 471 |
> |
ret(i,j) = 1.960 * sd(i,j) / sqrt(RealType(Count_)); |
| 472 |
> |
} |
| 473 |
> |
} |
| 474 |
> |
return; |
| 475 |
> |
} |
| 476 |
> |
|
| 477 |
|
private: |
| 478 |
|
ElementType Val_; |
| 479 |
|
ResultType Avg_; |