35 if ( ( sign>0.0f && num<0.0f ) || ( sign<0.0f && num>0.0f ) )
98 static double q1 = 4.166669E-2;
99 static double q2 = 2.083148E-2;
100 static double q3 = 8.01191E-3;
101 static double q4 = 1.44121E-3;
102 static double q5 = -7.388E-5;
103 static double q6 = 2.4511E-4;
104 static double q7 = 2.424E-4;
105 static double a1 = 0.3333333;
106 static double a2 = -0.250003;
107 static double a3 = 0.2000062;
108 static double a4 = -0.1662921;
109 static double a5 = 0.1423657;
110 static double a6 = -0.1367177;
111 static double a7 = 0.1233795;
112 static double e1 = 1.0;
113 static double e2 = 0.4999897;
114 static double e3 = 0.166829;
115 static double e4 = 4.07753E-2;
116 static double e5 = 1.0293E-2;
117 static double aa = 0.0;
118 static double aaa = 0.0;
119 static double sqrt32 = 5.656854;
121 static double sgamma,s2,s,d,t,
x,u,r,q0,b,b0,si,c,v,q,e,
w,p;
122 if(a == aa)
goto S10;
123 if(a < 1.0)
goto S120;
147 if(d*u <= t*t*t)
return sgamma;
151 if(a == aaa)
goto S40;
154 q0 = ((((((q7*r+q6)*r+q5)*r+q4)*r+q3)*r+q2)*r+q1)*r;
160 if(a <= 3.686)
goto S30;
161 if(a <= 13.022)
goto S20;
181 b = 0.463+s+0.178*s2;
183 c = 0.195/s-7.9E-2+1.6E-1*s;
188 if(x <= 0.0)
goto S70;
193 if(
fabs(v) <= 0.25)
goto S50;
194 q = q0-s*t+0.25*t*t+(s2+s2)*
log(1.0+v);
197 q = q0+0.5*t*t*((((((a7*v+a6)*v+a5)*v+a4)*v+a3)*v+a2)*v+a1)*v;
202 if(
log(1.0-u) <= q)
return sgamma;
217 if(t < -0.7187449)
goto S70;
222 if(
fabs(v) <= 0.25)
goto S80;
223 q = q0-s*t+0.25*t*t+(s2+s2)*
log(1.0+v);
226 q = q0+0.5*t*t*((((((a7*v+a6)*v+a5)*v+a4)*v+a3)*v+a2)*v+a1)*v;
231 if(q <= 0.0)
goto S70;
232 if(q <= 0.5)
goto S100;
236 if(q < 15.0)
goto S95;
243 if((q+e-0.5*t*t) > 87.49823)
goto S115;
244 if(c*
fabs(u) >
exp(q+e-0.5*t*t))
goto S70;
250 w = ((((e5*q+e4)*q+e3)*q+e2)*q+e1)*q;
255 if(c*
fabs(u) > w*
exp(e-0.5*t*t))
goto S70;
274 b0 = 1.0+0.3678794*a;
278 if(p >= 1.0)
goto S140;
280 if(
expdev(rng) < sgamma)
goto S130;
283 sgamma = -
log((b0-p)/ a);
284 if(
expdev(rng) < (1.0-a)*
log(sgamma))
goto S130;
295 double fac,rsq,v1,v2;
302 }
while (rsq >= 1.0 || rsq == 0.0);
static double fsign(double num, double sign)
Transfers sign of argument sign to argument num.
df1_two_variable fabs(const df1_two_variable &x)
double better_rand()
Random number generator.
double expdev(const random_number_generator &_rng)
Description not yet available.
Description not yet available.
d3_array sqrt(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
double sgamma(double a, const random_number_generator &_rng)
Description not yet available.
d3_array exp(const d3_array &arr3)
Returns d3_array results with computed exp from elements in arr3.
double gasdev(const random_number_generator &_rng)
Description not yet available.
double sign(const double x)
The sign of a number.
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.