14 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 28 void sincosint(
double x,
double& sint,
double& cint);
33 inline double f1(
double x,
double const* h_) {
return h_[0] + h_[1] *
std::log(h_[2] *
x) - h_[3] *
x; }
34 inline double f2(
double x,
double const* h_) {
38 int dzero(
double a,
double b,
double& x0,
double& rv,
double eps,
int mxf,
F func);
50 const double xp[9] = {9.29, 2.47, .89, .36, .15, .07, .03, .02, 0.0};
51 const double xq[7] = {.012, .03, .08, .26, .87, 3.83, 11.0};
53 double q, u,
x,
c1, c2, c3, c4,
d1, h4, h5, h6, q2, x1,
d, ll, ul, xf1, xf2, rv;
67 h_[4] = 1. - beta2 * 0.42278433999999998 + 7.6 /
kappa;
70 h4 = -7.6 /
kappa - (beta2 * .57721566 + 1);
77 for (lp = 0; lp < 9; ++lp) {
82 for (lq = 0; lq < 7; ++lq) {
93 h_[0] =
kappa * (beta2 * .57721566 + 2.) + 9.9166128600000008;
97 h_[1] = beta2 *
kappa;
99 h_[3] =
omega_ * 1.5707963250000001;
103 d =
exp(
kappa * (beta2 * (.57721566 - h5) + 1.)) * .31830988654751274;
110 for (
k = 1;
k <
n; ++
k) {
118 xf1 =
kappa * (beta2 *
c1 - c4) -
x * c2;
128 a_[
n - 1] += q2 *
a_[
l - 1];
145 double f, u, y,
a0, a1;
153 }
else if (
x <=
t1_) {
155 u =
omega_ * y - 3.141592653589793;
160 for (
k = 2;
k <= n1; ++
k) {
163 a0 =
a_[
k - 1] + cof * a1 -
a2;
167 for (
k = 2;
k <=
n; ++
k) {
201 const double zero = 0.;
202 const double one = 1.;
203 const double two = 2.;
204 const double eight = 8.;
205 const double ce = .57721566490153;
206 const double c__[14] = {1.9405491464836,
220 const double p[23] = {
221 .96074783975204, -.0371138962124, .00194143988899, -1.7165988425e-4, 2.112637753e-5, -3.27163257e-6,
222 6.0069212e-7, -1.2586794e-7, 2.932563e-8, -7.45696e-9, 2.04105e-9, -5.9502e-10,
223 1.8323e-10, -5.921e-11, 1.997e-11, -7
e-12, 2.54e-12, -9.5e-13,
224 3.7e-13, -1.4e-13, 6
e-14, -2
e-14, 1
e-14};
225 const double q[20] = {.98604065696238, -.0134717382083, 4.5329284117e-4, -3.067288652e-5, 3.13199198e-6,
226 -4.2110196e-7, 6.907245e-8, -1.318321e-8, 2.83697e-9, -6.7329e-10,
227 1.734e-10, -4.787e-11, 1.403e-11, -4.33e-12, 1.4e-12,
228 -4.7e-13, 1.7e-13, -6
e-14, 2
e-14, -1
e-14};
236 double r__, y,
b0,
b1,
b2, pp, qq, alfa;
243 if (fabs(
x) <= eight) {
247 h__ =
two * (d__1 * d__1) -
one;
251 for (i__ = 13; i__ >= 0; --i__) {
252 b0 = c__[i__] - alfa *
b1 -
b2;
262 h__ =
two * (d__1 * d__1) -
one;
266 for (i__ = 22; i__ >= 0; --i__) {
274 for (i__ = 19; i__ >= 0; --i__) {
288 const double zero = 0.;
289 const double one = 1.;
290 const double two = 2.;
291 const double eight = 8.;
292 const double pih = 1.5707963267949;
293 const double s[14] = {1.9522209759531,
307 const double p[23] = {
308 .96074783975204, -.0371138962124, .00194143988899, -1.7165988425e-4, 2.112637753e-5, -3.27163257e-6,
309 6.0069212e-7, -1.2586794e-7, 2.932563e-8, -7.45696e-9, 2.04105e-9, -5.9502e-10,
310 1.8323e-10, -5.921e-11, 1.997e-11, -7
e-12, 2.54e-12, -9.5e-13,
311 3.7e-13, -1.4e-13, 6
e-14, -2
e-14, 1
e-14};
312 const double q[20] = {.98604065696238, -.0134717382083, 4.5329284117e-4, -3.067288652e-5, 3.13199198e-6,
313 -4.2110196e-7, 6.907245e-8, -1.318321e-8, 2.83697e-9, -6.7329e-10,
314 1.734e-10, -4.787e-11, 1.403e-11, -4.33e-12, 1.4e-12,
315 -4.7e-13, 1.7e-13, -6
e-14, 2
e-14, -1
e-14};
323 double r__, y,
b0,
b1,
b2, pp, qq, alfa;
325 if (fabs(
x) <= eight) {
328 h__ =
two * (d__1 * d__1) -
one;
332 for (i__ = 13; i__ >= 0; --i__) {
342 h__ =
two * (d__1 * d__1) -
one;
346 for (i__ = 22; i__ >= 0; --i__) {
354 for (i__ = 19; i__ >= 0; --i__) {
363 b1 = d__1 - r__ * (r__ * pp *
sin(
x) + qq *
cos(
x));
372 const double zero = 0.;
373 const double one = 1.;
374 const double two = 2.;
375 const double eight = 8.;
376 const double ce = .57721566490153;
377 const double pih = 1.5707963267949;
378 const double s__[14] = {1.9522209759531,
393 const double c__[14] = {1.9405491464836,
408 const double p[23] = {
409 .96074783975204, -.0371138962124, .00194143988899, -1.7165988425e-4, 2.112637753e-5, -3.27163257e-6,
410 6.0069212e-7, -1.2586794e-7, 2.932563e-8, -7.45696e-9, 2.04105e-9, -5.9502e-10,
411 1.8323e-10, -5.921e-11, 1.997e-11, -7
e-12, 2.54e-12, -9.5e-13,
412 3.7e-13, -1.4e-13, 6
e-14, -2
e-14, 1
e-14};
413 const double q[20] = {.98604065696238, -.0134717382083, 4.5329284117e-4, -3.067288652e-5, 3.13199198e-6,
414 -4.2110196e-7, 6.907245e-8, -1.318321e-8, 2.83697e-9, -6.7329e-10,
415 1.734e-10, -4.787e-11, 1.403e-11, -4.33e-12, 1.4e-12,
416 -4.7e-13, 1.7e-13, -6
e-14, 2
e-14, -1
e-14};
424 double r__, y,
b0,
b1,
b2, pp, qq, alfa;
429 if (fabs(
x) <= eight) {
433 h__ =
two * (d__1 * d__1) -
one;
440 for (i__ = 13; i__ >= 0; --i__) {
441 b0 = c__[i__] - alfa *
b1 -
b2;
445 cint = ce +
log((fabs(
x))) -
b0 + h__ *
b2;
450 for (i__ = 13; i__ >= 0; --i__) {
451 b0 = s__[i__] - alfa *
b1 -
b2;
455 sint = y * (
b0 -
b2);
462 h__ =
two * (d__1 * d__1) -
one;
466 for (i__ = 22; i__ >= 0; --i__) {
474 for (i__ = 19; i__ >= 0; --i__) {
481 cint = r__ * (qq *
sin(
x) - r__ * pp *
cos(
x));
486 sint = d__1 - r__ * (r__ * pp *
sin(
x) + qq *
cos(
x));
493 const double zero = 0.;
494 const double q2[7] = {
495 .10340013040487, 3.319092135933, 20.449478501379, 41.280784189142, 32.426421069514, 10.041164382905, 1.};
496 const double p3[6] = {
497 -2.3909964453136, -147.98219500504, -254.3763397689, -119.55761038372, -19.630408535939, -.9999999999036};
498 const double q3[6] = {177.60070940351, 530.68509610812, 462.23027156148, 156.81843364539, 21.630408494238, 1.};
499 const double p4[8] = {-8.6693733995107,
507 const double q4[8] = {34.171875,
515 const double a1[8] = {-2.1808638152072,
523 const double b1[8] = {0.,
531 const double a2[8] = {-3.4833465360285,
539 const double b2[8] = {0.,
547 const double a3[6] = {
548 -27.780928934438, -10.10479081576, -9.1483008216736, -5.0223317461851, -3.0000077799358, 1.0000000000704};
549 const double one = 1.;
550 const double b3[6] = {0., 122.39993926823, 2.7276100778779, -7.1897518395045, -2.9990118065262, 1.999999942826};
551 const double two = 2.;
552 const double three = 3.;
553 const double x0 = .37250741078137;
554 const double xl[6] = {-24., -12., -6., 0., 1., 4.};
555 const double p1[5] = {4.293125234321, 39.894153870321, 292.52518866921, 425.69682638592, -434.98143832952};
556 const double q1[5] = {1., 18.899288395003, 150.95038744251, 568.05252718987, 753.58564359843};
557 const double p2[7] = {.43096783946939,
566 double v, y, ap, bp, aq,
dp, bq, dq;
570 for (
int i__ = 2; i__ <= 5; ++i__) {
572 ap = a3[i__ - 1] -
x +
b3[i__ - 1] / ap;
574 y =
exp(-
x) /
x * (
one - (a3[5] +
b3[5] / ap) /
x);
575 }
else if (
x <= xl[1]) {
577 for (
int i__ = 2; i__ <= 7; ++i__) {
578 ap =
a2[i__ - 1] -
x +
b2[i__ - 1] / ap;
581 }
else if (
x <= xl[2]) {
583 for (
int i__ = 2; i__ <= 7; ++i__) {
584 ap = a1[i__ - 1] -
x +
b1[i__ - 1] / ap;
586 y =
exp(-
x) /
x * (a1[7] +
b1[7] / ap);
587 }
else if (
x < xl[3]) {
591 for (
int i__ = 2; i__ <= 8; ++i__) {
594 dp = p4[i__ - 1] - ap +
v * bp;
598 for (
int i__ = 2; i__ <= 8; ++i__) {
601 dq = q4[i__ - 1] - aq +
v * bq;
603 y = -
log(-
x / x0) + (
x + x0) * (
dp - ap) / (dq - aq);
604 }
else if (
x == xl[3]) {
606 }
else if (
x < xl[4]) {
609 for (
int i__ = 2; i__ <= 5; ++i__) {
610 ap =
p1[i__ - 1] +
x * ap;
611 aq = q1[i__ - 1] +
x * aq;
613 y = -
log(
x) + ap / aq;
614 }
else if (
x <= xl[5]) {
618 for (
int i__ = 2; i__ <= 7; ++i__) {
619 ap =
p2[i__ - 1] + y * ap;
620 aq = q2[i__ - 1] + y * aq;
622 y =
exp(-
x) * ap / aq;
627 for (
int i__ = 2; i__ <= 6; ++i__) {
628 ap =
p3[i__ - 1] + y * ap;
629 aq = q3[i__ - 1] + y * aq;
631 y =
exp(-
x) * y * (
one + y * ap / aq);
636 template <
typename F>
639 double d__1, d__2, d__3, d__4;
642 double f1,
f2, f3,
u1,
u2, x1, x2,
u3, u4, x3, ca, cb, cc, fa, fb, ee,
ff;
644 double xa, xb,
fx,
xx, su4;
659 ee =
eps * (fabs(x0) + 1);
673 rv = (d__1 = xb - xa, fabs(d__1)) * -.5;
689 if (
u2 == 0. || u4 == 0.) {
697 cb = (x1 + x2) *
u2 - (x2 + x0) *
u1;
698 cc = (x1 - x0) *
f1 - x1 * (ca * x1 + cb);
706 u4 =
u3 *
u3 - cc / ca;
716 if (x0 < xa || x0 > xb) {
720 d__3 = (d__1 = x0 - x3, fabs(d__1)), d__4 = (d__2 = x0 - x2, fabs(d__2));
722 ee =
eps * (fabs(x0) + 1);
760 rv = (d__1 = xb - xa, fabs(d__1)) * -.5;
double expint(double x)
Private version of the sine integral.
double sinint(double x)
Private version of the cosine integral.
void sincosint(double x, double &sint, double &cint)
Sin< T >::type sin(const T &t)
const int mode_
returns the limits on the non-zero (mode=0) or normalized region (mode=1)
int dzero(double a, double b, double &x0, double &rv, double eps, int mxf, F func)
void limits(double &xl, double &xu) const
density (mode=0) or distribution (mode=1) function
double cosint(double x)
Private version of the cosine and sine integral.
Cos< T >::type cos(const T &t)
double f1(double x, double const *h_)
Private version of the exponential integral.
Abs< T >::type abs(const T &t)
double f2(double x, double const *h_)
static constexpr float a0
double fcn(double x) const
static constexpr float b0
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
VVIObj(double kappa=0.01, double beta2=1., int mode=0)
Constructor.
static constexpr float d1