1 #ifndef NPSTAT_ARRAYPROJECTORS_HH_
2 #define NPSTAT_ARRAYPROJECTORS_HH_
29 inline void clear() {isClear_ =
true;}
32 if (isClear_)
throw std::runtime_error(
33 "In npstat::ArrayMaxProjector: no data processed");
51 inline void clear() {isClear_ =
true;}
54 if (isClear_)
throw std::runtime_error(
55 "In npstat::ArrayMinProjector: no data processed");
70 typename Accumulator=
typename PreciseType<T>::type
78 inline void clear() {sum_ = Accumulator(); n_ = 0UL;}
79 inline virtual Result
result() {
return static_cast<Result
>(sum_);}
80 inline void process(
const T& value) {sum_ += value; ++n_;}
92 typename Accumulator=
typename PreciseType<T>::type
103 if (!this->n_)
throw std::runtime_error(
104 "In npstat::ArrayMeanProjector: no data processed");
105 return static_cast<Result
>(this->sum_/(1.0*this->n_));
110 template <
typename T>
118 inline void process(
const T& value) {v_.push_back(value);}
122 T medSorted(
const T *array,
unsigned long n);
131 template <
typename T>
141 template <
typename T,
typename Result>
148 inline void process(
const T& value) {v_.push_back(value);}
156 #include "npstat/stat/ArrayProjectors.icc"
Interface for piecemeal processing of a data collection.
Compile-time deduction of an appropriate precise numeric type.
Definition: ArrayProjectors.hh:24
T result()
Definition: ArrayProjectors.hh:30
void process(const T &value)
void clear()
Definition: ArrayProjectors.hh:29
Definition: ArrayProjectors.hh:95
Result result()
Definition: ArrayProjectors.hh:101
Definition: ArrayProjectors.hh:46
void process(const T &value)
T result()
Definition: ArrayProjectors.hh:52
void clear()
Definition: ArrayProjectors.hh:51
Definition: ArrayProjectors.hh:133
Definition: ArrayProjectors.hh:143
void process(const T &value)
Definition: ArrayProjectors.hh:148
void clear()
Definition: ArrayProjectors.hh:147
Definition: ArrayProjectors.hh:73
void clear()
Definition: ArrayProjectors.hh:78
virtual Result result()
Definition: ArrayProjectors.hh:79
void process(const T &value)
Definition: ArrayProjectors.hh:80
Definition: AbsArrayProjector.hh:14
Definition: AbsVisitor.hh:20