16 #ifndef __OMNETPP_CHISTOGRAM_H 17 #define __OMNETPP_CHISTOGRAM_H 20 #include "cabstracthistogram.h" 24 class cIHistogramStrategy;
25 class cAutoRangeHistogramStrategy;
95 enum Mode {MODE_AUTO, MODE_INTEGERS, MODE_REALS, MODE_DOUBLES = MODE_REALS};
96 _OPPDEPRECATED
typedef Mode HistogramMode;
101 std::vector<double> binEdges;
102 std::vector<double> binValues;
103 double finiteUnderflowSumWeights = 0, finiteOverflowSumWeights = 0;
104 double posInfSumWeights = 0, negInfSumWeights = 0;
109 virtual void collectIntoHistogram(
double value,
double weight=1);
126 explicit cHistogram(
const char *name=
nullptr,
bool weighted=
false);
132 explicit cHistogram(
const char *name,
int numBinsHint,
bool weighted=
false);
171 virtual void parsimPack(
cCommBuffer *buffer)
const override;
178 virtual void parsimUnpack(
cCommBuffer *buffer)
override;
188 virtual void collect(
double value)
override;
197 virtual void collectWeighted(
double value,
double weight)
override;
203 virtual void clear()
override;
208 virtual void saveToFile(FILE *f)
const override;
213 virtual void loadFromFile(FILE *f)
override;
218 virtual void merge(
const cStatistic *other)
override;
239 virtual bool binsAlreadySetUp()
const override;
246 virtual void setUpBins()
override;
253 virtual void setBinEdges(
const std::vector<double>& edges);
261 virtual void createUniformBins(
double lo,
double hi,
double step);
269 virtual void prependBins(
const std::vector<double>& edges);
277 virtual void appendBins(
const std::vector<double>& edges);
288 virtual void extendBinsTo(
double value,
double step,
int maxNumBins=INT_MAX);
296 virtual void mergeBins(
int groupSize);
313 virtual int getNumBins()
const override {
return binValues.size();}
318 virtual double getBinEdge(
int k)
const override {
return binEdges.at(k);}
324 virtual double getBinValue(
int k)
const override {
return binValues.at(k);}
341 virtual int64_t getNumUnderflows()
const override;
348 virtual int64_t getNumOverflows()
const override;
355 virtual int64_t getNumNegInfs()
const override;
362 virtual int64_t getNumPosInfs()
const override;
383 virtual void setMode(
Mode mode);
391 virtual void setRange(
double lower,
double upper);
398 virtual void setNumPrecollectedValues(
int numPrecollect);
406 virtual void setRangeExtensionFactor(
double rangeExtensionFactor);
415 virtual void setAutoExtend(
bool autoExtend);
422 virtual void setNumBinsHint(
int numCells);
429 virtual void setBinSizeHint(
double d);
435 _OPPDEPRECATED
virtual void setRangeAuto(
int numPrecollect=100,
double rangeExtensionFactor=2.0);
441 _OPPDEPRECATED
virtual void setRangeAutoLower(
double upper,
int numPrecollect=100,
double rangeExtensionFactor=2.0);
447 _OPPDEPRECATED
virtual void setRangeAutoUpper(
double lower,
int numPrecollect=100,
double rangeExtensionFactor=2.0);
452 _OPPDEPRECATED
virtual void setNumCells(
int numCells)
final {setNumBinsHint(numCells);}
457 _OPPDEPRECATED
virtual void setCellSize(
double d)
final {setBinSizeHint(d);}
Interface and base class for histogram-like density estimation classes.
Definition: cabstracthistogram.h:26
virtual double getOverflowSumWeights() const override
Definition: chistogram.h:334
virtual void collect(double value) override
virtual double getBinValue(int k) const override
Definition: chistogram.h:324
cHistogram(const cHistogram &other)
Definition: chistogram.h:143
virtual cHistogram * dup() const override
Definition: chistogram.h:164
virtual double getPosInfSumWeights() const override
Definition: chistogram.h:372
virtual double getNegInfSumWeights() const override
Definition: chistogram.h:367
virtual int getNumBins() const override
Definition: chistogram.h:313
Buffer for the communications layer of parallel simulation.
Definition: ccommbuffer.h:41
cIHistogramStrategy * getStrategy() const
Definition: chistogram.h:233
Generic histogram class, capable of representing both unweighted and weighted distributions. Histogram data are stored as n+1 bin edges and n bin values, both being double-precision floating point values. Upper and lower outliers (as well as positive and negative infinities) are kept as counts (for unweighted statistics) or as sum of weights (for weighted statistics).
Definition: chistogram.h:88
Interface for histogram strategy classes. Histogram strategies encapsulate the task of setting up and...
Definition: chistogramstrategy.h:29
virtual void collectWeighted(double value, double weight) override
virtual _OPPDEPRECATED void setCellSize(double d) final
Definition: chistogram.h:457
Definition: cabstracthistogram.h:21
virtual double getUnderflowSumWeights() const override
Definition: chistogram.h:329
virtual _OPPDEPRECATED void setNumCells(int numCells) final
Definition: chistogram.h:452
Mode
Definition: chistogram.h:95
A generic, very configurable histogram strategy that is meant to provide a good quality histogram for...
Definition: chistogramstrategy.h:304
virtual double getBinEdge(int k) const override
Definition: chistogram.h:318
const std::vector< double > & getBinEdges() const
Definition: chistogram.h:302
const std::vector< double > & getBinValues() const
Definition: chistogram.h:308
cStatistic is an abstract class for computing statistical properties of a random variable.
Definition: cstatistic.h:34