casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HingesFencesQuantileComputer.h
Go to the documentation of this file.
1 //# Copyright (C) 2000,2001
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 
26 #ifndef SCIMATH_HINGESFENCESQUANTILECOMPUTER_H
27 #define SCIMATH_HINGESFENCESQUANTILECOMPUTER_H
28 
30 
32 
33 #include <casacore/casa/aips.h>
34 
35 namespace casacore {
36 
37 // QuantileComputer used by HingesFencesStatistics for computing quantile-like
38 // statistics. API developers should never explicitly instantiate this class.
39 // See class documentation for StatisticsAlgorithm for details regarding
40 // QuantileComputer classes.
41 
42 template <
43  class AccumType, class DataIterator, class MaskIterator=const Bool*,
44  class WeightsIterator=DataIterator
45 >
47  : public ConstrainedRangeQuantileComputer<CASA_STATP> {
48 public:
49 
51 
53 
54  // copy semantics
56 
58 
59  // copy semantics
61  const HingesFencesQuantileComputer& other
62  );
63 
64  // clone this object by returning a pointer to a copy
66 
67  // reset private fields
68  virtual void reset();
69 
70  void setHasRange(Bool hr) { _hasRange = hr; }
71 
72 protected:
73 
74  // <group>
75  virtual void _findBins(
76  std::vector<BinCountArray>& binCounts,
77  std::vector<CountedPtr<AccumType>>& sameVal, std::vector<Bool>& allSame,
78  const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
79  const std::vector<StatsHistogram<AccumType>>& binDesc,
80  const std::vector<AccumType>& maxLimit
81  ) const;
82 
83  virtual void _findBins(
84  std::vector<BinCountArray>& binCounts,
85  std::vector<CountedPtr<AccumType>>& sameVal, std::vector<Bool>& allSame,
86  const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
87  const DataRanges& ranges, Bool isInclude,
88  const std::vector<StatsHistogram<AccumType>>& binDesc,
89  const std::vector<AccumType>& maxLimit
90  ) const;
91 
92  virtual void _findBins(
93  std::vector<BinCountArray>& binCounts,
94  std::vector<CountedPtr<AccumType>>& sameVal, std::vector<Bool>& allSame,
95  const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
96  const MaskIterator& maskBegin, uInt maskStride,
97  const std::vector<StatsHistogram<AccumType>>& binDesc,
98  const std::vector<AccumType>& maxLimit
99  ) const;
100 
101  virtual void _findBins(
102  std::vector<BinCountArray>& binCounts,
103  std::vector<CountedPtr<AccumType>>& sameVal, std::vector<Bool>& allSame,
104  const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
105  const MaskIterator& maskBegin, uInt maskStride,
106  const DataRanges& ranges, Bool isInclude,
107  const std::vector<StatsHistogram<AccumType>>& binDesc,
108  const std::vector<AccumType>& maxLimit
109  ) const;
110 
111  virtual void _findBins(
112  std::vector<BinCountArray>& binCounts,
113  std::vector<CountedPtr<AccumType>>& sameVal, std::vector<Bool>& allSame,
114  const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
115  uInt64 nr, uInt dataStride,
116  const std::vector<StatsHistogram<AccumType>>& binDesc,
117  const std::vector<AccumType>& maxLimit
118  ) const ;
119 
120  virtual void _findBins(
121  std::vector<BinCountArray>& binCounts,
122  std::vector<CountedPtr<AccumType>>& sameVal, std::vector<Bool>& allSame,
123  const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
124  uInt64 nr, uInt dataStride, const DataRanges& ranges, Bool isInclude,
125  const std::vector<StatsHistogram<AccumType>>& binDesc,
126  const std::vector<AccumType>& maxLimit
127  ) const;
128 
129  virtual void _findBins(
130  std::vector<BinCountArray>& binCounts,
131  std::vector<CountedPtr<AccumType>>& sameVal, std::vector<Bool>& allSame,
132  const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
133  uInt64 nr, uInt dataStride, const MaskIterator& maskBegin,
134  uInt maskStride, const DataRanges& ranges, Bool isInclude,
135  const std::vector<StatsHistogram<AccumType>>& binDesc,
136  const std::vector<AccumType>& maxLimit
137  ) const;
138 
139  virtual void _findBins(
140  std::vector<BinCountArray>& binCounts,
141  std::vector<CountedPtr<AccumType>>& sameVal, std::vector<Bool>& allSame,
142  const DataIterator& dataBegin, const WeightsIterator& weightBegin,
143  uInt64 nr, uInt dataStride, const MaskIterator& maskBegin,
144  uInt maskStride, const std::vector<StatsHistogram<AccumType>>& binDesc,
145  const std::vector<AccumType>& maxLimit
146  ) const;
147  // </group>
148 
149  //<group>
150  // populate an unsorted array with valid data. If <src>includeLimits</src>
151  // is defined, then restrict values that are entered in the array to those
152  // limits (inclusive of the minimum, exclusive of the maximum).
153  // <src>maxCount</src> and <src>currentCount</src> are used only if
154  // <src>includeLimits</src> is defined. In this case, the method will return
155  // when currentCount == maxCount, thus avoiding scanning remaining data
156  // unnecessarily.
157 
158  // no weights, no mask, no ranges
159  virtual void _populateArray(
160  DataArray& ary, const DataIterator& dataBegin, uInt64 nr,
161  uInt dataStride
162  ) const;
163 
164  // ranges
165  virtual void _populateArray(
166  DataArray& ary, const DataIterator& dataBegin, uInt64 nr,
167  uInt dataStride, const DataRanges& ranges, Bool isInclude
168  ) const;
169 
170  virtual void _populateArray(
171  DataArray& ary, const DataIterator& dataBegin, uInt64 nr,
172  uInt dataStride, const MaskIterator& maskBegin, uInt maskStride
173  ) const;
174 
175  // mask and ranges
176  virtual void _populateArray(
177  DataArray& ary, const DataIterator& dataBegin, uInt64 nr,
178  uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
179  const DataRanges& ranges, Bool isInclude
180  ) const;
181 
182  // weights
183  virtual void _populateArray(
184  DataArray& ary, const DataIterator& dataBegin,
185  const WeightsIterator& weightsBegin, uInt64 nr, uInt dataStride
186  ) const;
187 
188  // weights and ranges
189  virtual void _populateArray(
190  DataArray& ary, const DataIterator& dataBegin,
191  const WeightsIterator& weightsBegin, uInt64 nr, uInt dataStride,
192  const DataRanges& ranges, Bool isInclude
193  ) const;
194 
195  // weights and mask
196  virtual void _populateArray(
197  DataArray& ary, const DataIterator& dataBegin,
198  const WeightsIterator& weightBegin, uInt64 nr, uInt dataStride,
199  const MaskIterator& maskBegin, uInt maskStride
200  ) const;
201 
202  // weights, mask, ranges
203  virtual void _populateArray(
204  DataArray& ary, const DataIterator& dataBegin,
205  const WeightsIterator& weightBegin, uInt64 nr, uInt dataStride,
206  const MaskIterator& maskBegin, uInt maskStride,
207  const DataRanges& ranges, Bool isInclude
208  ) const;
209 
210  // no weights, no mask, no ranges
211  virtual void _populateArrays(
212  std::vector<DataArray>& arys, uInt64& currentCount,
213  const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
214  const IncludeLimits& includeLimits,
215  uInt64 maxCount
216  ) const;
217 
218  // ranges
219  virtual void _populateArrays(
220  std::vector<DataArray>& arys, uInt64& currentCount,
221  const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
222  const DataRanges& ranges, Bool isInclude,
223  const IncludeLimits& includeLimits, uInt64 maxCount
224  ) const;
225 
226  virtual void _populateArrays(
227  std::vector<DataArray>& arys, uInt64& currentCount,
228  const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
229  const MaskIterator& maskBegin, uInt maskStride,
230  const IncludeLimits& includeLimits, uInt64 maxCount
231  ) const;
232 
233  // mask and ranges
234  virtual void _populateArrays(
235  std::vector<DataArray>& arys, uInt64& currentCount,
236  const DataIterator& dataBegin, uInt64 nr, uInt dataStride,
237  const MaskIterator& maskBegin, uInt maskStride,
238  const DataRanges& ranges, Bool isInclude,
239  const IncludeLimits& includeLimits, uInt64 maxCount
240  ) const;
241 
242  // weights
243  virtual void _populateArrays(
244  std::vector<DataArray>& arys, uInt64& currentCount,
245  const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
246  uInt64 nr, uInt dataStride, const IncludeLimits& includeLimits,
247  uInt64 maxCount
248  ) const;
249 
250  // weights and ranges
251  virtual void _populateArrays(
252  std::vector<DataArray>& arys, uInt64& currentCount,
253  const DataIterator& dataBegin, const WeightsIterator& weightsBegin,
254  uInt64 nr, uInt dataStride, const DataRanges& ranges, Bool isInclude,
255  const IncludeLimits& includeLimits, uInt64 maxCount
256  ) const;
257 
258  // weights and mask
259  virtual void _populateArrays(
260  std::vector<DataArray>& arys, uInt64& currentCount,
261  const DataIterator& dataBegin, const WeightsIterator& weightBegin,
262  uInt64 nr, uInt dataStride, const MaskIterator& maskBegin,
263  uInt maskStride, const IncludeLimits& includeLimits, uInt64 maxCount
264  ) const;
265 
266  // weights, mask, ranges
267  virtual void _populateArrays(
268  std::vector<DataArray>& arys, uInt64& currentCount,
269  const DataIterator& dataBegin, const WeightsIterator& weightBegin,
270  uInt64 nr, uInt dataStride, const MaskIterator& maskBegin,
271  uInt maskStride, const DataRanges& ranges, Bool isInclude,
272  const IncludeLimits& includeLimits, uInt64 maxCount
273  ) const;
274  // </group>
275 
276  // <group>
277  // no weights, no mask, no ranges
278  virtual Bool _populateTestArray(
279  DataArray& ary, const DataIterator& dataBegin,
280  uInt64 nr, uInt dataStride, uInt maxElements
281  ) const;
282 
283  // ranges
284  virtual Bool _populateTestArray(
285  DataArray& ary, const DataIterator& dataBegin, uInt64 nr,
286  uInt dataStride, const DataRanges& ranges, Bool isInclude,
287  uInt maxElements
288  ) const;
289 
290  // mask
291  virtual Bool _populateTestArray(
292  DataArray& ary, const DataIterator& dataBegin, uInt64 nr,
293  uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
294  uInt maxElements
295  ) const;
296 
297  // mask and ranges
298  virtual Bool _populateTestArray(
299  DataArray& ary, const DataIterator& dataBegin, uInt64 nr,
300  uInt dataStride, const MaskIterator& maskBegin, uInt maskStride,
301  const DataRanges& ranges, Bool isInclude, uInt maxElements
302  ) const;
303 
304  // weights
305  virtual Bool _populateTestArray(
306  DataArray& ary, const DataIterator& dataBegin,
307  const WeightsIterator& weightBegin, uInt64 nr, uInt dataStride,
308  uInt maxElements
309  ) const;
310 
311  // weights and ranges
312  virtual Bool _populateTestArray(
313  DataArray& ary, const DataIterator& dataBegin,
314  const WeightsIterator& weightsBegin, uInt64 nr, uInt dataStride,
315  const DataRanges& ranges, Bool isInclude, uInt maxElements
316  ) const;
317 
318  // weights and mask
319  virtual Bool _populateTestArray(
320  DataArray& ary, const DataIterator& dataBegin,
321  const WeightsIterator& weightBegin, uInt64 nr, uInt dataStride,
322  const MaskIterator& maskBegin, uInt maskStride, uInt maxElements
323  ) const;
324 
325  // weights, mask, ranges
326  virtual Bool _populateTestArray(
327  DataArray& ary, const DataIterator& dataBegin,
328  const WeightsIterator& weightBegin, uInt64 nr, uInt dataStride,
329  const MaskIterator& maskBegin, uInt maskStride,
330  const DataRanges& ranges, Bool isInclude, uInt maxElements
331  ) const;
332  // </group>
333 
334 private:
335 
337 
338 };
339 
340 }
341 
342 #ifndef CASACORE_NO_AUTO_TEMPLATES
343 #include <casacore/scimath/StatsFramework/HingesFencesQuantileComputer.tcc>
344 #endif
345 
346 #endif
Basic concrete QuantileComputer class for data constrained to be in a specified range.
Represents an unfilled histogram with equal width bins for binning used for quantile computations...
unsigned long long uInt64
Definition: aipsxtype.h:39
virtual StatisticsAlgorithmQuantileComputer< CASA_STATP > * clone() const
clone this object by returning a pointer to a copy
virtual void _populateArrays(std::vector< DataArray > &arys, uInt64 &currentCount, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const IncludeLimits &includeLimits, uInt64 maxCount) const
no weights, no mask, no ranges
#define DataArray
Commonly used types in statistics framework.
virtual void _populateArray(DataArray &ary, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
populate an unsorted array with valid data.
virtual Bool _populateTestArray(DataArray &ary, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, uInt maxElements) const
no weights, no mask, no ranges
HingesFencesQuantileComputer & operator=(const HingesFencesQuantileComputer &other)
copy semantics
#define DataRanges
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool False
Definition: aipstype.h:44
#define IncludeLimits
QuantileComputer used by HingesFencesStatistics for computing quantile-like statistics.
virtual void _findBins(std::vector< BinCountArray > &binCounts, std::vector< CountedPtr< AccumType >> &sameVal, std::vector< Bool > &allSame, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const std::vector< StatsHistogram< AccumType >> &binDesc, const std::vector< AccumType > &maxLimit) const
unsigned int uInt
Definition: aipstype.h:51
virtual void reset()
reset private fields