Skip to content

Commit db3f780

Browse files
committed
fix recurrence bounds and rebase
1 parent ded98d1 commit db3f780

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/recurrence.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ end
1313
function besselk_up_recurrence!(out, x::T, nu_range) where T
1414
x2 = 2 / x
1515
k = 3
16-
for nu in nu_range[2:end-1]
16+
for nu in nu_range[begin+1:end-1]
1717
out[k] = muladd(nu*x2, out[k-1], out[k-2])
1818
k += 1
1919
end
@@ -39,7 +39,7 @@ end
3939
function besselj_up_recurrence!(out, x::T, nu_range) where T
4040
x2 = 2 / x
4141
k = 3
42-
for nu in nu_range[2:end-1]
42+
for nu in nu_range[begin+1:end-1]
4343
out[k] = muladd(nu*x2, out[k-1], -out[k-2])
4444
k += 1
4545
end
@@ -62,15 +62,13 @@ end
6262
function besselj_down_recurrence!(out, x::T, nu_range) where T
6363
x2 = 2 / x
6464
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]
6666
out[k] = muladd(nu*x2, out[k+1], -out[k+2])
6767
k -= 1
6868
end
6969
return out
7070
end
7171

72-
#=
73-
# currently not used
7472
# backward recurrence relation for besselk and besseli
7573
# outputs both (bessel(x, nu_end), bessel(x, nu_end-1)
7674
# x = 0.1; k0 = besseli(10,x); k1 = besseli(11,x);
@@ -83,11 +81,11 @@ end
8381
end
8482
return jnup1, jnu
8583
end
86-
=#
84+
8785
function besselk_down_recurrence!(out, x::T, nu_range) where T
8886
x2 = 2 / x
8987
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]
9189
out[k] = muladd(nu*x2, out[k+1], out[k+2])
9290
k -= 1
9391
end

0 commit comments

Comments
 (0)