50 return double(
fire( mean ));
59 static const double cof[6] = {76.18009172947146,-86.50532032941677,
60 24.01409824083091, -1.231739572450155,
61 0.1208650973866179e-2, -0.5395239384953e-5};
65 tmp -= (x + 0.5) * std::log(tmp);
66 double ser = 1.000000000190015;
68 for ( j = 0; j <= 5; j++ ) {
72 return -tmp + std::log(2.5066282746310005*ser);
81 v1 = 2.0 * eptr->
flat() - 1.0;
82 v2 = 2.0 * eptr->
flat() - 1.0;
86 fac = std::sqrt(-2.0*std::log(r)/r);
107 if( xm == -1 )
return 0;
117 t *= anEngine->
flat();
123 sq = std::sqrt(2.0*xm);
125 g1 = xm*alxm -
gammln(xm + 1.0);
133 t = 0.9*(1.0 + y*
y)* std::exp(em*alxm -
gammln(em + 1.0) - g1);
134 }
while( anEngine->
flat() >
t );
137 em = xm + std::sqrt(xm) *
normal (anEngine);
138 if ( static_cast<long>(em) < 0 )
139 em =
static_cast<long>(xm) >= 0 ? xm :
getMaxMean();
147 for(
long*
v = vect;
v != vect + size; ++
v )
167 if( xm == -1 )
return 0;
177 t *= anEngine->
flat();
183 sq = std::sqrt(2.0*xm);
185 g1 = xm*alxm -
gammln(xm + 1.0);
193 t = 0.9*(1.0 + y*
y)* std::exp(em*alxm -
gammln(em + 1.0) - g1);
194 }
while( anEngine->
flat() >
t );
197 em = xm + std::sqrt(xm) *
normal (anEngine);
198 if ( static_cast<long>(em) < 0 )
199 em =
static_cast<long>(xm) >= 0 ? xm :
getMaxMean();
206 long* vect,
double m1)
208 for(
long*
v = vect;
v != vect + size; ++
v )
230 if( xm == -1 )
return 0;
246 sq = std::sqrt(2.0*xm);
248 g1 = xm*alxm -
gammln(xm + 1.0);
256 t = 0.9*(1.0 + y*
y)* std::exp(em*alxm -
gammln(em + 1.0) - g1);
261 if ( static_cast<long>(em) < 0 )
262 em = static_cast<long>(xm) >= 0 ? xm :
getMaxMean();
270 for(
long*
v = vect;
v != vect + size; ++
v )
276 for(
long*
v = vect;
v != vect + size; ++
v )
281 int pr=os.precision(20);
282 std::vector<unsigned long>
t(2);
283 os <<
" " <<
name() <<
"\n";
284 os <<
"Uvec" <<
"\n";
286 os <<
meanMax <<
" " << t[0] <<
" " << t[1] <<
"\n";
288 os <<
defaultMean <<
" " << t[0] <<
" " << t[1] <<
"\n";
290 os <<
status[0] <<
" " << t[0] <<
" " << t[1] <<
"\n";
292 os <<
status[1] <<
" " << t[0] <<
" " << t[1] <<
"\n";
294 os <<
status[2] <<
" " << t[0] <<
" " << t[1] <<
"\n";
296 os <<
oldm <<
" " << t[0] <<
" " << t[1] <<
"\n";
304 if (inName !=
name()) {
305 is.clear(std::ios::badbit | is.rdstate());
306 std::cerr <<
"Mismatch when expecting to read state of a "
307 <<
name() <<
" distribution\n"
308 <<
"Name found was " << inName
309 <<
"\nistream is left in the badbit state\n";
313 std::vector<unsigned long>
t(2);