casacore
Loading...
Searching...
No Matches
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: casa-feedback@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
29#include <casacore/scimath/StatsFramework/StatisticsTypes.h>
30
31#include <casacore/casa/aips.h>
32
33namespace 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
40template <
41 class AccumType, class DataIterator, class MaskIterator=const Bool *,
42 class WeightsIterator=DataIterator
43>
45
46public:
47
49
51
52 // clone this object by returning a pointer to a copy
54
55 // delete any (partially) sorted array
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
72 void setMedian(std::shared_ptr<AccumType> median) { _median = std::move(median); }
73
74protected:
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
104 std::shared_ptr<AccumType> _getMedian() const { return _median; }
105
106 std::shared_ptr<AccumType> _getMedianAbsDevMedian() const {
107 return _medAbsDevMed;
108 }
109
110 void _setMedianAbsDevMedian(std::shared_ptr<AccumType> medAbsDevMed) {
111 _medAbsDevMed = std::move(medAbsDevMed);
112 }
113
114private:
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.
120 std::shared_ptr<AccumType> _median{}, _medAbsDevMed{};
121
122};
123
124}
125
126#ifndef CASACORE_NO_AUTO_TEMPLATES
127#include <casacore/scimath/StatsFramework/StatisticsAlgorithmQuantileComputer.tcc>
128#endif
129
130#endif
This is the virtual base class from which concrete QuantileComputer classes are derived.
void _setSortedArray(const std::vector< AccumType > &v)
FIXME make protected once refactor is complete.
virtual StatisticsAlgorithmQuantileComputer< CASA_STATP > * clone() const =0
clone this object by returning a pointer to a copy
StatisticsAlgorithmQuantileComputer(StatisticsDataset< CASA_STATP > *ds)
ds should be the dataset object held in the StatisticsAlgorithm object.
StatisticsAlgorithmQuantileComputer & operator=(const StatisticsAlgorithmQuantileComputer &other)
use copy semantics.
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.
StatisticsDataset< CASA_STATP > * _dataset
This pointer references the (non-pointer) object in the associated non-QuantileComputer computer obje...
std::vector< AccumType > & _getSortedArray()
FIXME make protected once refactor is complete.
void deleteSortedArray()
delete any (partially) sorted array
void _setMedianAbsDevMedian(std::shared_ptr< AccumType > medAbsDevMed)
StatisticsAlgorithmQuantileComputer(const StatisticsAlgorithmQuantileComputer &other)
use copy semantics.
Representation of a statistics dataset used in statistics framework calculatations.
this file contains all the compiler specific defines
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
LatticeExprNode median(const LatticeExprNode &expr)