/usr/include/pbseq/alignment/statistics/VarianceAccumulatorImpl.hpp is in libblasr-dev 0~20161219-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #ifndef _BLASR_VARIANCE_ACCUMULATOR_IMPL_HPP_
#define _BLASR_VARIANCE_ACCUMULATOR_IMPL_HPP_
template<typename T>
VarianceAccumulator<T>::
VarianceAccumulator() {
Reset();
}
template<typename T>
void VarianceAccumulator<T>::Reset() {
sumSqVal = 0;
sumVal = 0;
nSamples = 0;
maxVal = minVal = 0;
}
template<typename T>
T VarianceAccumulator<T>::
GetMean() {return ((1.0)*sumVal)/nSamples;}
template<typename T>
T VarianceAccumulator<T>::
GetVariance() {
return (1.0*sumSqVal)/nSamples - GetMean()*GetMean();
}
template<typename T>
float VarianceAccumulator<T>::
GetNStdDev(T value) {
T variance = GetVariance();
T mean = GetMean();
if (variance > 0) {
return fabs(value - mean)/(sqrt(variance));
}
else {
return 0;
}
}
template<typename T>
void VarianceAccumulator<T>::
Append(T v) {
if (nSamples == 0) {
maxVal = minVal = v;
}
else {
if (maxVal < v) {
maxVal = v;
}
if (minVal > v) {
minVal = v;
}
}
sumSqVal += v*v;
sumVal += v;
nSamples++;
}
#endif
|