26 #ifndef SCIMATH_STATISTICSUTILITIES_H
27 #define SCIMATH_STATISTICSUTILITIES_H
29 #include <casacore/casa/Exceptions/Error.h>
30 #include <casacore/scimath/StatsFramework/StatisticsTypes.h>
31 #include <casacore/scimath/StatsFramework/StatsHistogram.h>
32 #include <casacore/casa/Utilities/DataType.h>
33 #include <casacore/casa/aips.h>
36 #include <casacore/casa/iosfwd.h>
69 Double& npts, AccumType&
sum, AccumType&
mean,
const AccumType& datum
78 Double& npts, AccumType& sumweights, AccumType& wsum, AccumType& wmean,
79 const AccumType& datum,
const AccumType& weight
83 Double& npts, AccumType&
sum, AccumType&
mean, AccumType& nvariance,
84 AccumType& sumsq,
const AccumType& datum
89 Double& npts, AccumType& sumweights, AccumType& wsum, AccumType& wmean,
90 AccumType& wnvariance, AccumType& wsumsq,
const AccumType& datum,
91 const AccumType& weight
98 template <
class LocationType>
inline static void accumulate (
99 Double& npts, AccumType&
sum, AccumType&
mean, AccumType& nvariance,
100 AccumType& sumsq, AccumType& datamin, AccumType& datamax,
105 template <
class LocationType,
class DataType>
107 Double& npts, AccumType&
sum, AccumType&
mean, AccumType& nvariance,
108 AccumType& sumsq, DataType& datamin, DataType& datamax,
113 template <
class LocationType>
115 Double& npts, AccumType& sumofweights, AccumType&
sum, AccumType&
mean,
116 AccumType& nvariance, AccumType& sumsq, AccumType& datamin,
118 const AccumType& datum,
const AccumType& weight,
125 template <
class LocationType>
131 template <
class LocationType>
144 Double& npts, AccumType& nvariance, AccumType& sumsq,
145 const AccumType& datum,
const AccumType& center
150 Double& npts, AccumType& sumweights, AccumType& wnvariance,
151 AccumType& wsumsq,
const AccumType& datum,
const AccumType& weight,
152 const AccumType& center
158 Double& npts, AccumType& nvariance, AccumType& sumsq,
159 AccumType& datamin, AccumType& datamax,
LocationType& minpos,
165 Double& npts, AccumType& sumofweights, AccumType& nvariance,
166 AccumType& sumsq, AccumType& datamin, AccumType& datamax,
169 const AccumType& center
180 const AccumType& datum,
typename DataRanges::const_iterator beginRange,
181 typename DataRanges::const_iterator endRange,
Bool isInclude
188 std::vector<AccumType>& myArray,
const std::set<uInt64>& indices
192 std::vector<BinCountArray>& bins,
194 std::vector<Bool>& allSame,
195 const PtrHolder<std::vector<BinCountArray>>& tBins,
210 template <
class DataIterator,
class MaskIterator,
class WeightsIterator>
219 const static AccumType
TWO;
225 #ifndef CASACORE_NO_AUTO_TEMPLATES
226 #include <casacore/scimath/StatsFramework/StatisticsUtilities.tcc>
#define DataArray
Commonly used types in statistics framework.
#define CASA_STATD
because the template signature has become unwieldy
Various statistics related methods for the statistics framework.
static void accumulate(Double &npts, AccumType &sum, AccumType &mean, const AccumType &datum)
accumulate values.
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 uInt nThreadsMax(const StatsDataProvider< CASA_STATP > *const dataProvider)
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.
static void mergeResults(std::vector< BinCountArray > &bins, std::vector< CountedPtr< AccumType > > &sameVal, std::vector< Bool > &allSame, const PtrHolder< std::vector< BinCountArray >> &tBins, const PtrHolder< std::vector< CountedPtr< AccumType >>> &tSameVal, const PtrHolder< std::vector< Bool >> &tAllSame, uInt nThreadsMax)
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)
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.
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 us...
static const AccumType TWO
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)
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)
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 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 void accumulate(Double &npts, AccumType &sum, AccumType &mean, AccumType &nvariance, AccumType &sumsq, const AccumType &datum)
StatisticsUtilities()=delete
static Bool includeDatum(const AccumType &datum, typename DataRanges::const_iterator beginRange, typename DataRanges::const_iterator endRange, Bool isInclude)
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 ...
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)
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.
static Bool doMin(AccumType &datamin, LocationType &minpos, Bool isFirst, const AccumType &datum, const LocationType &location)
this file contains all the compiler specific defines
LatticeExprNode mean(const LatticeExprNode &expr)
LatticeExprNode sum(const LatticeExprNode &expr)
bool Bool
Define the standard types used by Casacore.
PtrHolder(const PtrHolder< T > &other)
LatticeExprNode median(const LatticeExprNode &expr)
std::pair< Int64, Int64 > LocationType