Index: trunk/npstat/stat/SeriesCGF1D.hh =================================================================== --- trunk/npstat/stat/SeriesCGF1D.hh (revision 756) +++ trunk/npstat/stat/SeriesCGF1D.hh (revision 757) @@ -1,78 +1,81 @@ #ifndef NPSTAT_SERIESCGF1D_HH_ #define NPSTAT_SERIESCGF1D_HH_ /*! // \file SeriesCGF1D.hh // // \brief Univariate cumulant generating function defined by cumulants // // Author: I. Volobouev // // December 2019 */ #include #include "npstat/stat/AbsCGF1D.hh" namespace npstat { class SeriesCGF1D : public AbsCGF1D { public: /** // At least the first two cumulants (mean and variance) // must be provided in the "cumulants" array. // cumulants[0] must contain the mean, cumulants[1] the // variance, etc. "nCumulants" specifies the length of // the array (and also the highest cumulant order). // The variance must be positive (i.e., the degenerate // distribution of a single point mass is excluded from // consideration). The parameters "smin" and "smax" // should be chosen in such a way that the CGF remains // convex on the (smin, smax) interval. */ SeriesCGF1D(const double* cumulants, unsigned nCumulants, double smin, double smax); inline virtual SeriesCGF1D* clone() const {return new SeriesCGF1D(*this);} inline virtual ~SeriesCGF1D() {} virtual SeriesCGF1D* shiftAndScale(double mu, double sigma) const; inline virtual double smin() const {return smin_;} inline virtual double smax() const {return smax_;} virtual double derivative(unsigned order, double s) const; void setCumulant(unsigned order, double value); inline unsigned maxOrder() const {return cumulants_.size();} + inline const std::vector& allCumulants() const + {return cumulants_;} + /** // Check whether the CGF is convex on the interval (a, b]. // This method ignores smin and smax. */ bool isConvex(double a, double b) const; /** // Convexify this CFG on the given interval by adding the // smallest possible higher order cumulant of the lowest // even order not specified for this CGF. */ SeriesCGF1D convexify(double a, double b) const; protected: virtual bool isEqual(const AbsCGF1D& r) const; private: void truncateLeadingZeros(); std::vector cumulants_; double smin_; double smax_; }; } #endif // NPSTAT_SERIESCGF1D_HH_