Loading...
Searching...
No Matches
casacore::StatisticsUtilities< AccumType > Class Template Reference

Various statistics related methods for the statistics framework. More...

`#include <StatisticsUtilities.h>`

## Public Member Functions

| StatisticsUtilities ()=delete
| ~StatisticsUtilities ()

## 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, class DataType>
static void | accumulate (Double &npts, AccumType &sum, AccumType &mean, AccumType &nvariance, AccumType &sumsq, DataType &datamin, DataType &datamax, LocationType &minpos, LocationType &maxpos, const DataType &datum, const LocationType &location)
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 &center)
| 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 &center)
| 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 &center)
| 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 &center)
static void | convertToAbsDevMedArray (DataArray &myArray, AccumType median)
| convert in place by taking the absolute value of the difference of the std::vector and the median
static Bool | includeDatum (const AccumType &datum, typename DataRanges::const_iterator beginRange, typename DataRanges::const_iterator endRange, Bool isInclude)
static std::map< uInt64, AccumType > | indicesToValues (std::vector< AccumType > &myArray, const std::set< uInt64 > &indices)
| The array can be changed by partially sorting it up to the largest index.
static void | mergeResults (std::vector< BinCountArray > &bins, std::vector< std::shared_ptr< AccumType > > &sameVal, std::vector< Bool > &allSame, const std::unique_ptr< std::vector< BinCountArray >[]> &tBins, const std::unique_ptr< std::vector< std::shared_ptr< AccumType > >[]> &tSameVal, const std::unique_ptr< std::vector< Bool >[]> &tAllSame, uInt nThreadsMax)
static StatsData< AccumType > | combine (const std::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.
template<class DataIterator, class MaskIterator, class WeightsIterator>
static uInt | nThreadsMax (const StatsDataProvider< CASA_STATP > *const dataProvider)
static uInt | threadIdx ()

## Static Private Attributes

static const AccumType | TWO

## Detailed Description

template<class AccumType>
class casacore::StatisticsUtilities< AccumType >

Various statistics related methods for the statistics framework.

Definition at line 44 of file StatisticsUtilities.h.

## Constructor & Destructor Documentation

## StatisticsUtilities()

template<class AccumType>

casacore::StatisticsUtilities< AccumType >::StatisticsUtilities | ( |  | ) |

delete

## ~StatisticsUtilities()

template<class AccumType>

casacore::StatisticsUtilities< AccumType >::~StatisticsUtilities | ( |  | ) |

inline

Definition at line 49 of file StatisticsUtilities.h.

## Member Function Documentation

## accumulate() [1/4]

template<class AccumType>
template<class LocationType>

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.

References casacore::datamax(), casacore::datamin(), casacore::mean(), and casacore::sum().

## accumulate() [2/4]

template<class AccumType>

void casacore::StatisticsUtilities< AccumType >::accumulate | ( | Double & | npts,
|  | AccumType & | sum,
|  | AccumType & | mean,
|  | AccumType & | nvariance,
|  | AccumType & | sumsq,
|  | const AccumType & | datum )

inline static

References casacore::mean(), and casacore::sum().

## accumulate() [3/4]

template<class AccumType>
template<class LocationType, class DataType>

void casacore::StatisticsUtilities< AccumType >::accumulate | ( | Double & | npts,
|  | AccumType & | sum,
|  | AccumType & | mean,
|  | AccumType & | nvariance,
|  | AccumType & | sumsq,
|  | DataType & | datamin,
|  | DataType & | datamax,
|  | LocationType & | minpos,
|  | LocationType & | maxpos,
|  | const DataType & | datum,
|  | const LocationType & | location )

inline static

References casacore::datamax(), casacore::datamin(), casacore::mean(), and casacore::sum().

## accumulate() [4/4]

template<class AccumType>

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 Its 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

References casacore::mean(), and casacore::sum().

## accumulateSym() [1/2]

template<class AccumType>
template<class LocationType>

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.

References casacore::datamax(), and casacore::datamin().

## accumulateSym() [2/2]

template<class AccumType>

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

## combine()

template<class AccumType>

StatsData< AccumType > casacore::StatisticsUtilities< AccumType >::combine | ( | const std::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.

## convertToAbsDevMedArray()

template<class AccumType>

void casacore::StatisticsUtilities< AccumType >::convertToAbsDevMedArray | ( | DataArray & | myArray,
|  | AccumType | median )

inline static

convert in place by taking the absolute value of the difference of the std::vector and the median

References DataArray, and casacore::median().

## doMax()

template<class AccumType>
template<class LocationType>

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.

References casacore::datamax().

## doMin()

template<class AccumType>
template<class LocationType>

Bool casacore::StatisticsUtilities< AccumType >::doMin | ( | AccumType & | datamin,
|  | LocationType & | minpos,
|  | Bool | isFirst,
|  | const AccumType & | datum,
|  | const LocationType & | location )

inline static

References casacore::datamin().

## includeDatum()

template<class AccumType>

Bool casacore::StatisticsUtilities< AccumType >::includeDatum | ( | const AccumType & | datum,
|  | typename DataRanges::const_iterator | beginRange,
|  | typename DataRanges::const_iterator | endRange,
|  | Bool | isInclude )

inline static

## indicesToValues()

template<class AccumType>

std::map< uInt64, AccumType > casacore::StatisticsUtilities< AccumType >::indicesToValues | ( | std::vector< AccumType > & | myArray,
|  | const std::set< uInt64 > & | indices )

static

The array can be changed by partially sorting it up to the largest index.

Return a map of index to value in the sorted array.

## mergeResults()

template<class AccumType>

void casacore::StatisticsUtilities< AccumType >::mergeResults | ( | std::vector< BinCountArray > & | bins,
|  | std::vector< std::shared_ptr< AccumType > > & | sameVal,
|  | std::vector< Bool > & | allSame,
|  | const std::unique_ptr< std::vector< BinCountArray >[]> & | tBins,
|  | const std::unique_ptr< std::vector< std::shared_ptr< AccumType > >[]> & | tSameVal,
|  | const std::unique_ptr< std::vector< Bool >[]> & | tAllSame,
|  | uInt | nThreadsMax )

static

References nThreadsMax().

## nThreadsMax()

template<class AccumType>
template<class DataIterator, class MaskIterator, class WeightsIterator>

uInt casacore::StatisticsUtilities< AccumType >::nThreadsMax | ( | const StatsDataProvider< CASA_STATP > *const | dataProvider | ) |

static

Referenced by mergeResults().

## threadIdx()

template<class AccumType>

uInt casacore::StatisticsUtilities< AccumType >::threadIdx | ( |  | ) |

static

## waccumulate() [1/3]

template<class AccumType>
template<class LocationType>

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

References casacore::datamax(), casacore::datamin(), casacore::mean(), and casacore::sum().

## waccumulate() [2/3]

template<class AccumType>

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)

## waccumulate() [3/3]

template<class AccumType>

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.

## waccumulateSym() [1/2]

template<class AccumType>
template<class LocationType>

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

References casacore::datamax(), and casacore::datamin().

## waccumulateSym() [2/2]

template<class AccumType>

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)

## Member Data Documentation

## TWO

template<class AccumType>

const AccumType casacore::StatisticsUtilities< AccumType >::TWO

static private

Definition at line 217 of file StatisticsUtilities.h.

The documentation for this class was generated from the following file:

- scimath/StatsFramework/StatisticsUtilities.h