26 #ifndef SCIMATH_BIWEIGHTSTATISTICS_H
27 #define SCIMATH_BIWEIGHTSTATISTICS_H
29 #include <casacore/casa/aips.h>
31 #include <casacore/scimath/StatsFramework/ClassicalStatistics.h>
118 class AccumType,
class DataIterator,
class MaskIterator=
const Bool*,
119 class WeightsIterator=DataIterator
149 uInt binningThreshholdSizeBytes=4096*4096,
154 std::map<Double, AccumType>& quantileToValue,
158 uInt binningThreshholdSizeBytes=4096*4096,
166 uInt binningThreshholdSizeBytes=4096*4096,
173 uInt binningThreshholdSizeBytes=4096*4096,
211 std::pair<AccumType, AccumType>
_range{};
220 AccumType& sxw2, AccumType& sw2, AccumType& sx_M2w4,
221 AccumType& ww_4u2, DataIterator dataIter, MaskIterator maskIter,
222 WeightsIterator weightsIter,
uInt64 dataCount,
227 AccumType& sxw2, AccumType& sw2, DataIterator dataIter,
228 MaskIterator maskIter, WeightsIterator weightsIter,
uInt64 dataCount,
233 AccumType& sx_M2w4, AccumType& ww_4u2, DataIterator dataIter,
234 MaskIterator maskIter, WeightsIterator weightsIter,
uInt64 dataCount,
250 AccumType& sxw2, AccumType& sw2, AccumType& sx_M2w4, AccumType& ww_4u2,
251 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride
255 AccumType& sxw2, AccumType& sw2, AccumType& sx_M2w4, AccumType& ww_4u2,
256 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
261 AccumType& sxw2, AccumType& sw2, AccumType& sx_M2w4, AccumType& ww_4u2,
262 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
263 const MaskIterator& maskBegin,
uInt maskStride
267 AccumType& sxw2, AccumType& sw2, AccumType& sx_M2w4, AccumType& ww_4u2,
268 const DataIterator& dataBegin,
uInt64 nr,
uInt dataStride,
269 const MaskIterator& maskBegin,
uInt maskStride,
274 AccumType& sxw2, AccumType& sw2, AccumType& sx_M2w4, AccumType& ww_4u2,
275 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
280 AccumType& sxw2, AccumType& sw2, AccumType& sx_M2w4, AccumType& ww_4u2,
281 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
286 AccumType& sxw2, AccumType& sw2, AccumType& sx_M2w4, AccumType& ww_4u2,
287 const DataIterator& dataBegin,
const WeightsIterator& weightsBegin,
288 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
293 AccumType& sxw2, AccumType& sw2, AccumType& sx_M2w4, AccumType& ww_4u2,
294 const DataIterator& dataBegin,
const WeightsIterator& weightBegin,
295 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
304 AccumType& sxw2, AccumType& sw2,
const DataIterator& dataBegin,
309 AccumType& sxw2, AccumType& sw2,
const DataIterator& dataBegin,
314 AccumType& sxw2, AccumType& sw2,
const DataIterator& dataBegin,
315 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
320 AccumType& sxw2, AccumType& sw2,
const DataIterator& dataBegin,
321 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
326 AccumType& sxw2, AccumType& sw2,
const DataIterator& dataBegin,
327 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride
331 AccumType& sxw2, AccumType& sw2,
const DataIterator& dataBegin,
332 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
337 AccumType& sxw2, AccumType& sw2,
const DataIterator& dataBegin,
338 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
339 const MaskIterator& maskBegin,
uInt maskStride,
344 AccumType& sxw2, AccumType& sw2,
const DataIterator& dataBegin,
345 const WeightsIterator& weightBegin,
uInt64 nr,
uInt dataStride,
346 const MaskIterator& maskBegin,
uInt maskStride
354 AccumType& sx_M2w4, AccumType& ww_4u2,
const DataIterator& dataBegin,
359 AccumType& sx_M2w4, AccumType& ww_4u2,
const DataIterator& dataBegin,
365 AccumType& sx_M2w4, AccumType& ww_4u2,
const DataIterator& dataBegin,
366 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
371 AccumType& sx_M2w4, AccumType& ww_4u2,
const DataIterator& dataBegin,
372 uInt64 nr,
uInt dataStride,
const MaskIterator& maskBegin,
377 AccumType& sx_M2w4, AccumType& ww_4u2,
const DataIterator& dataBegin,
378 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride
382 AccumType& sx_M2w4, AccumType& ww_4u2,
const DataIterator& dataBegin,
383 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
388 AccumType& sx_M2w4, AccumType& ww_4u2,
const DataIterator& dataBegin,
389 const WeightsIterator& weightsBegin,
uInt64 nr,
uInt dataStride,
390 const MaskIterator& maskBegin,
uInt maskStride,
395 AccumType& sx_M2w4, AccumType& ww_4u2,
const DataIterator& dataBegin,
396 const WeightsIterator& weightBegin,
uInt64 nr,
uInt dataStride,
397 const MaskIterator& maskBegin,
uInt maskStride
405 #ifndef CASACORE_NO_AUTO_TEMPLATES
406 #include <casacore/scimath/StatsFramework/BiweightStatistics.tcc>
The biweight algorithm is a robust iterative algorithm that computes two quantities called the "locat...
void _locationAndScaleSums(AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
void _computeLocationAndScaleSums(AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount, const typename StatisticsDataset< CASA_STATP >::ChunkData &chunk)
virtual AccumType getMedianAbsDevMed(CountedPtr< uInt64 > knownNpts=nullptr, CountedPtr< AccumType > knownMin=nullptr, CountedPtr< AccumType > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
void _locationSums(AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
virtual ~BiweightStatistics()
virtual StatisticsAlgorithm< CASA_STATP > * clone() const
Clone this instance.
void _locationSums(AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
sxw2 = sum(x_i*(1 - u_i^2)^2) sw2 = sum((1-u_i^2)^2)
uInt64 _npts
_npts is the number of points computed using ClassicalStatistics
void _scaleSums(AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
void _locationAndScaleSums(AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
void _scaleSums(AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
void _locationAndScaleSums(AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
void _locationAndScaleSums(AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
void _scaleSums(AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride) const
void _scaleSums(AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
sx_M2w4 = sum((x_i - _location)^2 * (1 - u_i^2)^4) = sum((x_i - _location)^2 * w_i^4) ww_4u2 = sum((1...
virtual void setStatsToCalculate(std::set< StatisticsData::STATS > &stats)
Provide guidance to algorithms by specifying a priori which statistics the caller would like calculat...
void _locationSums(AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
virtual std::map< Double, AccumType > getQuantiles(const std::set< Double > &quantiles, CountedPtr< uInt64 > npts=nullptr, CountedPtr< AccumType > min=nullptr, CountedPtr< AccumType > max=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
virtual void setCalculateAsAdded(Bool c)
If c is True, an exception is thrown; this algorithm does not support computing stats as data are add...
void _scaleSums(AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
virtual void reset()
reset object to initial state.
void _locationAndScaleSums(AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride) const
void _locationSums(AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
void _locationAndScaleSums(AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
virtual std::pair< Int64, Int64 > getStatisticIndex(StatisticsData::STATS stat)
see base class description
virtual AccumType getMedian(CountedPtr< uInt64 > knownNpts=nullptr, CountedPtr< AccumType > knownMin=nullptr, CountedPtr< AccumType > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
these statistics are not supported.
virtual AccumType getMedianAndQuantiles(std::map< Double, AccumType > &quantileToValue, const std::set< Double > &quantiles, CountedPtr< uInt64 > knownNpts=nullptr, CountedPtr< AccumType > knownMin=nullptr, CountedPtr< AccumType > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
void _locationAndScaleSums(AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
void _scaleSums(AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
void _computeScaleSums(AccumType &sx_M2w4, AccumType &ww_4u2, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount, const typename StatisticsDataset< CASA_STATP >::ChunkData &chunk) const
void _locationSums(AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride) const
virtual StatisticsData::ALGORITHM algorithm() const
get the algorithm that this object uses for computing stats
void _locationAndScaleSums(AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
sxw2 = sum(x_i*(1 - u_i^2)^2) sw2 = sum((1-u_i^2)^2) sx_M2w4 = sum((x_i - _location)^2 * (1 - u_i^2)^...
void _scaleSums(AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
std::pair< AccumType, AccumType > _range
void _locationSums(AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
static const AccumType FOUR
because the compiler gets confused if these aren't explicitly typed
BiweightStatistics(Int maxNiter=3, Double c=6.0)
void _computeLocationSums(AccumType &sxw2, AccumType &sw2, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount, const typename StatisticsDataset< CASA_STATP >::ChunkData &chunk)
virtual StatsData< AccumType > _getStatistics()
void _locationSums(AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
void _locationSums(AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
BiweightStatistics< CASA_STATP > & operator=(const BiweightStatistics< CASA_STATP > &other)
copy semantics
BiweightStatistics(const BiweightStatistics< CASA_STATP > &other)
copy semantics
void _doLocationAndScale()
static const AccumType FIVE
void _scaleSums(AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
Int getNiter() const
returns the number of iterations performed to compute the current location and scale values
Class to calculate statistics in a "classical" sense, ie using accumulators with no special filtering...
Referenced counted pointer for constant data.
ALGORITHM
implemented algorithms
Representation of a statistics dataset used in statistics framework calculatations.
const Double c
Fundamental physical constants (SI units):
this file contains all the compiler specific defines
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
bool Bool
Define the standard types used by Casacore.
unsigned long long uInt64