23template <
int TABLE_SIZE>
24constexpr std::array<LongDoublePair, TABLE_SIZE>
37template <
typename RealType>
38bool areClose(RealType a, RealType b, RealType eps = 1e-6)
42 RealType fa = std::fabs(a);
43 RealType fb = std::fabs(b);
44 return std::fabs(b - a) < eps * std::max(fa, fb);
53template <std::
floating_po
int Real>
60template <std::
floating_po
int Real>
67template <std::
floating_po
int Real>
74template <std::
floating_po
int Real>
81template <std::
floating_po
int Real>
88template <std::
floating_po
int Real>
95template <std::
floating_po
int Real>
102template <std::
floating_po
int Real>
109template <std::
floating_po
int Real>
117template <std::
floating_po
int Real>
125template <std::
floating_po
int Real>
134template <std::
floating_po
int Real>
135Real
logBesselI(std::type_identity_t<Real> nu, Real x);
143template <std::
floating_po
int Real>
144Real
logBesselK(std::type_identity_t<Real> nu, Real x);
151template <std::
floating_po
int Real>
152Real
W0Lambert(Real x, std::type_identity_t<Real> epsilon = Real{1e-11});
158template <std::
floating_po
int Real>
159std::complex<Real>
W0Lambert(std::complex<Real> z);
166template <std::
floating_po
int Real>
167Real
Wm1Lambert(Real x, std::type_identity_t<Real> epsilon = Real{1e-11});
179template <std::
floating_po
int Real>
180Real
MarcumP(std::type_identity_t<Real> mu, Real x, std::type_identity_t<Real> y, std::type_identity_t<Real> sqrtX,
181 std::type_identity_t<Real> sqrtY, std::type_identity_t<Real> logX, std::type_identity_t<Real> logY);
189template <std::
floating_po
int Real>
190Real
MarcumP(std::type_identity_t<Real> mu, Real x, std::type_identity_t<Real> y);
202template <std::
floating_po
int Real>
203Real
MarcumQ(std::type_identity_t<Real> mu, Real x, std::type_identity_t<Real> y, std::type_identity_t<Real> sqrtX,
204 std::type_identity_t<Real> sqrtY, std::type_identity_t<Real> logX, std::type_identity_t<Real> logY);
212template <std::
floating_po
int Real>
213Real
MarcumQ(std::type_identity_t<Real> mu, Real x, std::type_identity_t<Real> y);
231template <std::
floating_po
int Real>
234 return (x > 0) ? 1 : ((x < 0) ? -1 : 0);
237template <std::
floating_po
int Real>
251template <std::
floating_po
int Real>
255 return std::log1p(std::exp(x));
256 return (x < 35.0) ? x + std::exp(-x) : x;
259template <std::
floating_po
int Real>
265template <std::
floating_po
int Real>
269 return std::log(std::expm1(x));
270 return (x < 35.0) ? x - std::exp(-x) : x;
273template <std::
floating_po
int Real>
276 return std::log1p(-std::expm1(x));
282template <std::
floating_po
int Real>
286 long double Tn = t, Tnm1 = 1, sum = 0.0;
287 for (
int i = 1; i != size; ++i) {
288 sum += array[i] * Tn;
290 long double temp = Tn;
295 return static_cast<Real
>(
static_cast<long double>(x) * (array[0] + sum));
298template <std::
floating_po
int Real>
302 static constexpr long double D5 = -9.199992358830151031278420l, D6 = 2.794990820124599493768426l;
303 static constexpr int muSize = 26;
304 static constexpr long double mu[muSize] = {.9885750640661893136460358l,
305 .0108577051845994776160281l,
306 -.0017511651027627952594825l,
307 .0000211969932065633437984l,
308 .0000156648714042435087911l,
309 -.05190416869103124261e-5l,
310 -.00371357897426717780e-5l,
311 .00012174308662357429e-5l,
312 -.00001768115526613442e-5l,
313 -.119372182556161e-10l,
314 .003802505358299e-10l,
315 -.000660188322362e-10l,
316 -.000087917055170e-10l,
332template <std::
floating_po
int Real>
336 static constexpr long double D3 = -0.5594576313298323225436913l, D4 = 2.287915716263357638965891l;
337 static constexpr int deltaSize = 38;
338 static constexpr long double delta[deltaSize] = {.9566797090204925274526373l,
339 -.0231070043090649036999908l,
340 -.0043742360975084077333218l,
341 -.0005765034226511854809364l,
342 -.0000109610223070923931242l,
343 .0000251085470246442787982l,
344 .0000105623360679477511955l,
345 .27544123300306391503e-5l,
346 .04324844983283380689e-5l,
347 -.00205303366552086916e-5l,
348 -.00438915366654316784e-5l,
349 -.00176840095080881795e-5l,
350 -.00039912890280463420e-5l,
351 -.00001869324124559212e-5l,
352 .00002729227396746077e-5l,
353 .00001328172131565497e-5l,
354 .318342484482286e-10l,
355 .016700607751926e-10l,
356 -.020364649611537e-10l,
357 -.009648468127965e-10l,
358 -.002195672778128e-10l,
359 -.000095689813014e-10l,
360 .000137032572230e-10l,
361 .000062538505417e-10l,
362 .000014584615266e-10l,
378template <std::
floating_po
int Real>
382 static constexpr long double D1 = -1.548813042373261659512742l, D2 = 2.565490123147816151928163l;
383 static constexpr int lambdaSize = 27;
384 static constexpr long double lambda[lambdaSize] = {.9121588034175537733059200l,
385 -.0162662818676636958546661l,
386 .0004335564729494453650589l,
387 .0002144385700744592065205l,
388 .26257510757648130176e-5l,
389 -.30210910501037969912e-5l,
390 -.00124060618367572157e-5l,
391 .00624066092999917380e-5l,
392 -.00005401247900957858e-5l,
393 -.00014232078975315910e-5l,
394 .343840281955305e-10l,
395 .335848703900138e-10l,
396 -.014584288516512e-10l,
397 -.008102174258833e-10l,
398 .000525324085874e-10l,
399 .000197115408612e-10l,
400 -.000017494333828e-10l,
414template <std::
floating_po
int Real>
418 static constexpr int xiSize = 39;
419 static constexpr long double xi[xiSize] = {.9928853766189408231495800l,
420 .1204675161431044864647846l,
421 .0160781993420999447267039l,
422 .0026867044371623158279591l,
423 .0004996347302357262947170l,
424 .0000988982185991204409911l,
425 .0000203918127639944337340l,
426 .43272716177354218758e-5l,
427 .09380814128593406758e-5l,
428 .02067347208683427411e-5l,
429 .00461596991054300078e-5l,
430 .00104166797027146217e-5l,
431 .00023715009995921222e-5l,
432 .00005439284068471390e-5l,
433 .00001255489864097987e-5l,
434 .291381803663201e-10l,
435 .067949421808797e-10l,
436 .015912343331569e-10l,
437 .003740250585245e-10l,
438 .000882087762421e-10l,
439 .000208650897725e-10l,
440 .000049488041039e-10l,
441 .000011766394740e-10l,
463template <std::
floating_po
int Real>
470 throw std::invalid_argument(
"Argument p should be in interval [-1, 1]");
478 Real beta = std::sqrt(-std::log1p(-p * p));
484template <std::
floating_po
int Real>
496 Real pSq = p * p, p2 = 2 * p;
497 Real beta = std::sqrt(-std::log(p2 - pSq));
503template <std::
floating_po
int Real>
506 static constexpr int MAX_X = 10;
507 static constexpr int N = 10;
510 y += std::log(std::erfc(x));
511 return x * std::exp(y);
515 for (
int n = 1; n != N; ++n) {
519 sum += (n & 1) ? -add : add;
524template <std::
floating_po
int Real>
528 return std::exp(x * x) * std::erfc(x);
532template <std::
floating_po
int Real>
542 for (
int i = 2; i <= number; ++i)
543 res += std::pow(i, -exponent);
556template <std::
floating_po
int Real>
559 const Real mu = 4 * nu * nu;
560 Real term = 1, sum = 1;
561 for (
int k = 1; k < 64; ++k) {
562 const Real odd = 2 * k - 1;
563 const Real next = term *
sign * (mu - odd * odd) / (8 * k * x);
564 if (!(std::fabs(next) < std::fabs(term)))
568 if (std::fabs(term) <= std::numeric_limits<Real>::epsilon() * std::fabs(sum))
571 return std::log(sum);
576template <std::
floating_po
int Real>
580 Real roundNu = std::round(nu);
584 return (nuInt % 2) ? NAN :
logBesselI(nu, -x);
592 Real roundNu = std::round(nu);
594 return (nu > 0 || nuIsInt) ? -INFINITY : INFINITY;
597 if (std::fabs(nu) == 0.5) {
615 return (y <= 0) ? -INFINITY : std::log(y);
619 if (std::isfinite(besseli) && !(besseli > Real{1e-250})) {
621 const Real quarterSquare = Real{0.25} * x * x;
622 Real term = 1, sum = 1;
623 for (
int j = 1; j < 100000; ++j) {
624 term *= quarterSquare / (j * (nu + j));
626 if (term <= std::numeric_limits<Real>::epsilon() * sum)
629 return nu * std::log(Real{0.5} * x) - std::lgamma(nu + 1) + std::log(sum);
631 return std::isfinite(besseli) ? std::log(besseli)
636template <std::
floating_po
int Real>
650 if (!std::isfinite(besselk))
651 return (nu == 0) ? std::log(-std::log(x))
654 return std::log(besselk);
666template <std::
floating_po
int Real>
672 Real ew = std::exp(w);
674 Real numerator1 = wew - x;
676 Real denominator1 = ew * wp1;
677 Real numerator2 = (w + 2) * numerator1;
678 Real denominator2 = 2 * wp1;
679 step = numerator2 / denominator2;
680 step = numerator1 / (denominator1 - step);
682 }
while (std::fabs(step) > epsilon);
688template <std::
floating_po
int Real>
689inline Real
W0Lambert(Real x, std::type_identity_t<Real> epsilon)
693 throw std::invalid_argument(
"Argument x should be greater than -1/e, but it's equal to " + std::to_string(x));
695 Real logX = std::log(x);
696 Real loglogX = std::log(logX);
702template <std::
floating_po
int Real>
703inline std::complex<Real>
W0Lambert(std::complex<Real> z)
705 using Complex = std::complex<Real>;
709 const Complex logShifted = std::log(Real(1) + z);
710 Complex w = logShifted * (Real(1) - std::log(Real(1) + logShifted) / (Real(2) + logShifted));
711 for (
int iteration = 0; iteration < 64; ++iteration) {
712 const Complex exponential = std::exp(w), residual = w * exponential - z, wp1 = w + Real(1);
713 const Complex step = residual / (exponential * wp1 - (w + Real(2)) * residual / (Real(2) * wp1));
715 if (std::abs(step) <= 4 * std::numeric_limits<Real>::epsilon() * std::abs(w))
721template <std::
floating_po
int Real>
722inline Real
Wm1Lambert(Real x, std::type_identity_t<Real> epsilon)
725 if (x < -randlib::consts::inv_e || x > 0)
726 throw std::invalid_argument(
727 "Argument x should be greater than -1/e and smaller or equal to 0, but it's equal to " + std::to_string(x));
729 Real logmX = std::log(-x);
730 Real logmlogmX = std::log(-logmX);
731 w = logmX - logmlogmX;
747template <std::
floating_po
int Real>
751 static constexpr Real ln2piEps = -35.0;
752 Real lgammamu = std::lgamma(mu);
753 Real C = lgammamu - ln2piEps + mu;
757 Real root = std::max(Real{0.5} * (mu * mu + 4 * x * y - mu), Real{1});
758 Real logXY = logX + logY;
759 if (!math::findRootNewtonSecondOrder<Real>(
760 [C, mu, logXY](Real n) {
762 Real logn = std::log(n), lognpmu = std::log(npmu);
763 Real first = logn - 2 - logXY;
765 first += npmu * lognpmu;
767 Real second = logn + lognpmu - logXY;
768 Real third = 1.0 / n + 1.0 / npmu;
773 throw std::runtime_error(
"Marcum P function: failure in numerical procedure");
778 int n0 =
static_cast<int>(std::max(std::ceil(root), Real{5}));
780 Real P =
pgamma(mpn0, y, logY);
781 Real diffP = (mpn0 - 1) * logY - y - std::lgamma(mpn0);
782 diffP = std::exp(diffP);
783 for (
int n = n0; n > 0; --n) {
784 Real term = n * logX - x -
lfact(n);
785 Real mupnm1 = mu + n - 1;
786 term = std::exp(term) * P;
791 P =
pgamma(mupnm1, y, logY);
792 diffP = (mupnm1 - 1) * logY - y - std::lgamma(mupnm1);
793 diffP = std::exp(diffP);
801 Real lastTerm =
lpgamma(mu, y, logY) - x;
802 lastTerm = std::exp(lastTerm);
807template <std::
floating_po
int Real>
811 return qgamma(mu, y, logY);
812 const Real saddle = Real{0.5} * (std::sqrt(mu * mu + 4 * x * y) - mu);
813 const int center =
static_cast<int>(std::floor(std::max(x, saddle)));
814 Real shape = mu + center;
815 Real weight = std::exp(-x + center * logX - std::lgamma(center + 1.0));
816 Real q =
qgamma(shape, y, logY);
817 Real delta = std::exp(shape * logY - y - std::lgamma(shape + 1));
818 Real sum = weight * q;
820 Real lowerWeight = weight;
821 Real previousTerm = sum;
823 for (
int n = center; n > 0; --n) {
824 lowerWeight *= n / x;
825 const Real lowerQ =
qgamma(mu + n - 1, y, logY);
826 const Real term = lowerWeight * lowerQ;
828 decreasing = (term <= previousTerm) ? decreasing + 1 : 0;
829 if (decreasing >= 8 && term <= 4 * std::numeric_limits<Real>::epsilon() * sum)
835 previousTerm = weight * q;
836 for (
int n = center + 1; n < 1000000; ++n) {
841 const Real term = weight * std::min(Real{1}, q);
843 decreasing = (term <= previousTerm) ? decreasing + 1 : 0;
844 if (decreasing >= 8 && term <= 4 * std::numeric_limits<Real>::epsilon() * sum)
848 return std::clamp(sum, Real{0}, Real{1});
853template <std::
floating_po
int Real>
857 return pgamma(mu, y, logY);
858 const Real saddle = Real{0.5} * (std::sqrt(mu * mu + 4 * x * y) - mu);
859 const int center =
static_cast<int>(std::floor(std::max(x, saddle)));
860 const Real shape = mu + center;
861 const Real weight = std::exp(-x + center * logX - std::lgamma(center + 1.0));
862 const Real p =
pgamma(shape, y, logY);
863 Real sum = weight * p;
865 Real lowerWeight = weight, lowerP = p;
866 Real delta = std::exp((shape - 1) * logY - y - std::lgamma(shape));
867 Real previousTerm = sum;
869 for (
int n = center; n > 0; --n) {
870 lowerWeight *= n / x;
872 delta *= (mu + n - 1) / y;
873 const Real term = lowerWeight * std::min(Real{1}, lowerP);
875 decreasing = (term <= previousTerm) ? decreasing + 1 : 0;
876 if (decreasing >= 8 && term <= 4 * std::numeric_limits<Real>::epsilon() * sum)
881 Real upperWeight = weight;
882 previousTerm = weight * p;
884 for (
int n = center + 1; n < 1000000; ++n) {
885 upperWeight *= x / n;
886 const Real term = upperWeight *
pgamma(mu + n, y, logY);
888 decreasing = (term <= previousTerm) ? decreasing + 1 : 0;
889 if (decreasing >= 8 && term <= 4 * std::numeric_limits<Real>::epsilon() * sum)
893 return std::clamp(sum, Real{0}, Real{1});
904template <std::
floating_po
int Real>
907 Real xi = 2 * sqrtX * sqrtY;
908 Real sigma = (y + x) / xi - 1;
909 Real sigmaXi = sigma * xi;
910 Real rho = sqrtY / sqrtX;
911 Real aux = std::erfc(sqrtX - sqrtY);
912 Real Phi = (sigma == 0) ? Real{0} :
sign(x - y) * std::sqrt(
static_cast<Real
>(
randlib::consts::pi) / sigma) * aux;
913 Real Psi0 = aux / std::sqrt(rho);
916 int n0 =
static_cast<int>(std::max(std::ceil(sigmaXi), Real{7}));
918 Real A1 = 1.0, A2 = 1.0;
919 for (
int n = 1; n <= n0; ++n) {
921 Real nmHalf = n - 0.5;
923 Real temp = -sigmaXi - nmHalf * logXi;
924 Phi += std::exp(temp);
927 Real coef1 = (nmHalf - mu) * (nmHalf + mu);
928 Real coef2 = (nmHalf - mu + 1) * (nmHalf + mu - 1);
933 Real Psi = Phi * (A2 - A1 / rho);
934 sum += (n & 1) ? Psi : -Psi;
938 sum *= 0.5 * std::pow(rho, mu);
950template <std::
floating_po
int Real>
962 I = std::exp(I) / mu;
964 Real mum1 = mu - 1.0;
966 [x, log2x, mum1, aux](Real t) {
970 Real log2T = std::log(2 * t);
971 Real exponent = mum1 * log2T;
976 Real z = mum1 * (log2T - log2x);
977 Real log2F = 0.5 * z - t - x + logBessel;
980 return std::exp(log2F) - 2 * std::exp(exponent);
986template <std::
floating_po
int Real>
989 Real sinTheta = std::sin(theta);
990 Real theta_sinTheta = theta / sinTheta;
991 Real rho = std::hypot(theta_sinTheta, xi);
992 Real theta_sinThetapRho = theta_sinTheta + rho;
993 Real r = 0.5 * theta_sinThetapRho / y;
994 Real cosTheta = std::cos(theta);
995 Real psi = cosTheta * rho - sqrt1pXiSq;
996 Real frac = theta_sinThetapRho / (1.0 + sqrt1pXiSq);
997 psi -= std::log(frac);
998 Real numerator = (sinTheta - theta * cosTheta) / (sinTheta * rho);
999 numerator += cosTheta - r;
1001 Real denominator = r * r - 2.0 * r * cosTheta + 1.0;
1002 Real f = numerator / denominator;
1003 return std::exp(mu * psi) * f;
1006template <std::
floating_po
int Real>
1009 Real xi = 2.0 * sqrtX * sqrtY / mu;
1010 Real sqrt1pXiSq = std::sqrt(1.0 + xi * xi);
1011 Real yPrime = y / mu;
1012 Real s0 = 0.5 * (1.0 + sqrt1pXiSq) / yPrime;
1013 Real phi = x / s0 + y * s0 - std::log(s0) * mu;
1014 auto integrand = [=](Real theta) {
return MarcumQIntegrand(theta, xi, sqrt1pXiSq, mu, yPrime); };
1022template <std::
floating_po
int Real>
1023inline Real
MarcumP(std::type_identity_t<Real> mu, Real x, std::type_identity_t<Real> y,
1024 std::type_identity_t<Real> sqrtX, std::type_identity_t<Real> sqrtY, std::type_identity_t<Real> logX,
1025 std::type_identity_t<Real> logY)
1027 if (x < 0.0 || y <= 0.0)
1038 const Real saddle = Real{0.5} * (std::hypot(mu, 2 * sqrtX * sqrtY) - mu);
1039 if (std::isfinite(saddle) && std::max(x, saddle) < std::numeric_limits<int>::max() - 1)
1043 Real xi = 2 * sqrtX * sqrtY;
1044 if (xi > 30 && mu * mu < 2 * xi)
1047 Real temp = std::sqrt(4 * x + 2 * mu);
1048 Real f1 = x + mu - temp, f2 = x + mu + temp;
1049 if (y > f1 && y < f2)
1057 [mum1, logX, x](Real t) {
1061 return (mum1 == 0) ? Real{0.5} * std::exp(-x) : Real{0};
1063 Real z = 0.5 * mum1 * (std::log(t) - logX);
1065 return std::exp(logBesseli + z - h);
1070template <std::
floating_po
int Real>
1071inline Real
MarcumP(std::type_identity_t<Real> mu, Real x, std::type_identity_t<Real> y)
1073 Real sqrtX = std::sqrt(x), sqrtY = std::sqrt(y);
1074 Real logX = std::log(x), logY = std::log(y);
1075 return MarcumP(mu, x, y, sqrtX, sqrtY, logX, logY);
1078template <std::
floating_po
int Real>
1079inline Real
MarcumQ(std::type_identity_t<Real> mu, Real x, std::type_identity_t<Real> y,
1080 std::type_identity_t<Real> sqrtX, std::type_identity_t<Real> sqrtY, std::type_identity_t<Real> logX,
1081 std::type_identity_t<Real> logY)
1083 if (x < 0 || y <= 0)
1089 const Real saddle = Real{0.5} * (std::hypot(mu, 2 * sqrtX * sqrtY) - mu);
1090 if (!std::isfinite(saddle) || std::max(x, saddle) >= std::numeric_limits<int>::max() - 1)
1091 return 1 -
MarcumP(mu, x, y, sqrtX, sqrtY, logX, logY);
1094 if (x >= 30 && y < mu + x)
1099template <std::
floating_po
int Real>
1100inline Real
MarcumQ(std::type_identity_t<Real> mu, Real x, std::type_identity_t<Real> y)
1102 Real sqrtX = std::sqrt(x), sqrtY = std::sqrt(y);
1103 Real logX = std::log(x), logY = std::log(y);
1104 return MarcumQ(mu, x, y, sqrtX, sqrtY, logX, logY);
constexpr long double ln2
Definition constants.hpp:18
constexpr long double egamma
Definition constants.hpp:36
constexpr long double half_pi
Definition constants.hpp:23
constexpr long double sqrtpi
Definition constants.hpp:31
constexpr long double pi
Definition constants.hpp:22
constexpr long double two_inv_pi
Definition constants.hpp:25
constexpr long double pi_sq
Definition constants.hpp:39
constexpr long double sqrt2pi
Definition constants.hpp:32
constexpr long double inv_e
Definition constants.hpp:35
constexpr long double lnpi
Definition constants.hpp:21
Real standardNormal(G &g)
Ziggurat algorithm of Marsaglia and Tsang with 256 layers and an explicit sign bit.
Definition variates.hpp:45
Real MarcumQIntergralRepresentation(Real mu, Real x, Real y, Real sqrtX, Real sqrtY)
Definition functions.hpp:1007
Real erfinvChebyshevSeries(Real x, long double t, const long double *array, int size)
Definition functions.hpp:283
Real WLambert(Real x, Real w0, Real epsilon)
Definition functions.hpp:667
bool areClose(RealType a, RealType b, RealType eps=1e-6)
Definition functions.hpp:38
Real erfinvAux1(Real beta)
Definition functions.hpp:299
Real MarcumQIntegrand(Real theta, Real xi, Real sqrt1pXiSq, Real mu, Real y)
Definition functions.hpp:987
Real erfinvAux4(Real p)
Definition functions.hpp:415
Real MarcumPSeries(Real mu, Real x, Real y, Real logX, Real logY)
Definition functions.hpp:748
Real erfinvAux2(Real beta)
Definition functions.hpp:333
Real logHankelSeries(Real nu, Real x, int sign)
Definition functions.hpp:557
Real MarcumQSeries(Real mu, Real x, Real y, Real logX, Real logY)
Definition functions.hpp:808
Real erfinvAux3(Real beta)
Definition functions.hpp:379
Real MarcumPSaddleSeries(Real mu, Real x, Real y, Real logX, Real logY)
Σ e^{-x} x^n / n! P(μ + n, y), summed outwards from the dominant Poisson term.
Definition functions.hpp:854
Real MarcumPAsymptoticForLargeXY(Real mu, Real x, Real y, Real sqrtX, Real sqrtY)
Definition functions.hpp:905
Real MarcumPForMuSmallerThanOne(Real mu, Real x, Real y, Real logX, Real logY)
Definition functions.hpp:951
Real besselI(std::type_identity_t< Real > nu, Real x)
Definition special_functions.hpp:320
Real qgamma(std::type_identity_t< Real > a, Real x, std::type_identity_t< Real > logA, std::type_identity_t< Real > lgammaA)
Calculate upper regularized incomplete gamma function, accelerated by using precalculated values of l...
Definition math/gamma.hpp:938
Real erfinv(Real p)
Definition functions.hpp:464
Real log2mexp(Real x)
Definition functions.hpp:274
Real digamma(Real x)
Definition math/gamma.hpp:691
Real lfact(size_t n)
Calculate log(n!) using table values for small n <= 255 and built-in lgamma function for large n > 25...
Definition math/gamma.hpp:591
constexpr std::array< LongDoublePair, TABLE_SIZE > createZiggurat(const std::function< LongDoublePair(const LongDoublePair &)> &funPtr, LongDoublePair first, LongDoublePair second)
Real ldfact(size_t n)
ldoublefact
Definition math/gamma.hpp:639
int sign(Real x)
Definition functions.hpp:232
Real log1mexp(Real x)
Definition functions.hpp:260
Real erfcx(Real x)
Definition functions.hpp:525
Real harmonicNumber(Real exponent, int number)
Definition functions.hpp:533
Real lpgamma(std::type_identity_t< Real > a, Real x, std::type_identity_t< Real > logA, std::type_identity_t< Real > lgammaA)
Calculate logarithm of lower incomplete gamma function, accelerated by using precalculated value of l...
Definition math/gamma.hpp:875
Real W0Lambert(Real x, std::type_identity_t< Real > epsilon=Real{1e-11})
Definition functions.hpp:689
Real atan(Real x)
Definition functions.hpp:238
Real Wm1Lambert(Real x, std::type_identity_t< Real > epsilon=Real{1e-11})
Definition functions.hpp:722
Real softplus(Real x)
Definition functions.hpp:252
Real logBesselI(std::type_identity_t< Real > nu, Real x)
Calculates logarithm of modified Bessel function of the 1st kind.
Definition functions.hpp:577
Real trigamma(Real x)
Definition math/gamma.hpp:720
Real MarcumP(std::type_identity_t< Real > mu, Real x, std::type_identity_t< Real > y, std::type_identity_t< Real > sqrtX, std::type_identity_t< Real > sqrtY, std::type_identity_t< Real > logX, std::type_identity_t< Real > logY)
Definition functions.hpp:1023
Real MarcumQ(std::type_identity_t< Real > mu, Real x, std::type_identity_t< Real > y, std::type_identity_t< Real > sqrtX, std::type_identity_t< Real > sqrtY, std::type_identity_t< Real > logX, std::type_identity_t< Real > logY)
Definition functions.hpp:1079
Real xexpxsqerfc(Real x)
xexpxsqerfc
Definition functions.hpp:504
Real logBesselK(std::type_identity_t< Real > nu, Real x)
Calculates logarithm of modified Bessel function of the 2nd kind.
Definition functions.hpp:637
Real integrate(const F &f, std::type_identity_t< Real > a, std::type_identity_t< Real > b, std::type_identity_t< Real > tolerance=1e-11, int maxSubdivisions=512)
Global adaptive Gauss-Kronrod quadrature (QUADPACK QAG).
Definition quadrature.hpp:226
Real pgamma(std::type_identity_t< Real > a, Real x, std::type_identity_t< Real > logA, std::type_identity_t< Real > lgammaA)
Calculate lower regularized incomplete gamma function, accelerated by using precalculated value of lo...
Definition math/gamma.hpp:896
Real logexpm1l(Real x)
Definition functions.hpp:266
Real erfcinv(Real p)
Definition functions.hpp:485
Real besselK(std::type_identity_t< Real > nu, Real x)
Definition special_functions.hpp:330
Definition bivariate_normal.hpp:10
std::tuple< T, T, T > Triplet
Definition fwd.hpp:36
Pair< long double > LongDoublePair
Definition fwd.hpp:40