8 double xmin,
double xmax,
int n,
int iter ) :
9 xmin(xmin), xmax(xmax), n(n), iter(iter)
22 std::vector<double>
a,
y,
z,xnew;
33 for (
int i=1;
i<
n; ++
i)
37 for (
int it=0; it<
iter; ++it) {
40 for (
int i=0;
i<
n; ++
i )
44 for (
int i=0; i<
m; ++
i )
49 for (
int i=1; i<
n; ++
i )
50 y[i] = y[i-1] + a[i-1];
55 for (
int i=1; i<
n; ++
i )
63 for (
int i=1; i<
m; ++
i ) {
64 while ( y[k+1] < z[i] ) ++
k;
65 double r = (z[
i]-y[
k]) / (y[k+1]-y[k]);
69 for (
int i=0; i<
n; ++
i )
104 double u= (umax-umin) * random->
flatShoot() + umin;
120 double umin = a*sampling[
i]*sampling[
i]/2. + b*sampling[
i];
121 double umax = a*sampling[i+1]*sampling[i+1]/2. + b*sampling[i+1];
122 double u= (umax-umin) * random->
flatShoot() + umin;
130 if(x1<xmin||x2>
xmax)
return false;
139 for(;ibin<(unsigned)n&&x1>
sampling[ibin];++ibin);
141 for(;ibin<(unsigned)n&&x2>sampling[ibin];++ibin);
147 rmin = ibin1+(x1-sampling[ibin1])/(sampling[ibin1]-sampling[ibin1-1]);
148 deltar= ibin2+(x2-sampling[ibin2])/(sampling[ibin2]-sampling[ibin2-1]) -
rmin;
double generate(RandomEngineAndDistribution const *) const
The random generation according to function()
double flatShoot(double xmin=0.0, double xmax=1.0) const
double generateLin(RandomEngineAndDistribution const *) const
BaseNumericalRandomGenerator(double xmin=0., double xmax=1., int n=1000, int iter=6)
void initialize()
The initialization (numerical integarion, inversion)
double generateExp(RandomEngineAndDistribution const *) const
std::vector< double > sampling
std::vector< std::vector< double > > tmp
bool setSubInterval(double x1, double x2)
To shoot in a given interval.