ConstrainedRangeStatistics.h

Go to the documentation of this file.
00001 //# Copyright (C) 2000,2001
00002 //# Associated Universities, Inc. Washington DC, USA.
00003 //#
00004 //# This library is free software; you can redistribute it and/or modify it
00005 //# under the terms of the GNU Library General Public License as published by
00006 //# the Free Software Foundation; either version 2 of the License, or (at your
00007 //# option) any later version.
00008 //#
00009 //# This library is distributed in the hope that it will be useful, but WITHOUT
00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012 //# License for more details.
00013 //#
00014 //# You should have received a copy of the GNU Library General Public License
00015 //# along with this library; if not, write to the Free Software Foundation,
00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00017 //#
00018 //# Correspondence concerning AIPS++ should be addressed as follows:
00019 //#        Internet email: aips2-request@nrao.edu.
00020 //#        Postal address: AIPS++ Project Office
00021 //#                        National Radio Astronomy Observatory
00022 //#                        520 Edgemont Road
00023 //#                        Charlottesville, VA 22903-2475 USA
00024 //#
00025 //# $Id: Array.h 21545 2015-01-22 19:36:35Z gervandiepen $
00026 
00027 #ifndef SCIMATH_CONSTRAINEDRANGESTATISTICS_H
00028 #define SCIMATH_CONSTRAINEDRANGESTATISTICS_H
00029 
00030 #include <casacore/casa/aips.h>
00031 
00032 #include <casacore/scimath/Mathematics/ClassicalStatistics.h>
00033 
00034 #include <set>
00035 #include <vector>
00036 #include <utility>
00037 
00038 namespace casacore {
00039 
00040 // Abstract base class for statistics algorithms which are characterized by
00041 // a range of good values. The range is usually calculated dynamically based on the entire distribution.
00042 
00043 template <class AccumType, class DataIterator, class MaskIterator=const Bool*, class WeightsIterator=DataIterator>
00044 class ConstrainedRangeStatistics
00045     : public ClassicalStatistics<CASA_STATP> {
00046 public:
00047 
00048     virtual ~ConstrainedRangeStatistics();
00049 
00050     // copy semantics
00051     ConstrainedRangeStatistics<CASA_STATP>& operator=(
00052         const ConstrainedRangeStatistics<CASA_STATP>& other
00053     );
00054 
00055     // <group>
00056     // In the following group of methods, if the size of the composite dataset
00057     // is smaller than
00058     // <src>binningThreshholdSizeBytes</src>, the composite dataset
00059     // will be (perhaps partially) sorted and persisted in memory during the
00060     // call. In that case, and if <src>persistSortedArray</src> is True, this
00061     // sorted array will remain in memory after the call and will be used on
00062     // subsequent calls of this method when <src>binningThreshholdSizeBytes</src>
00063     // is greater than the size of the composite dataset. If
00064     // <src>persistSortedArray</src> is False, the sorted array will not be
00065     // stored after this call completes and so any subsequent calls for which the
00066     // dataset size is less than <src>binningThreshholdSizeBytes</src>, the
00067     // dataset will be sorted from scratch. Values which are not included due to
00068     // non-unity strides, are not included in any specified ranges, are masked,
00069     // or have associated weights of zero are not considered as dataset members
00070     // for quantile computations.
00071     // If one has a priori information regarding
00072     // the number of points (npts) and/or the minimum and maximum values of the data
00073     // set, these can be supplied to improve performance. Note however, that if these
00074     // values are not correct, the resulting median
00075     // and/or quantile values will also not be correct (although see the following notes regarding
00076     // max/min). Note that if this object has already had getStatistics()
00077     // called, and the min and max were calculated, there is no need to pass these values in
00078     // as they have been stored internally and used (although passing them in shouldn't hurt
00079     // anything). If provided, npts, the number of points falling in the specified ranges which are
00080     // not masked and have weights > 0, should be exactly correct. <src>min</src> can be less than
00081     // the true minimum, and <src>max</src> can be greater than the True maximum, but for best
00082     // performance, these should be as close to the actual min and max as possible.
00083     // In order for quantile computations to occur over multiple datasets, all datasets
00084     // must be available. This means that if setCalculateAsAdded()
00085     // was previously called by passing in a value of True, these methods will throw
00086     // an exception as the previous call indicates that there is no guarantee that
00087     // all datasets will be available. If one uses a data provider (by having called
00088     // setDataProvider()), then this should not be an issue.
00089 
00090     // get the median of the distribution.
00091     // For a dataset with an odd number of good points, the median is just the value
00092     // at index int(N/2) in the equivalent sorted dataset, where N is the number of points.
00093     // For a dataset with an even number of points, the median is the mean of the values at
00094     // indices int(N/2)-1 and int(N/2) in the sorted dataset.
00095     AccumType getMedian(
00096         CountedPtr<uInt64> knownNpts=NULL, CountedPtr<AccumType> knownMin=NULL,
00097         CountedPtr<AccumType> knownMax=NULL, uInt binningThreshholdSizeBytes=4096*4096,
00098         Bool persistSortedArray=False, uInt64 nBins=10000
00099     );
00100 
00101     // get the median of the absolute deviation about the median of the data.
00102     AccumType getMedianAbsDevMed(
00103         CountedPtr<uInt64> knownNpts=NULL,
00104         CountedPtr<AccumType> knownMin=NULL, CountedPtr<AccumType> knownMax=NULL,
00105         uInt binningThreshholdSizeBytes=4096*4096, Bool persistSortedArray=False,
00106         uInt64 nBins=10000
00107     );
00108 
00109     // If one needs to compute both the median and quantile values, it is better to call
00110     // getMedianAndQuantiles() rather than getMedian() and getQuantiles() seperately, as the
00111     // first will scan large data sets fewer times than calling the seperate methods.
00112     // The return value is the median; the quantiles are returned in the <src>quantileToValue</src> map.
00113     AccumType getMedianAndQuantiles(
00114         std::map<Double, AccumType>& quantileToValue, const std::set<Double>& quantiles,
00115         CountedPtr<uInt64> knownNpts=NULL, CountedPtr<AccumType> knownMin=NULL,
00116         CountedPtr<AccumType> knownMax=NULL,
00117         uInt binningThreshholdSizeBytes=4096*4096, Bool persistSortedArray=False,
00118         uInt64 nBins=10000
00119     );
00120 
00121     // Get the specified quantiles. <src>quantiles</src> must be between 0 and 1,
00122     // noninclusive.
00123     std::map<Double, AccumType> getQuantiles(
00124         const std::set<Double>& quantiles, CountedPtr<uInt64> knownNpts=NULL,
00125         CountedPtr<AccumType> knownMin=NULL, CountedPtr<AccumType> knownMax=NULL,
00126         uInt binningThreshholdSizeBytes=4096*4096, Bool persistSortedArray=False,
00127         uInt64 nBins=10000
00128     );
00129     // </group>
00130 
00131     // get the min and max of the data set
00132     virtual void getMinMax(AccumType& mymin, AccumType& mymax);
00133 
00134     // scan the dataset(s) that have been added, and find the number of good points.
00135     // This method may be called even if setStatsToCaclulate has been called and
00136     // NPTS has been excluded. If setCalculateAsAdded(True) has previously been
00137     // called after this object has been (re)initialized, an exception will be thrown.
00138     virtual uInt64 getNPts();
00139 
00140     // see base class description
00141     std::pair<Int64, Int64> getStatisticIndex(StatisticsData::STATS stat);
00142 
00143     // reset object to initial state. Clears all private fields including data,
00144     // accumulators, global range. It does not affect the fence factor (_f), which was
00145     // set at object construction.
00146     virtual void reset();
00147 
00148 protected:
00149 
00150     ConstrainedRangeStatistics();
00151 
00152     // <group>
00153     // scan through the data set to determine the number of good (unmasked, weight > 0,
00154     // within range) points. The first with no mask, no
00155     // ranges, and no weights is trivial with npts = nr in this class, but is implemented here
00156     // so that derived classes may override it.
00157     inline void _accumNpts(
00158         uInt64& npts,
00159         const DataIterator& dataStart, Int64 nr, uInt dataStride
00160     ) const;
00161 
00162     void _accumNpts(
00163         uInt64& npts,
00164         const DataIterator& dataStart, Int64 nr, uInt dataStride,
00165         const DataRanges& ranges, Bool isInclude
00166     ) const;
00167 
00168     void _accumNpts(
00169         uInt64& npts,
00170         const DataIterator& dataBegin, Int64 nr, uInt dataStride,
00171         const MaskIterator& maskBegin, uInt maskStride
00172     ) const;
00173 
00174     void _accumNpts(
00175         uInt64& npts,
00176         const DataIterator& dataBegin, Int64 nr, uInt dataStride,
00177         const MaskIterator& maskBegin, uInt maskStride, const DataRanges& ranges,
00178         Bool isInclude
00179     ) const;
00180 
00181     void _accumNpts(
00182         uInt64& npts,
00183         const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
00184         Int64 nr, uInt dataStride
00185     ) const;
00186 
00187     void _accumNpts(
00188         uInt64& npts,
00189         const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
00190         Int64 nr, uInt dataStride, const DataRanges& ranges, Bool isInclude
00191     ) const;
00192 
00193     void _accumNpts(
00194         uInt64& npts,
00195         const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
00196         Int64 nr, uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
00197         const DataRanges& ranges, Bool isInclude
00198     ) const;
00199 
00200     void _accumNpts(
00201         uInt64& npts,
00202         const DataIterator& dataBegin, const WeightsIterator& weightBegin,
00203         Int64 nr, uInt dataStride, const MaskIterator& maskBegin, uInt maskStride
00204     ) const;
00205     // </group>
00206 
00207     virtual void _findBins(
00208         vector<vector<uInt64> >& binCounts,
00209         vector<CountedPtr<AccumType> >& sameVal, vector<Bool>& allSame,
00210         const DataIterator& dataBegin, Int64 nr, uInt dataStride,
00211         const vector<typename StatisticsUtilities<AccumType>::BinDesc>& binDesc,
00212         const vector<AccumType>& maxLimit
00213     ) const;
00214 
00215     virtual void _findBins(
00216         vector<vector<uInt64> >& binCounts,
00217         vector<CountedPtr<AccumType> >& sameVal, vector<Bool>& allSame,
00218         const DataIterator& dataBegin, Int64 nr, uInt dataStride,
00219         const DataRanges& ranges, Bool isInclude,
00220         const vector<typename StatisticsUtilities<AccumType>::BinDesc>& binDesc, const vector<AccumType>& maxLimit
00221     ) const;
00222 
00223     virtual void _findBins(
00224         vector<vector<uInt64> >& binCounts,
00225         vector<CountedPtr<AccumType> >& sameVal, vector<Bool>& allSame,
00226         const DataIterator& dataBegin, Int64 nr, uInt dataStride,
00227         const MaskIterator& maskBegin, uInt maskStride,
00228         const vector<typename StatisticsUtilities<AccumType>::BinDesc>& binDesc, const vector<AccumType>& maxLimit
00229     ) const;
00230 
00231     virtual void _findBins(
00232         vector<vector<uInt64> >& binCounts,
00233         vector<CountedPtr<AccumType> >& sameVal, vector<Bool>& allSame,
00234         const DataIterator& dataBegin, Int64 nr, uInt dataStride,
00235         const MaskIterator& maskBegin, uInt maskStride, const DataRanges& ranges,
00236         Bool isInclude,
00237         const vector<typename StatisticsUtilities<AccumType>::BinDesc>& binDesc, const vector<AccumType>& maxLimit
00238     ) const;
00239 
00240     virtual void _findBins(
00241         vector<vector<uInt64> >& binCounts,
00242         vector<CountedPtr<AccumType> >& sameVal, vector<Bool>& allSame,
00243         const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
00244         Int64 nr, uInt dataStride,
00245         const vector<typename StatisticsUtilities<AccumType>::BinDesc>& binDesc, const vector<AccumType>& maxLimit
00246     ) const ;
00247 
00248     virtual void _findBins(
00249         vector<vector<uInt64> >& binCounts,
00250         vector<CountedPtr<AccumType> >& sameVal, vector<Bool>& allSame,
00251         const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
00252         Int64 nr, uInt dataStride, const DataRanges& ranges, Bool isInclude,
00253         const vector<typename StatisticsUtilities<AccumType>::BinDesc>& binDesc, const vector<AccumType>& maxLimit
00254     ) const;
00255 
00256     virtual void _findBins(
00257         vector<vector<uInt64> >& binCounts,
00258         vector<CountedPtr<AccumType> >& sameVal, vector<Bool>& allSame,
00259         const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
00260         Int64 nr, uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
00261         const DataRanges& ranges, Bool isInclude,
00262         const vector<typename StatisticsUtilities<AccumType>::BinDesc>& binDesc, const vector<AccumType>& maxLimit
00263     ) const;
00264 
00265     virtual void _findBins(
00266         vector<vector<uInt64> >& binCounts,
00267         vector<CountedPtr<AccumType> >& sameVal, vector<Bool>& allSame,
00268         const DataIterator& dataBegin, const WeightsIterator& weightBegin,
00269         Int64 nr, uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
00270         const vector<typename StatisticsUtilities<AccumType>::BinDesc>& binDesc, const vector<AccumType>& maxLimit
00271     ) const;
00272     // </group>
00273 
00274     AccumType _getStatistic(StatisticsData::STATS stat);
00275 
00276     StatsData<AccumType> _getStatistics();
00277 
00278     inline Bool _isInRange(const AccumType& datum) const;
00279 
00280     // <group>
00281     virtual void _minMax(
00282         CountedPtr<AccumType>& mymin, CountedPtr<AccumType>& mymax,
00283         const DataIterator& dataBegin, Int64 nr, uInt dataStride
00284     ) const;
00285 
00286     virtual void _minMax(
00287         CountedPtr<AccumType>& mymin, CountedPtr<AccumType>& mymax,
00288         const DataIterator& dataBegin, Int64 nr, uInt dataStride,
00289         const DataRanges& ranges, Bool isInclude
00290     ) const;
00291 
00292     virtual void _minMax(
00293         CountedPtr<AccumType>& mymin, CountedPtr<AccumType>& mymax,
00294         const DataIterator& dataBegin, Int64 nr, uInt dataStride,
00295         const MaskIterator& maskBegin, uInt maskStride
00296     ) const;
00297 
00298     virtual void _minMax(
00299         CountedPtr<AccumType>& mymin, CountedPtr<AccumType>& mymax,
00300         const DataIterator& dataBegin, Int64 nr, uInt dataStride,
00301         const MaskIterator& maskBegin, uInt maskStride, const DataRanges& ranges,
00302         Bool isInclude
00303     ) const;
00304 
00305     virtual void _minMax(
00306         CountedPtr<AccumType>& mymin, CountedPtr<AccumType>& mymax,
00307         const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
00308         Int64 nr, uInt dataStride
00309     ) const;
00310 
00311     virtual void _minMax(
00312         CountedPtr<AccumType>& mymin, CountedPtr<AccumType>& mymax,
00313         const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
00314         Int64 nr, uInt dataStride, const DataRanges& ranges, Bool isInclude
00315     ) const;
00316 
00317     virtual void _minMax(
00318         CountedPtr<AccumType>& mymin, CountedPtr<AccumType>& mymax,
00319         const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
00320         Int64 nr, uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
00321         const DataRanges& ranges, Bool isInclude
00322     ) const;
00323 
00324     virtual void _minMax(
00325         CountedPtr<AccumType>& mymin, CountedPtr<AccumType>& mymax,
00326         const DataIterator& dataBegin, const WeightsIterator& weightBegin,
00327         Int64 nr, uInt dataStride, const MaskIterator& maskBegin, uInt maskStride
00328     ) const;
00329     // </group>
00330 
00331     //<group>
00332     // populate an unsorted array with valid data. If <src>includeLimits</src> is defined,
00333     // then restrict values that are entered in the array to those limits (inclusive of the
00334     // minimum, exclusive of the maximum). <src>maxCount</src> and <src>currentCount</src> are
00335     // used only if <src>includeLimits</src> is defined. In this case, the method will return
00336     // when currentCount == maxCount, thus avoiding scanning remaining data unnecessarily.
00337 
00338     // no weights, no mask, no ranges
00339     void _populateArray(
00340         vector<AccumType>& ary, const DataIterator& dataBegin, Int64 nr, uInt dataStride
00341     ) const;
00342 
00343     // ranges
00344     void _populateArray(
00345         vector<AccumType>& ary, const DataIterator& dataBegin, Int64 nr,
00346         uInt dataStride, const DataRanges& ranges, Bool isInclude
00347     ) const;
00348 
00349     void _populateArray(
00350         vector<AccumType>& ary, const DataIterator& dataBegin,
00351         Int64 nr, uInt dataStride, const MaskIterator& maskBegin,
00352         uInt maskStride
00353     ) const;
00354 
00355     // mask and ranges
00356     void _populateArray(
00357         vector<AccumType>& ary, const DataIterator& dataBegin, Int64 nr,
00358         uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
00359         const DataRanges& ranges, Bool isInclude
00360     ) const;
00361 
00362     // weights
00363     void _populateArray(
00364         vector<AccumType>& ary, const DataIterator& dataBegin,
00365         const WeightsIterator& weightsBegin, Int64 nr, uInt dataStride
00366     ) const;
00367 
00368     // weights and ranges
00369     void _populateArray(
00370         vector<AccumType>& ary, const DataIterator& dataBegin,
00371         const WeightsIterator& weightsBegin, Int64 nr, uInt dataStride,
00372         const DataRanges& ranges, Bool isInclude
00373     ) const;
00374 
00375     // weights and mask
00376     void _populateArray(
00377         vector<AccumType>& ary, const DataIterator& dataBegin,
00378         const WeightsIterator& weightBegin, Int64 nr, uInt dataStride,
00379         const MaskIterator& maskBegin, uInt maskStride
00380     ) const;
00381 
00382     // weights, mask, ranges
00383     void _populateArray(
00384         vector<AccumType>& ary, const DataIterator& dataBegin, const WeightsIterator& weightBegin,
00385         Int64 nr, uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
00386         const DataRanges& ranges, Bool isInclude
00387     ) const;
00388 
00389     // no weights, no mask, no ranges
00390     virtual void _populateArrays(
00391         vector<vector<AccumType> >& arys, uInt64& currentCount, const DataIterator& dataBegin, Int64 nr, uInt dataStride,
00392         const vector<std::pair<AccumType, AccumType> > &includeLimits, uInt64 maxCount
00393     ) const;
00394 
00395     // ranges
00396     virtual void _populateArrays(
00397         vector<vector<AccumType> >& arys, uInt64& currentCount, const DataIterator& dataBegin, Int64 nr,
00398         uInt dataStride, const DataRanges& ranges, Bool isInclude,
00399         const vector<std::pair<AccumType, AccumType> > &includeLimits, uInt64 maxCount
00400     ) const;
00401 
00402     virtual void _populateArrays(
00403         vector<vector<AccumType> >& arys, uInt64& currentCount, const DataIterator& dataBegin,
00404         Int64 nr, uInt dataStride, const MaskIterator& maskBegin,
00405         uInt maskStride,
00406         const vector<std::pair<AccumType, AccumType> > &includeLimits, uInt64 maxCount
00407     ) const;
00408 
00409     // mask and ranges
00410     virtual void _populateArrays(
00411         vector<vector<AccumType> >& arys, uInt64& currentCount, const DataIterator& dataBegin, Int64 nr,
00412         uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
00413         const DataRanges& ranges, Bool isInclude,
00414         const vector<std::pair<AccumType, AccumType> > &includeLimits, uInt64 maxCount
00415     ) const;
00416 
00417     // weights
00418     virtual void _populateArrays(
00419         vector<vector<AccumType> >& arys, uInt64& currentCount, const DataIterator& dataBegin,
00420         const WeightsIterator& weightsBegin, Int64 nr, uInt dataStride,
00421         const vector<std::pair<AccumType, AccumType> > &includeLimits, uInt64 maxCount
00422     ) const;
00423 
00424     // weights and ranges
00425     virtual void _populateArrays(
00426         vector<vector<AccumType> >& arys, uInt64& currentCount, const DataIterator& dataBegin,
00427         const WeightsIterator& weightsBegin, Int64 nr, uInt dataStride,
00428         const DataRanges& ranges, Bool isInclude,
00429         const vector<std::pair<AccumType, AccumType> > &includeLimits, uInt64 maxCount
00430     ) const;
00431 
00432     // weights and mask
00433     virtual void _populateArrays(
00434         vector<vector<AccumType> >& arys, uInt64& currentCount, const DataIterator& dataBegin,
00435         const WeightsIterator& weightBegin, Int64 nr, uInt dataStride,
00436         const MaskIterator& maskBegin, uInt maskStride,
00437         const vector<std::pair<AccumType, AccumType> > &includeLimits, uInt64 maxCount
00438     ) const;
00439 
00440     // weights, mask, ranges
00441     virtual void _populateArrays(
00442         vector<vector<AccumType> >& arys, uInt64& currentCount, const DataIterator& dataBegin, const WeightsIterator& weightBegin,
00443         Int64 nr, uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
00444         const DataRanges& ranges, Bool isInclude,
00445         const vector<std::pair<AccumType, AccumType> > &includeLimits, uInt64 maxCount
00446     ) const;
00447     // </group>
00448 
00449     // <group>
00450     // no weights, no mask, no ranges
00451     Bool _populateTestArray(
00452         vector<AccumType>& ary, const DataIterator& dataBegin,
00453         Int64 nr, uInt dataStride, uInt maxElements
00454     ) const;
00455 
00456     // ranges
00457     Bool _populateTestArray(
00458         vector<AccumType>& ary, const DataIterator& dataBegin, Int64 nr,
00459         uInt dataStride, const DataRanges& ranges, Bool isInclude,
00460         uInt maxElements
00461     ) const;
00462 
00463     // mask
00464     Bool _populateTestArray(
00465         vector<AccumType>& ary, const DataIterator& dataBegin,
00466         Int64 nr, uInt dataStride, const MaskIterator& maskBegin,
00467         uInt maskStride, uInt maxElements
00468     ) const;
00469 
00470     // mask and ranges
00471     Bool _populateTestArray(
00472         vector<AccumType>& ary, const DataIterator& dataBegin, Int64 nr,
00473         uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
00474         const DataRanges& ranges, Bool isInclude, uInt maxElements
00475     ) const;
00476 
00477     // weights
00478     Bool _populateTestArray(
00479         vector<AccumType>& ary, const DataIterator& dataBegin,
00480         const WeightsIterator& weightBegin, Int64 nr, uInt dataStride,
00481         uInt maxElements
00482     ) const;
00483 
00484     // weights and ranges
00485     Bool _populateTestArray(
00486         vector<AccumType>& ary, const DataIterator& dataBegin,
00487         const WeightsIterator& weightsBegin, Int64 nr, uInt dataStride,
00488         const DataRanges& ranges, Bool isInclude, uInt maxElements
00489     ) const;
00490 
00491     // weights and mask
00492     Bool _populateTestArray(
00493         vector<AccumType>& ary, const DataIterator& dataBegin,
00494         const WeightsIterator& weightBegin, Int64 nr,
00495         uInt dataStride, const MaskIterator& maskBegin,
00496         uInt maskStride, uInt maxElements
00497     ) const;
00498 
00499     // weights, mask, ranges
00500     Bool _populateTestArray(
00501         vector<AccumType>& ary, const DataIterator& dataBegin, const WeightsIterator& weightBegin,
00502         Int64 nr, uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
00503         const DataRanges& ranges, Bool isInclude,
00504         uInt maxElements
00505     ) const;
00506     // </group>
00507 
00508     inline void _setRange(CountedPtr<std::pair<AccumType, AccumType> > r) { this->_clearStats(); _range = r; }
00509 
00510     // derived classes need to implement how to set their respective range
00511     virtual void _setRange() = 0;
00512 /*
00513     // <group>
00514     // no weights, no mask, no ranges
00515     void _unweightedStats(
00516         StatsData<AccumType>& stats, uInt64& ngood, AccumType& mymin,
00517         AccumType& mymax, Int64& minpos, Int64& maxpos,
00518         const DataIterator& dataBegin, Int64 nr, uInt dataStride
00519     );
00520 
00521     // no weights, no mask
00522     void _unweightedStats(
00523         StatsData<AccumType>& stats, uInt64& ngood, AccumType& mymin,
00524         AccumType& mymax, Int64& minpos, Int64& maxpos,
00525         const DataIterator& dataBegin, Int64 nr, uInt dataStride,
00526         const DataRanges& ranges, Bool isInclude
00527     );
00528 
00529     void _unweightedStats(
00530         StatsData<AccumType>& stats, uInt64& ngood, AccumType& mymin,
00531         AccumType& mymax, Int64& minpos, Int64& maxpos,
00532         const DataIterator& dataBegin, Int64 nr, uInt dataStride,
00533         const MaskIterator& maskBegin, uInt maskStride
00534     );
00535 
00536     void _unweightedStats(
00537         StatsData<AccumType>& stats, uInt64& ngood, AccumType& mymin,
00538         AccumType& mymax, Int64& minpos, Int64& maxpos,
00539         const DataIterator& dataBegin, Int64 nr, uInt dataStride,
00540         const MaskIterator& maskBegin, uInt maskStride,
00541         const DataRanges& ranges, Bool isInclude
00542     );
00543     // </group>
00544 
00545     // <group>
00546     // has weights, but no mask, no ranges
00547     void _weightedStats(
00548         StatsData<AccumType>& stats, AccumType& mymin, AccumType& mymax,
00549         Int64& minpos, Int64& maxpos,
00550         const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
00551         Int64 nr, uInt dataStride
00552     );
00553 
00554     void _weightedStats(
00555         StatsData<AccumType>& stats, AccumType& mymin, AccumType& mymax,
00556         Int64& minpos, Int64& maxpos,
00557         const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
00558         Int64 nr, uInt dataStride, const DataRanges& ranges, Bool isInclude
00559     );
00560 
00561     void _weightedStats(
00562         StatsData<AccumType>& stats, AccumType& mymin, AccumType& mymax,
00563         Int64& minpos, Int64& maxpos,
00564         const DataIterator& dataBegin, const WeightsIterator& weightBegin,
00565         Int64 nr, uInt dataStride, const MaskIterator& maskBegin, uInt maskStride
00566     );
00567 
00568     void _weightedStats(
00569         StatsData<AccumType>& stats, AccumType& mymin, AccumType& mymax,
00570         Int64& minpos, Int64& maxpos,
00571         const DataIterator& dataBegin, const WeightsIterator& weightBegin,
00572         Int64 nr, uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
00573         const DataRanges& ranges, Bool isInclude
00574     );
00575     // </group>
00576 */
00577 
00578     // <group>
00579     // no weights, no mask, no ranges
00580     void _unweightedStats(
00581         StatsData<AccumType>& stats, uInt64& ngood, /* AccumType& mymin,
00582         AccumType& mymax, LocationType& minpos, LocationType& maxpos, */
00583         LocationType& location, const DataIterator& dataBegin, Int64 nr,
00584         uInt dataStride
00585     );
00586 
00587     // no weights, no mask
00588     void _unweightedStats(
00589         StatsData<AccumType>& stats, uInt64& ngood, /* AccumType& mymin,
00590         AccumType& mymax, LocationType& minpos, LocationType& maxpos, */
00591         LocationType& location, const DataIterator& dataBegin, Int64 nr,
00592         uInt dataStride, const DataRanges& ranges, Bool isInclude
00593     );
00594 
00595     void _unweightedStats(
00596         StatsData<AccumType>& stats, uInt64& ngood, /* AccumType& mymin,
00597         AccumType& mymax, LocationType& minpos, LocationType& maxpos, */
00598         LocationType& location, const DataIterator& dataBegin, Int64 nr,
00599         uInt dataStride, const MaskIterator& maskBegin, uInt maskStride
00600     );
00601 
00602     void _unweightedStats(
00603         StatsData<AccumType>& stats, uInt64& ngood, /* AccumType& mymin,
00604         AccumType& mymax, LocationType& minpos, LocationType& maxpos, */
00605         LocationType& location, const DataIterator& dataBegin, Int64 nr,
00606         uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
00607         const DataRanges& ranges, Bool isInclude
00608     );
00609     // </group>
00610 
00611     // <group>
00612     // has weights, but no mask, no ranges
00613     void _weightedStats(
00614         StatsData<AccumType>& stats, /* AccumType& mymin, AccumType& mymax,
00615         LocationType& minpos, LocationType& maxpos, */LocationType& location,
00616         const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
00617         Int64 nr, uInt dataStride
00618     );
00619 
00620     void _weightedStats(
00621         StatsData<AccumType>& stats, /* AccumType& mymin, AccumType& mymax,
00622         LocationType& minpos, LocationType& maxpos, */ LocationType& location,
00623         const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
00624         Int64 nr, uInt dataStride, const DataRanges& ranges, Bool isInclude
00625     );
00626 
00627     void _weightedStats(
00628         StatsData<AccumType>& stats, /* AccumType& mymin, AccumType& mymax,
00629         LocationType& minpos, LocationType& maxpos, */ LocationType& location,
00630         const DataIterator& dataBegin, const WeightsIterator& weightBegin,
00631         Int64 nr, uInt dataStride, const MaskIterator& maskBegin, uInt maskStride
00632     );
00633 
00634     void _weightedStats(
00635         StatsData<AccumType>& stats, /* AccumType& mymin, AccumType& mymax,
00636         LocationType& minpos, LocationType& maxpos, */ LocationType& location,
00637         const DataIterator& dataBegin, const WeightsIterator& weightBegin,
00638         Int64 nr, uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
00639         const DataRanges& ranges, Bool isInclude
00640     );
00641     // </group>
00642 
00643 private:
00644     CountedPtr<std::pair<AccumType, AccumType> > _range;
00645     Bool _doMedAbsDevMed;
00646 
00647 };
00648 
00649 }
00650 
00651 #ifndef CASACORE_NO_AUTO_TEMPLATES
00652 #include <casacore/scimath/Mathematics/ConstrainedRangeStatistics.tcc>
00653 #endif
00654 
00655 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1