44 const double c0=2.515517;
45 const double c1=0.802853;
46 const double c2=0.010328;
47 const double d1=1.432788;
48 const double d2=0.189269;
49 const double d3=0.001308;
65 double u=(c2*tt+c1)*tt+c0;
66 double v=((d3*tt+d2)*tt+d1)*tt+1;
75 double dfv=-vinv*vinv*dfvinv;
77 dftt+=((3*d3*tt+2.0*d2)*tt+d1)*dfv;
79 dftt+=(2.0*c2*tt+c1)*dfu;
81 double dfx=-1.0/(tt*
value(x))*dftt;
90 cout <<
"can't happen" <<
endl;
103 double yy=1.-
value(x);
105 double u=((c2*tt+c1)*tt+c0);
106 double v=((d3*tt+d2)*tt+d1)*tt+1;
115 double dfv=-vinv*vinv*dfvinv;
117 dftt+=((3*d3*tt+2.0*d2)*tt+d1)*dfv;
119 dftt+=(2.0*c2*tt+c1)*dfu;
121 double dfy=-1.0/(tt*yy)*dftt;
154 const double b1=0.319381530;
155 const double b2=-0.356563782;
156 const double b3=1.781477937;
157 const double b4=-1.821255978;
158 const double b5=1.330274429;
159 const double p=.2316419;
163 dvariable y= ((((b5*u+b4)*u+b3)*u+b2)*u+b1)*u;
172 dvariable y= ((((b5*u+b4)*u+b3)*u+b2)*u+b1)*u;
193 const double b1=0.319381530;
194 const double b2=-0.356563782;
195 const double b3=1.781477937;
196 const double b4=-1.821255978;
197 const double b5=1.330274429;
198 const double b55=b5*5;
199 const double b44=b4*4;
200 const double b33=b3*3;
201 const double b22=b2*2;
202 const double p=.2316419;
206 double y= ((((b5*u+b4)*u+b3)*u+b2)*u+b1)*u;
207 double tmp1=-0.3989422804*
exp(-.5*x*x);
217 double dfx=-tmp1*x*dftmp1;
220 double dfu= ((((b55*u+b44)*u+b33)*u+b22)*u+b1)*dfy;
226 &(RETURN_PTR->
v->
x), &(_x.
v->
x), dfx);
232 double y= ((((b5*u+b4)*u+b3)*u+b2)*u+b1)*u;
233 double tmp1=0.3989422804*
exp(-.5*x*x);
241 double dfx=-tmp1*x*dftmp1;
244 double dfu= ((((b55*u+b44)*u+b33)*u+b22)*u+b1)*dfy;
247 double dfw=-u*u*p*dfu;
254 &(RETURN_PTR->
v->
x), &(_x.
v->
x),dfx);
268 for (
int i=mmin;i<=mmax;i++)
286 const double b1=0.319381530;
287 const double b2=-0.356563782;
288 const double b3=1.781477937;
289 const double b4=-1.821255978;
290 const double b5=1.330274429;
291 const double b55=b5*5;
292 const double b44=b4*4;
293 const double b33=b3*3;
294 const double b22=b2*2;
295 const double p=.2316419;
299 double y= ((((b5*u+b4)*u+b3)*u+b2)*u+b1)*u;
300 double tmp1=-0.3989422804*
exp(-.5*x*x);
301 double z1=1.0+tmp1*y;
302 double z=beta*(z1-0.5)+0.5;
309 double dftmp1=y*dfz1;
310 double dfy=tmp1*dfz1;
313 double dfx=-tmp1*x*dftmp1;
316 double dfu= ((((b55*u+b44)*u+b33)*u+b22)*u+b1)*dfy;
328 double y= ((((b5*u+b4)*u+b3)*u+b2)*u+b1)*u;
329 double tmp1=0.3989422804*
exp(-.5*x*x);
331 double z=beta*(z1-0.5)+0.5;
337 double dftmp1=y*dfz1;
338 double dfy=tmp1*dfz1;
341 double dfx=-tmp1*x*dftmp1;
344 double dfu= ((((b55*u+b44)*u+b33)*u+b22)*u+b1)*dfy;
347 double dfw=-u*u*p*dfu;
365 #if !defined(OPT_LIB)
368 cerr <<
"Error in dvariable inv_cumd_norm_logistic -- illegal p value = "
374 y+=( (1.0-p)*2.50662827*
exp(.5*y*y) +
Base class for dvariable.
dvariable old_cumd_norm(const prevariable &x)
Description not yet available.
double bounded_cumd_norm(const double x, double beta)
Description not yet available.
double inv_cumd_norm(const double &x)
Description not yet available.
void set_gradient_stack(void(*func)(void), double *dep_addr, double *ind_addr1=NULL, double mult1=0, double *ind_addr2=NULL, double mult2=0)
Description not yet available.
prnstream & endl(prnstream &)
d3_array sqrt(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
void RETURN_ARRAYS_INCREMENT()
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
d3_array exp(const d3_array &arr3)
Returns d3_array results with computed exp from elements in arr3.
void default_evaluation(void)
Description not yet available.
dvariable beta(const prevariable &a, const prevariable &b)
Beta density function.
static _THREAD gradient_structure * _instance
double_and_int * v
pointer to the data
double inv_cumd_norm_inner(double x)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
void RETURN_ARRAYS_DECREMENT()
double cumd_norm_logistic(double _x, double p)
Description not yet available.
double cumd_logistic(const double &x)
Description not yet available.
dvector value(const df1_one_vector &v)
static _THREAD grad_stack * GRAD_STACK1
class for things related to the gradient structures, including dimension of arrays, size of buffers, etc.
double cumd_norm(const double &x)
Culative normal distribution; constant objects.
double square(const double value)
Return square of value; constant object.
Fundamental data type for reverse mode automatic differentiation.
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
double inv_cumd_norm_logistic(double x, double p)
Description not yet available.
double x
< value of the variable