26 #ifndef SCIMATH_BIWEIGHTSTATISTICS_H
27 #define SCIMATH_BIWEIGHTSTATISTICS_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,
188 virtual void reset();
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>
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)
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)^...
Representation of a statistics dataset used in statistics framework calculatations.
void _computeScaleSums(AccumType &sx_M2w4, AccumType &ww_4u2, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount, const typename StatisticsDataset< CASA_STATP >::ChunkData &chunk) const
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)
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.
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
BiweightStatistics(Int maxNiter=3, Double c=6.0)
unsigned long long uInt64
void _computeLocationSums(AccumType &sxw2, AccumType &sw2, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount, const typename StatisticsDataset< CASA_STATP >::ChunkData &chunk)
virtual ~BiweightStatistics()
virtual StatsData< AccumType > _getStatistics()
Int getNiter() const
returns the number of iterations performed to compute the current location and scale values ...
BiweightStatistics< CASA_STATP > & operator=(const BiweightStatistics< CASA_STATP > &other)
copy semantics
virtual void setStatsToCalculate(std::set< StatisticsData::STATS > &stats)
Provide guidance to algorithms by specifying a priori which statistics the caller would like calculat...
uInt64 _npts
_npts is the number of points computed using ClassicalStatistics
Class to calculate statistics in a "classical" sense, ie using accumulators with no special filtering...
void _doLocationAndScale()
std::pair< AccumType, AccumType > _range
ALGORITHM
implemented algorithms
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)
virtual void setCalculateAsAdded(Bool c)
If c is True, an exception is thrown; this algorithm does not support computing stats as data are add...
virtual std::pair< Int64, Int64 > getStatisticIndex(StatisticsData::STATS stat)
see base class description
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)
Referenced counted pointer for constant data.
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
static const AccumType FIVE
virtual StatisticsData::ALGORITHM algorithm() const
get the algorithm that this object uses for computing stats
virtual StatisticsAlgorithm< CASA_STATP > * clone() const
Clone this instance.
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...
bool Bool
Define the standard types used by Casacore.
The biweight algorithm is a robust iterative algorithm that computes two quantities called the "locat...
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)
const Double c
Fundamental physical constants (SI units):
static const AccumType FOUR
because the compiler gets confused if these aren't explicitly typed
virtual void reset()
reset object to initial state.