39 typedef struct { real r, i; }
complex;
46 typedef long long longint;
47 typedef unsigned long long ulongint;
48 #define qbit_clear(a,b) ((a) & ~((ulongint)1 << (b)))
49 #define qbit_set(a,b) ((a) | ((ulongint)1 << (b)))
180 #define abs(x) ((x) >= 0 ? (x) : -(x))
181 #define dabs(x) (doublereal)abs(x)
182 #define min(a,b) ((a) <= (b) ? (a) : (b))
183 #define max(a,b) ((a) >= (b) ? (a) : (b))
184 #define dmin(a,b) (doublereal)min(a,b)
185 #define dmax(a,b) (doublereal)max(a,b)
186 #define bit_test(a,b) ((a) >> (b) & 1)
187 #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
188 #define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
192 #define F2C_proc_par_types 1
194 typedef int (*U_fp)(...);
204 typedef int (*
S_fp)(...);
206 typedef int (*U_fp)();
226 #ifndef Skip_f2c_Undefs
269 retval=
mvbvu_(&mx,&my,&rho);
319 } equiv_21 = { {.1713244923791705, .3607615730481384,
320 .4679139345726904}, {0, 0, 0, 0, 0, 0, 0},
321 {.04717533638651177, .1069393259953183,
322 .1600783285433464, .2031674267230659, .2334925365383547,
323 .2491470458134029}, {0, 0, 0, 0}, {.01761400713915212,
324 .04060142980038694, .06267204833410906, .08327674157670475,
325 .1019301198172404, .1181945319615184, .1316886384491766,
326 .1420961093183821, .1491729864726037, .1527533871307259}};
328 #define w ((doublereal *)&equiv_21)
336 } equiv_22 = { {-.9324695142031522, -.6612093864662647,
337 -.238619186083197}, {0, 0, 0, 0, 0, 0, 0},
338 {-.9815606342467191, -.904117256370475,
339 -.769902674194305, -.5873179542866171, -.3678314989981802,
340 -.1252334085114692}, {0, 0, 0, 0}, {-.9931285991850949,
341 -.9639719272779138, -.9122344282513259, -.8391169718222188,
342 -.7463319064601508, -.636053680726515, -.5108670019508271,
343 -.3737060887154196, -.2277858511416451, -.07652652113349733}};
345 #define x ((doublereal *)&equiv_22)
407 if (
abs(
value(*r__)) < (
double).3) {
410 }
else if (
abs(
value(*r__)) < (
double).75) {
421 if (
abs(
value(*r__)) < (
double).925) {
422 hs = (h__ * h__ + k * k) / 2;
425 for (i__ = 1; i__ <= i__1; ++i__) {
426 sn =
sin(asr * (
x[i__ + ng * 10 - 11] + 1) / 2);
427 bvn +=
w[i__ + ng * 10 - 11] *
exp((sn * hk - hs) / (1 - sn * sn))
429 sn =
sin(asr * (-
x[i__ + ng * 10 - 11] + 1) / 2);
430 bvn +=
w[i__ + ng * 10 - 11] *
exp((sn * hk - hs) / (1 - sn * sn))
435 bvn = bvn * asr / 12.566370614359172 +
mvphi_(&d__1) *
mvphi_(&d__2);
437 if (
value(*r__) < 0.) {
442 as = (1 - *r__) * (*r__ + 1);
448 d__ = (12 - hk) / 16;
449 bvn = a *
exp(-(bs / as + hk) / 2) * (1 - c__ * (bs - as) * (1 -
450 d__ * bs / 5) / 3 + c__ * d__ * as * as / 5);
454 bvn -=
exp(-hk / 2) *
sqrt(6.283185307179586) *
mvphi_(&d__1)
455 * b * (1 - c__ * bs * (1 - d__ * bs / 5) / 3);
459 for (i__ = 1; i__ <= i__1; ++i__) {
461 d__1 = a * (
x[i__ + ng * 10 - 11] + 1);
464 bvn += a *
w[i__ + ng * 10 - 11] * (
exp(-bs / (xs * 2) - hk /
465 (rs + 1)) / rs -
exp(-(bs / xs + hk) / 2) * (c__ * xs
466 * (d__ * xs + 1) + 1));
468 d__1 = -
x[i__ + ng * 10 - 11] + 1;
469 xs = as * (d__1 * d__1) / 4;
471 bvn += a *
w[i__ + ng * 10 - 11] *
exp(-(bs / xs + hk) / 2) *
472 (
exp(-hk * (1 - rs) / ((rs + 1) * 2)) / rs - (c__ *
473 xs * (d__ * xs + 1) + 1));
475 bvn = -bvn / 6.283185307179586;
486 bvn = -bvn +
max(d__1,d__2);
555 expntl =
exp(-(d__1 * d__1) / 2);
559 if (zabs < 7.071067811865475) {
560 p = expntl * ((((((zabs * .03526249659989109 + .7003830644436881)
561 * zabs + 6.37396220353165) * zabs + 33.912866078383) *
562 zabs + 112.0792914978709) * zabs + 221.2135961699311) *
563 zabs + 220.2068679123761) / (((((((zabs *
564 .08838834764831844 + 1.755667163182642) * zabs +
565 16.06417757920695) * zabs + 86.78073220294608) * zabs +
566 296.5642487796737) * zabs + 637.3336333788311) * zabs +
567 793.8265125199484) * zabs + 440.4137358247522);
572 p = expntl / (zabs + 1 / (zabs + 2 / (zabs + 3 / (zabs + 4 / (
573 zabs + .65))))) / 2.506628274631001;
d3_array sin(const d3_array &arr3)
Returns d3_array results with computed sin from elements in arr3.
unsigned long int uinteger
dvariable mvbvu_(const dvariable *sh, const dvariable *sk, const dvariable *r__)
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.
static _THREAD gradient_structure * _instance
dvariable mvphi_(dvariable *)
double cumbvn(const double &x, const double &y, const double &rho)
Cumulative bivariate normal distribution.
void RETURN_ARRAYS_DECREMENT()
dvector value(const df1_one_vector &v)
class for things related to the gradient structures, including dimension of arrays, size of buffers, etc.
Fundamental data type for reverse mode automatic differentiation.
dvector asin(const dvector &vec)
Returns dvector with principal value of the arc sine of vec, expressed in radians.