Skip to content

Commit d090b51

Browse files
committed
Re-order functions in file for readability.
1 parent 1273fcd commit d090b51

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

src/modifiedsphericalbessel.jl

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11

2+
"""
3+
sphericalbesselk(nu, x::T) where T <: {Float32, Float64}
4+
5+
Computes `k_{ν}(x)`, the modified second-kind spherical Bessel function, and offers special branches for integer orders.
6+
"""
7+
sphericalbesselk(nu, x) = _sphericalbesselk(nu, float(x))
8+
9+
function _sphericalbesselk(nu, x::T) where T
10+
if isinteger(nu) && nu < 41.5
11+
return sphericalbesselk_int(nu, x)
12+
else
13+
return inv(SQRT_PID2(T)*sqrt(x))*besselk(nu+1/2, x)
14+
end
15+
end
16+
217
function sphericalbesselk_int(v::Int, x)
318
b0 = inv(x)
419
b1 = (x+one(x))/(x*x)
@@ -12,21 +27,3 @@ function sphericalbesselk_int(v::Int, x)
1227
exp(-x)*b1
1328
end
1429

15-
function _sphericalbesselk(nu, x::T) where T
16-
if isinteger(nu) && nu < 41.5
17-
return sphericalbesselk_int(nu, x)
18-
else
19-
return inv(SQRT_PID2(T)*sqrt(x))*besselk(nu+1/2, x)
20-
end
21-
end
22-
23-
24-
"""
25-
sphericalbesselk(nu, x::T) where T <: {Float32, Float64}
26-
27-
Computes `k_{ν}(x)`, the modified second-kind spherical Bessel function, and offers special branches for integer orders.
28-
"""
29-
sphericalbesselk(nu, x) = _sphericalbesselk(nu, float(x))
30-
31-
32-

0 commit comments

Comments
 (0)