Various statistics related methods for the statistics framework. More...
#include <StatisticsUtilities.h>
Classes | |
struct | BinDesc |
description of a regularly spaced bins with the first bin having lower limit of minLimit and having nBins equally spaced bins of width binWidth, so that the upper limit of the last bin is given by minLimit + nBins*binWidth More... | |
Public Member Functions | |
~StatisticsUtilities () | |
template<> | |
Int | getInt (const casacore::Complex &) |
template<> | |
Int | getInt (const casacore::DComplex &) |
Static Public Member Functions | |
static void | accumulate (Double &npts, AccumType &sum, AccumType &mean, const AccumType &datum) |
accumulate values. | |
static void | waccumulate (Double &npts, AccumType &sumweights, AccumType &wsum, AccumType &wmean, const AccumType &datum, const AccumType &weight) |
in order to optimize performance, no checking is done for the weight == 0 case callers should ensure that the weigth is not zero before calling this method, and shouldn't call this method if the weight is 0. | |
static void | accumulate (Double &npts, AccumType &sum, AccumType &mean, AccumType &nvariance, AccumType &sumsq, const AccumType &datum) |
static void | waccumulate (Double &npts, AccumType &sumweights, AccumType &wsum, AccumType &wmean, AccumType &wnvariance, AccumType &wsumsq, const AccumType &datum, const AccumType &weight) |
wsumsq is the weighted sum of squares, sum(w_i*x_i*x_i) | |
template<class LocationType > | |
static void | accumulate (Double &npts, AccumType &sum, AccumType &mean, AccumType &nvariance, AccumType &sumsq, AccumType &datamin, AccumType &datamax, LocationType &minpos, LocationType &maxpos, const AccumType &datum, const LocationType &location) |
The assignment operator of class LocationType should use copy, not reference, semantics. | |
template<class LocationType > | |
static void | waccumulate (Double &npts, AccumType &sumofweights, AccumType &sum, AccumType &mean, AccumType &nvariance, AccumType &sumsq, AccumType &datamin, AccumType &datamax, LocationType &minpos, LocationType &maxpos, const AccumType &datum, const AccumType &weight, const LocationType &location) |
template<class LocationType > | |
static Bool | doMax (AccumType &datamax, LocationType &maxpos, Bool isFirst, const AccumType &datum, const LocationType &location) |
return True if the max or min was updated, False otherwise. | |
template<class LocationType > | |
static Bool | doMin (AccumType &datamin, LocationType &minpos, Bool isFirst, const AccumType &datum, const LocationType &location) |
static void | accumulateSym (Double &npts, AccumType &nvariance, AccumType &sumsq, const AccumType &datum, const AccumType ¢er) |
These versions are for symmetric accumulation about a specified center point. | |
static void | waccumulateSym (Double &npts, AccumType &sumweights, AccumType &wnvariance, AccumType &wsumsq, const AccumType &datum, const AccumType &weight, const AccumType ¢er) |
wsumsq is the weighted sum of squares, sum(w_i*x_i*x_i) | |
template<class LocationType > | |
static void | accumulateSym (Double &npts, AccumType &nvariance, AccumType &sumsq, AccumType &datamin, AccumType &datamax, LocationType &minpos, LocationType &maxpos, const AccumType &datum, const LocationType &location, const AccumType ¢er) |
maxpos and minpos refer to actual, not virtually created, data only. | |
template<class LocationType > | |
static void | waccumulateSym (Double &npts, AccumType &sumofweights, AccumType &nvariance, AccumType &sumsq, AccumType &datamin, AccumType &datamax, LocationType &minpos, LocationType &maxpos, const AccumType &datum, const AccumType &weight, const LocationType &location, const AccumType ¢er) |
static Int | getInt (const AccumType &v) |
This does the obvious conversions. | |
static Bool | includeDatum (const AccumType &datum, typename DataRanges::const_iterator beginRange, typename DataRanges::const_iterator endRange, Bool isInclude) |
static StatsData< AccumType > | combine (const vector< StatsData< AccumType > > &stats) |
use two statistics sets to get the statistics set that would result in combining the two data sets used to produce the individual statistics sets. | |
Private Member Functions | |
StatisticsUtilities () | |
Static Private Attributes | |
static const AccumType | TWO |
Various statistics related methods for the statistics framework.
Definition at line 42 of file StatisticsUtilities.h.
casacore::StatisticsUtilities< AccumType >::~StatisticsUtilities | ( | ) | [inline] |
Definition at line 54 of file StatisticsUtilities.h.
casacore::StatisticsUtilities< AccumType >::StatisticsUtilities | ( | ) | [inline, private] |
Definition at line 207 of file StatisticsUtilities.h.
static void casacore::StatisticsUtilities< AccumType >::accumulate | ( | Double & | npts, | |
AccumType & | sum, | |||
AccumType & | mean, | |||
AccumType & | nvariance, | |||
AccumType & | sumsq, | |||
AccumType & | datamin, | |||
AccumType & | datamax, | |||
LocationType & | minpos, | |||
LocationType & | maxpos, | |||
const AccumType & | datum, | |||
const LocationType & | location | |||
) | [inline, static] |
The assignment operator of class LocationType should use copy, not reference, semantics.
static void casacore::StatisticsUtilities< AccumType >::accumulate | ( | Double & | npts, | |
AccumType & | sum, | |||
AccumType & | mean, | |||
AccumType & | nvariance, | |||
AccumType & | sumsq, | |||
const AccumType & | datum | |||
) | [inline, static] |
static void casacore::StatisticsUtilities< AccumType >::accumulate | ( | Double & | npts, | |
AccumType & | sum, | |||
AccumType & | mean, | |||
const AccumType & | datum | |||
) | [inline, static] |
accumulate values.
It is the responsibility of the caller to keep track of the accumulated values after each call. This class does not since it has no state. The accumulation derivation for mean and variance can be found at www.itl.nist.gov/div898/software/dataplot/refman2/ch2/weighvar.pdf nvariance is an accumulated value. It is related to the variance via variance = nvariance/npts or nvariance/(npts-1) depending on your preferred definition in the non-weighted case and wvariance = wnvariance/sumofweights or wnvariance/(sumofweights-1) in the weighted case It's basic definition is nvariance = sum((x_i - mean)**2), wnvariance = sum((weight_i*(x_i - mean)**2) npts is a Double rather than an Int64 because of compilation issues when T is a Complex
static void casacore::StatisticsUtilities< AccumType >::accumulateSym | ( | Double & | npts, | |
AccumType & | nvariance, | |||
AccumType & | sumsq, | |||
AccumType & | datamin, | |||
AccumType & | datamax, | |||
LocationType & | minpos, | |||
LocationType & | maxpos, | |||
const AccumType & | datum, | |||
const LocationType & | location, | |||
const AccumType & | center | |||
) | [inline, static] |
maxpos
and minpos
refer to actual, not virtually created, data only.
static void casacore::StatisticsUtilities< AccumType >::accumulateSym | ( | Double & | npts, | |
AccumType & | nvariance, | |||
AccumType & | sumsq, | |||
const AccumType & | datum, | |||
const AccumType & | center | |||
) | [inline, static] |
These versions are for symmetric accumulation about a specified center point.
The actual point is accumulated, as is a "virtual" point that is symmetric about the specified center. Of course, the trivial relationship that the mean is the specified center is used to simplify things.
static StatsData<AccumType> casacore::StatisticsUtilities< AccumType >::combine | ( | const vector< StatsData< AccumType > > & | stats | ) | [static] |
use two statistics sets to get the statistics set that would result in combining the two data sets used to produce the individual statistics sets.
The quantile related stats are not considered, since it is not in general possible to determine the resultant quantiles from the information provided; only the aggregate statistics make sense.
static Bool casacore::StatisticsUtilities< AccumType >::doMax | ( | AccumType & | datamax, | |
LocationType & | maxpos, | |||
Bool | isFirst, | |||
const AccumType & | datum, | |||
const LocationType & | location | |||
) | [inline, static] |
return True if the max or min was updated, False otherwise.
static Bool casacore::StatisticsUtilities< AccumType >::doMin | ( | AccumType & | datamin, | |
LocationType & | minpos, | |||
Bool | isFirst, | |||
const AccumType & | datum, | |||
const LocationType & | location | |||
) | [inline, static] |
Int casacore::StatisticsUtilities< casacore::DComplex >::getInt | ( | const casacore::DComplex & | ) | [inline] |
Definition at line 220 of file StatisticsUtilities.h.
References ThrowCc.
Int casacore::StatisticsUtilities< casacore::Complex >::getInt | ( | const casacore::Complex & | ) | [inline] |
In general, these versions should never actually be called
Definition at line 215 of file StatisticsUtilities.h.
References ThrowCc.
static Int casacore::StatisticsUtilities< AccumType >::getInt | ( | const AccumType & | v | ) | [inline, static] |
This does the obvious conversions.
The Complex and DComplex versions (implemented after the class definition) are used solely to permit compilation. In general, these versions should never actually be called
Definition at line 184 of file StatisticsUtilities.h.
static Bool casacore::StatisticsUtilities< AccumType >::includeDatum | ( | const AccumType & | datum, | |
typename DataRanges::const_iterator | beginRange, | |||
typename DataRanges::const_iterator | endRange, | |||
Bool | isInclude | |||
) | [inline, static] |
static void casacore::StatisticsUtilities< AccumType >::waccumulate | ( | Double & | npts, | |
AccumType & | sumofweights, | |||
AccumType & | sum, | |||
AccumType & | mean, | |||
AccumType & | nvariance, | |||
AccumType & | sumsq, | |||
AccumType & | datamin, | |||
AccumType & | datamax, | |||
LocationType & | minpos, | |||
LocationType & | maxpos, | |||
const AccumType & | datum, | |||
const AccumType & | weight, | |||
const LocationType & | location | |||
) | [inline, static] |
static void casacore::StatisticsUtilities< AccumType >::waccumulate | ( | Double & | npts, | |
AccumType & | sumweights, | |||
AccumType & | wsum, | |||
AccumType & | wmean, | |||
AccumType & | wnvariance, | |||
AccumType & | wsumsq, | |||
const AccumType & | datum, | |||
const AccumType & | weight | |||
) | [inline, static] |
wsumsq is the weighted sum of squares, sum(w_i*x_i*x_i)
static void casacore::StatisticsUtilities< AccumType >::waccumulate | ( | Double & | npts, | |
AccumType & | sumweights, | |||
AccumType & | wsum, | |||
AccumType & | wmean, | |||
const AccumType & | datum, | |||
const AccumType & | weight | |||
) | [inline, static] |
in order to optimize performance, no checking is done for the weight == 0 case callers should ensure that the weigth is not zero before calling this method, and shouldn't call this method if the weight is 0.
Expect a segfault because of division by zero if sumweights and weight are both zero.
static void casacore::StatisticsUtilities< AccumType >::waccumulateSym | ( | Double & | npts, | |
AccumType & | sumofweights, | |||
AccumType & | nvariance, | |||
AccumType & | sumsq, | |||
AccumType & | datamin, | |||
AccumType & | datamax, | |||
LocationType & | minpos, | |||
LocationType & | maxpos, | |||
const AccumType & | datum, | |||
const AccumType & | weight, | |||
const LocationType & | location, | |||
const AccumType & | center | |||
) | [inline, static] |
static void casacore::StatisticsUtilities< AccumType >::waccumulateSym | ( | Double & | npts, | |
AccumType & | sumweights, | |||
AccumType & | wnvariance, | |||
AccumType & | wsumsq, | |||
const AccumType & | datum, | |||
const AccumType & | weight, | |||
const AccumType & | center | |||
) | [inline, static] |
wsumsq is the weighted sum of squares, sum(w_i*x_i*x_i)
const AccumType casacore::StatisticsUtilities< AccumType >::TWO [static, private] |
Definition at line 205 of file StatisticsUtilities.h.