13 #ifndef QMCPLUSPLUS_NEW_BESSEL_H 14 #define QMCPLUSPLUS_NEW_BESSEL_H 28 throw std::runtime_error(
"Negative lmax not allowed!");
30 throw std::runtime_error(
"Negative x not allowed!");
33 std::fill(jl, jl + lmax + 1, T(0.0));
39 double inv_accumuated =
cone;
41 for (
int l = 0; l <= lmax; l++)
43 jl[l] = x_l * inv_accumuated;
44 const double inv =
cone / (2 * l + 3);
45 jl[l] *=
cone - 0.5 * x * x *
inv;
46 inv_accumuated *=
inv;
57 double FP((lmax + 1) * XI);
58 double B(FP * ctwo + XI);
67 DEL *= (
B * D -
cone);
71 }
while (std::fabs(DEL) >= std::fabs(FP) * 1.19209e-07);
78 double PL = lmax * XI;
80 for (
int L = lmax; L >= 1; L--)
82 jl[L - 1] = PL * jl[L] + FP;
83 FP = PL * jl[L - 1] - jl[L];
90 W = XI / std::hypot(FP, F);
91 for (
int L = 0; L <= lmax; L++)
helper functions for EinsplineSetBuilder
constexpr std::complex< float > cone
void inv(const T *restrict in, T *restrict out, int n)
double B(double x, int k, int i, const std::vector< double > &t)
void bessel_steed_array_cpu(const int lmax, const T x, T *jl)
Compute spherical bessel function from 0 to lmax.