44#ifndef UTILS_OLDACCUMULATOR_HPP
45#define UTILS_OLDACCUMULATOR_HPP
51#include "nonbonded/NonBondedInteraction.hpp"
57 virtual void clear() = 0;
61 virtual size_t count() {
return Count_; }
72 using ElementType = RealType;
73 using ResultType = RealType;
83 virtual void add(ElementType
const& val) {
85 Avg_ += (val - Avg_) / Count_;
86 Avg2_ += (val * val - Avg2_) / Count_;
93 Max_ = val > Max_ ? val : Max_;
94 Min_ = val < Min_ ? val : Min_;
140 ret = (Avg2_ - Avg_ * Avg_);
141 if (ret < 0) ret = 0;
187 ret = 1.960 * sd / sqrt(RealType(Count_));
213 for (
unsigned int i = 0; i < 3; i++) {
214 Avg_[i] += (val[i] - Avg_[i]) / Count_;
215 Avg2_[i] += (val[i] * val[i] - Avg2_[i]) / Count_;
218 len += val[i] * val[i];
221 AvgLen_ += (len - AvgLen_) / Count_;
222 AvgLen2_ += (len * len - AvgLen2_) / Count_;
228 Max_ = len > Max_ ? len : Max_;
229 Min_ = len < Min_ ? len : Min_;
277 for (
unsigned int i = 0; i < 3; i++) {
278 ret[i] = (Avg2_[i] - Avg_[i] * Avg_[i]);
279 if (ret[i] < 0) ret[i] = 0;
291 ret[0] = sqrt(var[0]);
292 ret[1] = sqrt(var[1]);
293 ret[2] = sqrt(var[2]);
310 ret[0] = 1.960 * sd[0] / sqrt(RealType(Count_));
311 ret[1] = 1.960 * sd[1] / sqrt(RealType(Count_));
312 ret[2] = 1.960 * sd[2] / sqrt(RealType(Count_));
348 ret = (AvgLen2_ - AvgLen_ * AvgLen_);
349 if (ret < 0) ret = 0;
377 ret = 1.960 * sd / sqrt(RealType(Count_));
405 for (
unsigned int i = 0; i < N_INTERACTION_FAMILIES; i++) {
406 Avg_[i] += (val[i] - Avg_[i]) / Count_;
407 Avg2_[i] += (val[i] * val[i] - Avg2_[i]) / Count_;
410 len += val[i] * val[i];
413 AvgLen_ += (len - AvgLen_) / Count_;
414 AvgLen2_ += (len * len - AvgLen2_) / Count_;
420 Max_ = len > Max_ ? len : Max_;
421 Min_ = len < Min_ ? len : Min_;
469 for (
unsigned int i = 0; i < N_INTERACTION_FAMILIES; i++) {
470 ret[i] = (Avg2_[i] - Avg_[i] * Avg_[i]);
471 if (ret[i] < 0) ret[i] = 0;
483 for (
unsigned int i = 0; i < N_INTERACTION_FAMILIES; i++) {
484 ret[i] = sqrt(var[i]);
502 for (
unsigned int i = 0; i < N_INTERACTION_FAMILIES; i++) {
503 ret[i] = 1.960 * sd[i] / sqrt(RealType(Count_));
540 ret = (AvgLen2_ - AvgLen_ * AvgLen_);
541 if (ret < 0) ret = 0;
569 ret = 1.960 * sd / sqrt(RealType(Count_));
596 for (
unsigned int i = 0; i < 3; i++) {
597 for (
unsigned int j = 0; j < 3; j++) {
598 Avg_(i, j) += (val(i, j) - Avg_(i, j)) / Count_;
599 Avg2_(i, j) += (val(i, j) * val(i, j) - Avg2_(i, j)) / Count_;
600 Val_(i, j) = val(i, j);
601 Total_(i, j) += val(i, j);
648 for (
unsigned int i = 0; i < 3; i++) {
649 for (
unsigned int j = 0; j < 3; j++) {
650 ret(i, j) = (Avg2_(i, j) - Avg_(i, j) * Avg_(i, j));
651 if (ret(i, j) < 0) ret(i, j) = 0;
664 for (
unsigned int i = 0; i < 3; i++) {
665 for (
unsigned int j = 0; j < 3; j++) {
666 ret(i, j) = sqrt(var(i, j));
685 for (
unsigned int i = 0; i < 3; i++) {
686 for (
unsigned int j = 0; j < 3; j++) {
687 ret(i, j) = 1.960 * sd(i, j) / sqrt(RealType(Count_));
Basic Accumulator class for numbers.
void getTotal(ResultType &ret)
return the Total accumulated sum
void getAverage(ResultType &ret)
compute the Mean
void getMin(ElementType &ret)
return the smallest value
void getMax(ElementType &ret)
return the largest value
void get95percentConfidenceInterval(ResultType &ret)
return the 95% confidence interval:
void getLastValue(ElementType &ret)
return the most recently added value
virtual void add(ElementType const &val)
Accumulate another value.
void getVariance(ResultType &ret)
compute the Variance
void clear()
reset the Accumulator to the empty state
void getStdDev(ResultType &ret)
compute error of average value
virtual size_t count()
get the number of accumulated values
void getTotal(ResultType &ret)
return the Total accumulated sum
void getVariance(ResultType &ret)
compute the Variance
void getStdDev(ResultType &ret)
compute error of average value
void clear()
reset the Accumulator to the empty state
void getLastValue(ElementType &ret)
return the most recently added value
void add(ElementType const &val)
Accumulate another value.
void getAverage(ResultType &ret)
compute the Mean
void get95percentConfidenceInterval(ResultType &ret)
return the 95% confidence interval:
void getAverage(ResultType &ret)
compute the Mean
void clear()
reset the Accumulator to the empty state
void getLength95percentConfidenceInterval(ResultType &ret)
return the 95% confidence interval:
void getMaxLength(RealType &ret)
return the largest length
void getLengthStdDev(RealType &ret)
compute error of average value
void add(ElementType const &val)
Accumulate another value.
void getVariance(ResultType &ret)
compute the Variance
void getStdDev(ResultType &ret)
compute error of average value
void getMinLength(RealType &ret)
return the smallest length
void getLengthVariance(RealType &ret)
compute the Variance of the length
void getLastValue(ElementType &ret)
return the most recently added value
void getTotal(ResultType &ret)
return the Total accumulated sum
void getAverageLength(RealType &ret)
return the largest length
void get95percentConfidenceInterval(ResultType &ret)
return the 95% confidence interval:
void getMinLength(RealType &ret)
return the smallest length
void getAverage(ResultType &ret)
compute the Mean
void getLengthStdDev(RealType &ret)
compute error of average value
void getMaxLength(RealType &ret)
return the largest length
void getVariance(ResultType &ret)
compute the Variance
void getTotal(ResultType &ret)
return the Total accumulated sum
void clear()
reset the Accumulator to the empty state
void getLastValue(ElementType &ret)
return the most recently added value
void getStdDev(ResultType &ret)
compute error of average value
void getLength95percentConfidenceInterval(ResultType &ret)
return the 95% confidence interval:
void getAverageLength(RealType &ret)
return the largest length
void getLengthVariance(RealType &ret)
compute the Variance of the length
void add(ElementType const &val)
Accumulate another value.
void get95percentConfidenceInterval(ResultType &ret)
return the 95% confidence interval:
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.