cpsquare.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __CPSQUARE_H
00023 #define __CPSQUARE_H
00024
00025 #include "cdensityestbase.h"
00026
00027 NAMESPACE_BEGIN
00028
00029
00036 class SIM_API cPSquare : public cDensityEstBase
00037 {
00038 protected:
00039 int numcells;
00040 long numobs;
00041 int *n;
00042 double *q;
00043
00044 protected:
00045 void copy(const cPSquare& other);
00046
00047 protected:
00048
00049 virtual void doMergeCellValues(const cDensityEstBase *other);
00050
00051 public:
00054
00058 cPSquare(const cPSquare& r);
00059
00063 explicit cPSquare(const char *name=NULL, int cells=10);
00064
00068 virtual ~cPSquare();
00069
00073 cPSquare& operator=(const cPSquare& res);
00075
00078
00083 virtual cPSquare *dup() const {return new cPSquare(*this);}
00084
00089 virtual std::string detailedInfo() const;
00090
00096 virtual void parsimPack(cCommBuffer *buffer);
00097
00103 virtual void parsimUnpack(cCommBuffer *buffer);
00105
00106 private:
00107
00108 void giveError();
00109
00110 protected:
00115 virtual void collectTransformed(double val);
00116
00117 public:
00120
00124 virtual void transform() {}
00125
00130 virtual void setRange(double,double) {giveError();}
00131
00136 virtual void setRangeAuto(int,double) {giveError();}
00137
00142 virtual void setRangeAutoLower(double,int,double) {giveError();}
00143
00148 virtual void setRangeAutoUpper(double,int,double) {giveError();}
00149
00154 virtual void setNumFirstVals(int) {giveError();}
00155
00159 virtual int getNumCells() const;
00160
00166 virtual double getBasepoint(int k) const;
00167
00171 virtual double getCellValue(int k) const;
00172
00176 virtual double getCDF(double x) const;
00177
00181 virtual double getPDF(double x) const;
00182
00186 virtual double random() const;
00187
00191 virtual void merge(const cStatistic *other);
00192
00196 virtual void saveToFile(FILE *) const;
00197
00201 virtual void loadFromFile(FILE *);
00203 };
00204
00205 NAMESPACE_END
00206
00207
00208 #endif
00209