43 {
44 auto var = sigma * sigma;
45
46
47
48
49
50
51 auto besselI_0 = [](double t) -> double {
52 auto tSquaredOver4 = t * t / 4.0;
53 auto sum = 1.0;
54 auto factor = 1.0;
55 auto k = 1;
56
57
58 while(factor > 1.0/1000000.0) {
59 factor *= tSquaredOver4 / (k * k);
60 sum += factor;
61 k += 1;
62 }
63 return sum;
64 };
65
66 auto besselI_1 = [](double t) -> double {
67 auto tSquaredOver4 = t * t / 4.0;
68 auto sum = t / 2.0;
69 auto factor = sum;
70 auto k = 1;
71 while (factor > 1.0/1000000.0) {
72 factor *= tSquaredOver4 / (k * (k + 1));
73 sum += factor;
74 k += 1;
75 }
76 return sum;
77 };
78
79
80
81
82 auto d = std::exp(var);
86
87
88
89
90
91 int n = 1;
92
93
95 b[n+1] = -(2*n/var) *
b[n] +
b[n-1];
96 gauss[n+1] =
b[n+1] /
d;
97 n += 1;
98 }
99
101
102 return n;
103}
static void normalize(int n, double *gauss)
static constexpr double kGoodEnough
static constexpr int kGaussArrayMax
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d