|
13 | 13 | function besselk_up_recurrence!(out, x::T, nu_range) where T
|
14 | 14 | x2 = 2 / x
|
15 | 15 | k = 3
|
16 |
| - for nu in nu_range[2:end-1] |
| 16 | + for nu in nu_range[begin+1:end-1] |
17 | 17 | out[k] = muladd(nu*x2, out[k-1], out[k-2])
|
18 | 18 | k += 1
|
19 | 19 | end
|
|
39 | 39 | function besselj_up_recurrence!(out, x::T, nu_range) where T
|
40 | 40 | x2 = 2 / x
|
41 | 41 | k = 3
|
42 |
| - for nu in nu_range[2:end-1] |
| 42 | + for nu in nu_range[begin+1:end-1] |
43 | 43 | out[k] = muladd(nu*x2, out[k-1], -out[k-2])
|
44 | 44 | k += 1
|
45 | 45 | end
|
|
62 | 62 | function besselj_down_recurrence!(out, x::T, nu_range) where T
|
63 | 63 | x2 = 2 / x
|
64 | 64 | k = length(nu_range) - 2
|
65 |
| - for nu in nu_range[end-1:-1:2] |
| 65 | + for nu in nu_range[end-1:-1:begin+1] |
66 | 66 | out[k] = muladd(nu*x2, out[k+1], -out[k+2])
|
67 | 67 | k -= 1
|
68 | 68 | end
|
69 | 69 | return out
|
70 | 70 | end
|
71 | 71 |
|
72 |
| -#= |
73 |
| -# currently not used |
74 | 72 | # backward recurrence relation for besselk and besseli
|
75 | 73 | # outputs both (bessel(x, nu_end), bessel(x, nu_end-1)
|
76 | 74 | # x = 0.1; k0 = besseli(10,x); k1 = besseli(11,x);
|
|
83 | 81 | end
|
84 | 82 | return jnup1, jnu
|
85 | 83 | end
|
86 |
| -=# |
| 84 | + |
87 | 85 | function besselk_down_recurrence!(out, x::T, nu_range) where T
|
88 | 86 | x2 = 2 / x
|
89 | 87 | k = length(nu_range) - 2
|
90 |
| - for nu in nu_range[end-1:-1:2] |
| 88 | + for nu in nu_range[end-1:-1:begin+1] |
91 | 89 | out[k] = muladd(nu*x2, out[k+1], out[k+2])
|
92 | 90 | k -= 1
|
93 | 91 | end
|
|
0 commit comments