File: GenGen.h
template <typename Rnd, typename FncPtr>
CLASS
GenGen
Public members:
typedef Rnd RndType;
typedef RandomTraits<RndType> RndTraits;
typedef FncPtr FncPtrType;
typedef GenCell::DimType DimType;
typedef GenCell::DVector DVector;
typedef std::vector<GenCell*> CellVector;
typedef std::vector<FncPtrType> FncVector;
typedef std::vector<DimType> DimVector;
typedef DimVector::size_type size_type;
inline GenGen(Rnd & r, long newMaxN, bool setWeighted = false);
inline void addFunction(DimType dim, FncPtrType f);
inline void eps(double newEps);
inline void margin(double newMargin);
inline FncPtrType generate();
inline double integral() const;
inline double cutIntegral() const;
inline double efficiency() const;
inline double effnc() const;
inline double volume() const;
inline int depth() const;
inline int nBins() const;
inline long maxN() const;
inline long N() const;
inline long n() const;
inline long nLeft() const;
inline long nFnc() const;
inline size_type nTry() const;
inline double maxInt() const;
inline double doMaxInt();
inline double eps() const;
inline double margin() const;
inline double rnd() const;
inline double rnd(double lo, double up) const;
inline void rnd(const DVector & lo, const DVector & up, DVector & r)const;
inline void rnd(DimType D, DVector & r)const;
inline long rndInt(long x) const;
inline const FncVector & functions() const;
inline FncPtrType function(size_type i) const;
inline FncPtrType lastFunction() const;
inline const DimVector & dimensions() const;
inline DimType dimension(size_type i) const;
inline DimType lastDimension() const;
inline const CellVector & cells() const;
inline GenCell * cell(size_type i) const;
inline GenCell * lastPrimary() const;
inline const DVector & sumMaxInts() const;
inline size_type size() const;
inline size_type last() const;
inline GenCell * lastCell() const;
inline const DVector & lastPoint() const;
inline double lastF() const;
inline bool compensating();
template <typename OStream>
inline void printDivisions(OStream & os) const;
template <typename OStream>
inline void printHist(OStream & os) const;
Protected members:
inline void chooseCell(DVector & lo, DVector & up);
inline void compensate(const DVector & lo, const DVector & up);
Private members:
RndType * theRnd;
The random number generator to be used for this Generator.
long theMaxN;
The requested number of accepted points (weight > 0);
long theNAcc;
The number of accepted points (weight > 0) so far.
long theN;
The number of attempted points so far.
long theNFnc;
The number of calls to the function.
double theEps;
The smalles possible division allowed.
double theMargin;
The factor controlling the loss of efficiency when compensating.
size_type theNTry;
The number of points to use to find initial average.
FncVector theFunctions;
DimVector theDimensions;
CellVector thePrimaryCells;
DVector theSumMaxInts;
The bins representing each function to be sampled and the
accumulated max integrals.
size_type theLast;
The last index chosen
GenCell * theLastCell;
The last cell chosen.
DVector theLastPoint;
The last point generated.
double theLastF;
The function value of the last point.
struct Level {
long lastN;
The number of attempts at which point this level disapprears.
double g;
The previous max value in the Cell to compensate.
GenCell * cell;
The cell which is being compensated.
size_type index;
The index corresponding to the cell being compensated.
DVector up;
DVector lo;
The integration limits for the cell being compensated.
long N0;
double i0;
double i1;
LevelVector levels;
The vector (stack) of levels
STRUCT
OldSlicer
Public members:
OldSlicer(DimType, GenGen &, const DVector &, const DVector &);
void init();
void slice();
double shiftmaxmin();
void dohalf(DimType);
DimType D;
DVector lo;
DVector up;
DVector fhalf;
DVector xhalf;
DVector xsel;
double fsel;
GenCell * current;
GenCell * first;
DVector firstlo;
DVector firstup;
FncPtr f;
double margin;
DVector xcut;
std::multimap<double,DimType> rateslice;
double minf;
STRUCT
Slicer
Public members:
Slicer(DimType, GenGen &, const DVector &, const DVector &);
void init();
void slice();
double shiftmaxmin();
void dohalf(DimType);
DimType D;
DVector lo;
DVector up;
DVector xcl;
DVector xcu;
DVector xhl;
DVector xhu;
DVector fhl;
DVector fhu;
DVector xsel;
double fsel;
GenCell * current;
GenCell * first;
DVector firstlo;
DVector firstup;
FncPtr f;
double epsilon;
double margin;
DVector xcut;
std::multimap<double,DimType> rateslice;
double minf;
Public members:
static size_type maxsize;
TYPE DEFINITIONS
std::vector<Level> LevelVector;
DEFINED MACROS
INCLUDED FILES
GenCell.h
vector
map
limits
RandomTraits.h
GenGen.icc