19 #ifndef __OMNETPP_CKSPLIT_H 20 #define __OMNETPP_CKSPLIT_H 22 #include "cprecolldensityest.h" 74 typedef double (*DivFunc)(
const cKSplit&, cKSplit::Grid&, double,
double *);
95 Iterator(
const cKSplit& ksplit,
bool atbeginning=
true);
100 void init(
const cKSplit& ksplit,
bool atbeginning=
true);
105 void operator++(
int);
110 void operator--(
int);
115 bool end()
const {
return grid==0;}
130 double getCellMax()
const {
return gridmin+(cell+1)*cellsize;}
141 double getCellValue()
const;
151 int rootGridIndex, lastGridIndex;
152 bool rangeExtEnabled;
161 mutable long iterNumValues;
164 void copy(
const cKSplit& other);
168 void resetGrids(
int grid);
171 void createRootGrid();
174 void newRootGrids(
double value,
double weight);
177 void insertIntoGrids(
double value,
double weight,
int enableSplits);
180 void splitCell(
int grid,
int cell);
183 void distributeMotherObservations(
int grid);
186 void expandGridVector();
189 void iteratorToCell(
int cell_nr)
const;
201 explicit cKSplit(
const char *name=
nullptr,
bool weighted=
false);
206 cKSplit(
const cKSplit& r);
216 cKSplit& operator=(
const cKSplit& res);
226 virtual cKSplit *
dup()
const override {
return new cKSplit (*
this);}
233 virtual void parsimPack(
cCommBuffer *buffer)
const override;
240 virtual void parsimUnpack(
cCommBuffer *buffer)
override;
248 virtual void collectIntoHistogram(
double val)
override;
253 virtual void collectWeightedIntoHistogram(
double value,
double weight)
override;
262 virtual void setUpBins()
override;
267 virtual int getNumBins()
const override;
272 virtual double getBinEdge(
int k)
const override;
277 virtual double getBinValue(
int k)
const override;
282 virtual void merge(
const cStatistic *other)
override;
287 virtual void clear()
override;
292 virtual void saveToFile(FILE *)
const override;
297 virtual void loadFromFile(FILE *)
override;
307 void setCritFunc(CritFunc _critfunc,
double *_critdata);
313 void setDivFunc(DivFunc _divfunc,
double *_divdata);
323 void setRangeExtension(
bool enabled);
332 int getTreeDepth()
const;
337 int getTreeDepth(
Grid& grid)
const;
343 double getRealCellValue(
Grid& grid,
int cell)
const;
348 void printGrids()
const;
Grid & getRootGrid() const
Definition: cksplit.h:358
Supporting struct for cKSplit. Represents one grid in the k-split data structure. ...
Definition: cksplit.h:55
double mother
observations 'inherited' from mother cell
Definition: cksplit.h:60
double total
sum of cells & all subgrids (also includes 'mother')
Definition: cksplit.h:59
bool end() const
Definition: cksplit.h:115
double getCellMin() const
Definition: cksplit.h:125
int parent
index of parent grid
Definition: cksplit.h:57
virtual cKSplit * dup() const override
Definition: cksplit.h:226
Buffer for the communications layer of parallel simulation.
Definition: ccommbuffer.h:41
int getCellNumber() const
Definition: cksplit.h:120
int reldepth
depth = (reldepth - rootgrid's reldepth)
Definition: cksplit.h:58
double getCellMax() const
Definition: cksplit.h:130
Definition: cabstracthistogram.h:21
Walks along cells of the distribution stored in a cKSplit object.
Definition: cksplit.h:79
Base class for histogram-like density estimation classes.
Definition: cprecolldensityest.h:55
Grid & getGrid(int k) const
Definition: cksplit.h:353
Implements k-split, an adaptive histogram-like density estimation algorithm. During result collection...
Definition: cksplit.h:45
cStatistic is an abstract class for computing statistical properties of a random variable.
Definition: cstatistic.h:34
double getCellSize() const
Definition: cksplit.h:135