LIBINT
2.1.0-stable
|
Computes the Boys function, , using single algorithm (asymptotic expansion).
More...
#include <boys.h>
Static Public Member Functions | |
static Real | eval (Real T, size_t m, Real absolute_precision) |
computes a single value of ![]() | |
static void | eval (Real *Fm, Real T, size_t mmax, Real absolute_precision) |
fills up an array of Fm(T) for m in [0,mmax] More... | |
Computes the Boys function, , using single algorithm (asymptotic expansion).
Slow for the sake of precision control. Useful in two cases:
Real
supports high/arbitrary precision, and Real
is a low-precision floating-point type. N.B. FmEval_Reference2 , which can compute for all practical values of Real
types (double
and float
). Real
is exhausted. It is important that std::numeric_limits<Real>
is defined appropriately.Real | the type to use for all floating-point computations. Must be able to compute logarithm and exponential, i.e. log(x) and exp(x), where x is Real, must be valid expressions. |
|
inlinestatic |
fills up an array of Fm(T) for m in [0,mmax]
[out] | Fm | array to be filled in with the Boys function values, must be at least mmax+1 elements long |
[in] | T | the Boys function argument |
[in] | mmax | the maximum value of m for which Boys function will be computed; |
[in] | absolute_precision | the absolute precision to which to compute the result |
downward recursion does not maintain absolute precision, only relative precision, and cannot be used for T > 10 if (mmax > 0) { const Real T2 = 2.0 * T; const Real exp_T = exp(-T); for (int m = mmax - 1; m >= 0; m–) Fm[m] = (Fm[m + 1] * T2 + exp_T) / (2 * m + 1); }