14 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 25 void sincosint(
double x,
double& sint,
double& cint);
31 int dzero(
double a,
double b,
double& x0,
double& rv,
double eps,
int mxf,
F func);
43 const double xp[9] = {9.29, 2.47, .89, .36, .15, .07, .03, .02, 0.0};
44 const double xq[7] = {.012, .03, .08, .26, .87, 3.83, 11.0};
46 double q, u,
x,
c1, c2, c3, c4,
d1, h4, h5, h6, q2,
x1,
d, ll, ul, xf1, xf2, rv;
60 h_[4] = 1. - beta2 * 0.42278433999999998 + 7.6 /
kappa;
63 h4 = -7.6 /
kappa - (beta2 * .57721566 + 1);
70 for (lp = 0; lp < 9; ++lp) {
75 for (lq = 0; lq < 7; ++lq) {
80 auto f2 = [h_](
double x) {
88 h_[0] =
kappa * (beta2 * .57721566 + 2.) + 9.9166128600000008;
92 h_[1] = beta2 *
kappa;
94 h_[3] =
omega_ * 1.5707963250000001;
95 auto f1 = [h_](
double x) {
return h_[0] + h_[1] *
std::log(h_[2] *
x) - h_[3] *
x; };
98 d =
exp(
kappa * (beta2 * (.57721566 - h5) + 1.)) * .31830988654751274;
105 for (
k = 1;
k <
n; ++
k) {
113 xf1 =
kappa * (beta2 *
c1 - c4) -
x * c2;
123 a_[
n - 1] += q2 *
a_[
l - 1];
140 double f, u,
y,
a0, a1;
148 }
else if (
x <=
t1_) {
150 u =
omega_ *
y - 3.141592653589793;
155 for (
k = 2;
k <= n1; ++
k) {
158 a0 =
a_[
k - 1] + cof * a1 -
a2;
162 for (
k = 2;
k <=
n; ++
k) {
196 const double zero = 0.;
197 const double one = 1.;
198 const double two = 2.;
199 const double eight = 8.;
200 const double ce = .57721566490153;
201 const double c__[14] = {1.9405491464836,
215 const double p[23] = {
216 .96074783975204, -.0371138962124, .00194143988899, -1.7165988425e-4, 2.112637753e-5, -3.27163257e-6,
217 6.0069212e-7, -1.2586794e-7, 2.932563e-8, -7.45696e-9, 2.04105e-9, -5.9502e-10,
218 1.8323e-10, -5.921e-11, 1.997e-11, -7
e-12, 2.54e-12, -9.5e-13,
219 3.7e-13, -1.4e-13, 6
e-14, -2
e-14, 1
e-14};
220 const double q[20] = {.98604065696238, -.0134717382083, 4.5329284117e-4, -3.067288652e-5, 3.13199198e-6,
221 -4.2110196e-7, 6.907245e-8, -1.318321e-8, 2.83697e-9, -6.7329e-10,
222 1.734e-10, -4.787e-11, 1.403e-11, -4.33e-12, 1.4e-12,
223 -4.7e-13, 1.7e-13, -6
e-14, 2
e-14, -1
e-14};
231 double r__, y,
b0,
b1,
b2, pp, qq, alfa;
238 if (fabs(
x) <= eight) {
242 h__ =
two * (d__1 * d__1) -
one;
246 for (i__ = 13; i__ >= 0; --i__) {
247 b0 = c__[i__] - alfa *
b1 -
b2;
257 h__ =
two * (d__1 * d__1) -
one;
261 for (i__ = 22; i__ >= 0; --i__) {
269 for (i__ = 19; i__ >= 0; --i__) {
283 const double zero = 0.;
284 const double one = 1.;
285 const double two = 2.;
286 const double eight = 8.;
287 const double pih = 1.5707963267949;
288 const double s[14] = {1.9522209759531,
302 const double p[23] = {
303 .96074783975204, -.0371138962124, .00194143988899, -1.7165988425e-4, 2.112637753e-5, -3.27163257e-6,
304 6.0069212e-7, -1.2586794e-7, 2.932563e-8, -7.45696e-9, 2.04105e-9, -5.9502e-10,
305 1.8323e-10, -5.921e-11, 1.997e-11, -7
e-12, 2.54e-12, -9.5e-13,
306 3.7e-13, -1.4e-13, 6
e-14, -2
e-14, 1
e-14};
307 const double q[20] = {.98604065696238, -.0134717382083, 4.5329284117e-4, -3.067288652e-5, 3.13199198e-6,
308 -4.2110196e-7, 6.907245e-8, -1.318321e-8, 2.83697e-9, -6.7329e-10,
309 1.734e-10, -4.787e-11, 1.403e-11, -4.33e-12, 1.4e-12,
310 -4.7e-13, 1.7e-13, -6
e-14, 2
e-14, -1
e-14};
318 double r__, y,
b0,
b1,
b2, pp, qq, alfa;
320 if (fabs(
x) <= eight) {
323 h__ =
two * (d__1 * d__1) -
one;
327 for (i__ = 13; i__ >= 0; --i__) {
337 h__ =
two * (d__1 * d__1) -
one;
341 for (i__ = 22; i__ >= 0; --i__) {
349 for (i__ = 19; i__ >= 0; --i__) {
358 b1 = d__1 - r__ * (r__ * pp *
sin(
x) + qq *
cos(
x));
367 const double zero = 0.;
368 const double one = 1.;
369 const double two = 2.;
370 const double eight = 8.;
371 const double ce = .57721566490153;
372 const double pih = 1.5707963267949;
373 const double s__[14] = {1.9522209759531,
388 const double c__[14] = {1.9405491464836,
403 const double p[23] = {
404 .96074783975204, -.0371138962124, .00194143988899, -1.7165988425e-4, 2.112637753e-5, -3.27163257e-6,
405 6.0069212e-7, -1.2586794e-7, 2.932563e-8, -7.45696e-9, 2.04105e-9, -5.9502e-10,
406 1.8323e-10, -5.921e-11, 1.997e-11, -7
e-12, 2.54e-12, -9.5e-13,
407 3.7e-13, -1.4e-13, 6
e-14, -2
e-14, 1
e-14};
408 const double q[20] = {.98604065696238, -.0134717382083, 4.5329284117e-4, -3.067288652e-5, 3.13199198e-6,
409 -4.2110196e-7, 6.907245e-8, -1.318321e-8, 2.83697e-9, -6.7329e-10,
410 1.734e-10, -4.787e-11, 1.403e-11, -4.33e-12, 1.4e-12,
411 -4.7e-13, 1.7e-13, -6
e-14, 2
e-14, -1
e-14};
419 double r__, y,
b0,
b1,
b2, pp, qq, alfa;
424 if (fabs(
x) <= eight) {
428 h__ =
two * (d__1 * d__1) -
one;
435 for (i__ = 13; i__ >= 0; --i__) {
436 b0 = c__[i__] - alfa *
b1 -
b2;
440 cint = ce +
log((fabs(
x))) -
b0 + h__ *
b2;
445 for (i__ = 13; i__ >= 0; --i__) {
446 b0 = s__[i__] - alfa *
b1 -
b2;
450 sint = y * (
b0 -
b2);
457 h__ =
two * (d__1 * d__1) -
one;
461 for (i__ = 22; i__ >= 0; --i__) {
469 for (i__ = 19; i__ >= 0; --i__) {
476 cint = r__ * (qq *
sin(
x) - r__ * pp *
cos(
x));
481 sint = d__1 - r__ * (r__ * pp *
sin(
x) + qq *
cos(
x));
488 const double zero = 0.;
489 const double q2[7] = {
490 .10340013040487, 3.319092135933, 20.449478501379, 41.280784189142, 32.426421069514, 10.041164382905, 1.};
491 const double p3[6] = {
492 -2.3909964453136, -147.98219500504, -254.3763397689, -119.55761038372, -19.630408535939, -.9999999999036};
493 const double q3[6] = {177.60070940351, 530.68509610812, 462.23027156148, 156.81843364539, 21.630408494238, 1.};
494 const double p4[8] = {-8.6693733995107,
502 const double q4[8] = {34.171875,
510 const double a1[8] = {-2.1808638152072,
518 const double b1[8] = {0.,
526 const double a2[8] = {-3.4833465360285,
534 const double b2[8] = {0.,
542 const double a3[6] = {
543 -27.780928934438, -10.10479081576, -9.1483008216736, -5.0223317461851, -3.0000077799358, 1.0000000000704};
544 const double one = 1.;
545 const double b3[6] = {0., 122.39993926823, 2.7276100778779, -7.1897518395045, -2.9990118065262, 1.999999942826};
546 const double two = 2.;
547 const double three = 3.;
548 const double x0 = .37250741078137;
549 const double xl[6] = {-24., -12., -6., 0., 1., 4.};
550 const double p1[5] = {4.293125234321, 39.894153870321, 292.52518866921, 425.69682638592, -434.98143832952};
551 const double q1[5] = {1., 18.899288395003, 150.95038744251, 568.05252718987, 753.58564359843};
552 const double p2[7] = {.43096783946939,
561 double v, y, ap, bp, aq,
dp, bq, dq;
565 for (
int i__ = 2; i__ <= 5; ++i__) {
567 ap = a3[i__ - 1] -
x +
b3[i__ - 1] / ap;
569 y =
exp(-
x) /
x * (
one - (a3[5] +
b3[5] / ap) /
x);
570 }
else if (
x <= xl[1]) {
572 for (
int i__ = 2; i__ <= 7; ++i__) {
573 ap =
a2[i__ - 1] -
x +
b2[i__ - 1] / ap;
576 }
else if (
x <= xl[2]) {
578 for (
int i__ = 2; i__ <= 7; ++i__) {
579 ap = a1[i__ - 1] -
x +
b1[i__ - 1] / ap;
581 y =
exp(-
x) /
x * (a1[7] +
b1[7] / ap);
582 }
else if (
x < xl[3]) {
586 for (
int i__ = 2; i__ <= 8; ++i__) {
589 dp = p4[i__ - 1] - ap +
v * bp;
593 for (
int i__ = 2; i__ <= 8; ++i__) {
596 dq = q4[i__ - 1] - aq +
v * bq;
598 y = -
log(-
x / x0) + (
x + x0) * (
dp - ap) / (dq - aq);
599 }
else if (
x == xl[3]) {
601 }
else if (
x < xl[4]) {
604 for (
int i__ = 2; i__ <= 5; ++i__) {
605 ap =
p1[i__ - 1] +
x * ap;
606 aq = q1[i__ - 1] +
x * aq;
608 y = -
log(
x) + ap / aq;
609 }
else if (
x <= xl[5]) {
613 for (
int i__ = 2; i__ <= 7; ++i__) {
614 ap =
p2[i__ - 1] + y * ap;
615 aq = q2[i__ - 1] + y * aq;
617 y =
exp(-
x) * ap / aq;
622 for (
int i__ = 2; i__ <= 6; ++i__) {
623 ap =
p3[i__ - 1] + y * ap;
624 aq = q3[i__ - 1] + y * aq;
626 y =
exp(-
x) * y * (
one + y * ap / aq);
631 template <
typename F>
634 double d__1, d__2, d__3, d__4;
637 double f1,
f2, f3,
u1,
u2, x1, x2,
u3, u4, x3, ca, cb,
cc, fa, fb, ee,
ff;
639 double xa, xb,
fx,
xx, su4;
654 ee =
eps * (fabs(x0) + 1);
668 rv = (d__1 = xb - xa, fabs(d__1)) * -.5;
684 if (
u2 == 0. || u4 == 0.) {
692 cb = (x1 + x2) *
u2 - (x2 + x0) *
u1;
693 cc = (x1 - x0) *
f1 - x1 * (ca * x1 + cb);
711 if (x0 < xa || x0 > xb) {
715 d__3 = (d__1 = x0 - x3, fabs(d__1)), d__4 = (d__2 = x0 - x2, fabs(d__2));
717 ee =
eps * (fabs(x0) + 1);
755 rv = (d__1 = xb - xa, fabs(d__1)) * -.5;
void limits(double &xl, double &xu) const
density (mode=0) or distribution (mode=1) function
uint32_t cc[maxCellsPerHit]
Sin< T >::type sin(const T &t)
double sinint(double x)
Private version of the cosine integral.
int dzero(double a, double b, double &x0, double &rv, double eps, int mxf, F func)
Private version of the exponential integral.
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)
VVIObj(double kappa=0.01, double beta2=1., int mode=0)
Constructor.
double f2(double x, double const *h_)
void sincosint(double x, double &sint, double &cint)
static constexpr float a0
double fcn(double x) const
const int mode_
returns the limits on the non-zero (mode=0) or normalized region (mode=1)
static constexpr float b0
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
static constexpr float d1
double expint(double x)
Private version of the sine integral.