casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StatisticsAlgorithmQuantileComputer.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_STATSALGORITHMQUANTILECOMPUTER_H
27 #define SCIMATH_STATSALGORITHMQUANTILECOMPUTER_H
28 
30 
31 #include <casacore/casa/aips.h>
32 
33 namespace casacore {
34 
35 // This is the virtual base class from which concrete QuantileComputer classes
36 // are derived. The API developer should never explicitly instantiate a
37 // QuantileComputer class; they are used internally by other StatsFramework
38 // classes. See the documentation of StatisticsAlgorithm for more details.
39 
40 template <
41  class AccumType, class DataIterator, class MaskIterator=const Bool *,
42  class WeightsIterator=DataIterator
43 >
45 
46 public:
47 
49 
51 
52  // clone this object by returning a pointer to a copy
54 
55  // delete any (partially) sorted array
56  void deleteSortedArray();
57 
58  // reset this object by clearing data.
59  virtual void reset();
60 
61  // This must be called upon the copy or assignment of the
62  // associated statistics algorithm object. Otherwise, there is generally
63  // no reason to call it.
65 
66  // FIXME make protected once refactor is complete
67  std::vector<AccumType>& _getSortedArray() { return _sortedArray; }
68 
69  // FIXME make protected once refactor is complete
70  void _setSortedArray(const std::vector<AccumType>& v) { _sortedArray = v; }
71 
73 
74 protected:
75 
76  // ds should be the dataset object held in the StatisticsAlgorithm object.
77  // The QuantileComputer calculator object should never hold its own version
78  // of a dataset object. The algorithm object (caller of this method) is
79  // always responsible for deleting the passed object, usually upon its
80  // destruction.
82 
83  // use copy semantics. statistics algorithm object's responsibility to set
84  // the _dataset object in the new QuantileComputer calculator object upon a
85  // copy. The underlying _dataset object in the new stats calculator object
86  // should be a reference to the new _dataset object in the copied statistics
87  // algorithm object.
90  );
91 
92  // use copy semantics. The _dataset object is not copied. It is the
93  // associated statistics algorithm object's responsibility to set the
94  // _dataset object in the new QuantileComputer calculator object upon an
95  // assignment. The underlying _dataset object in the new stats calculator
96  // object should be a reference to that in the newly assigned statistics
97  // algorithm object.
100  );
101 
103 
105 
107  return _medAbsDevMed;
108  }
109 
111  _medAbsDevMed = medAbsDevMed;
112  }
113 
114 private:
115  std::vector<AccumType> _sortedArray{};
116  // This pointer references the (non-pointer) object
117  // in the associated non-QuantileComputer computer object,
118  // so this should not be wrapped in a smart pointer.
121 
122 };
123 
124 }
125 
126 #ifndef CASACORE_NO_AUTO_TEMPLATES
127 #include <casacore/scimath/StatsFramework/StatisticsAlgorithmQuantileComputer.tcc>
128 #endif
129 
130 #endif
void _setMedianAbsDevMedian(CountedPtr< AccumType > medAbsDevMed)
LatticeExprNode median(const LatticeExprNode &expr)
virtual StatisticsAlgorithmQuantileComputer< CASA_STATP > * clone() const =0
clone this object by returning a pointer to a copy
This is the virtual base class from which concrete QuantileComputer classes are derived.
void deleteSortedArray()
delete any (partially) sorted array
StatisticsDataset< CASA_STATP > * _dataset
This pointer references the (non-pointer) object in the associated non-QuantileComputer computer obje...
void _setSortedArray(const std::vector< AccumType > &v)
FIXME make protected once refactor is complete.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void setDataset(StatisticsDataset< CASA_STATP > *ds)
This must be called upon the copy or assignment of the associated statistics algorithm object...
virtual void reset()
reset this object by clearing data.
std::vector< AccumType > & _getSortedArray()
FIXME make protected once refactor is complete.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42
StatisticsAlgorithmQuantileComputer & operator=(const StatisticsAlgorithmQuantileComputer &other)
use copy semantics.