Skip to content

Commit 62ab647

Browse files
committed
fix errors add docs
1 parent a2243de commit 62ab647

File tree

9 files changed

+21
-8
lines changed

9 files changed

+21
-8
lines changed

NEWS.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ For bug fixes, performance enhancements, or fixes to unexported functions we wil
1010

1111
# Unreleased
1212

13+
# Version 0.2.8
14+
1315
### Added
1416
- Add support for complex numbers in `besseli0`, `besseli1`, `besselj0`, `besselj1` ([PR #68](https://github.com/JuliaMath/Bessels.jl/pull/68))
17+
- Add separate documentation page with API ([PR #69](https://github.com/JuliaMath/Bessels.jl/pull/69)). This currently fails to build see ([Issue #70](https://github.com/JuliaMath/Bessels.jl/issues/70))
18+
19+
### Fixed
20+
- Fixed wrong return when iterating over a range of `nu` values when `length(nu) == 2` ([PR #71](https://github.com/JuliaMath/Bessels.jl/pull/71))
1521

1622
# Version 0.2.7
1723

@@ -34,7 +40,7 @@ For bug fixes, performance enhancements, or fixes to unexported functions we wil
3440
# Version 0.2.5
3541

3642
### Fixed
37-
- Fix bug for very large inputs (x>1e16) in besselj0 and friends routines. A particularly thank you to @jwscook for reporting the bug in ([Issue #53](https://github.com/JuliaMath/Bessels.jl/pull/56)) and providing a very detailed analysis.
43+
- Fix bug for very large inputs (x>1e16) in besselj0 and friends routines. A particularly thank you to @jwscook for reporting the bug in ([Issue #56](https://github.com/JuliaMath/Bessels.jl/issues/56)) and providing a very detailed analysis.
3844

3945

4046
# Version 0.2.4

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Bessels"
22
uuid = "0e736298-9ec6-45e8-9647-e4fc86a2fe38"
33
authors = ["Michael Helton <[email protected]> and contributors"]
4-
version = "0.2.7"
4+
version = "0.2.8"
55

66
[compat]
77
julia = "1.6"

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Numerical routines for computing Bessel, Airy, and Hankel functions for real arg
1111

1212
The goal of the library is to provide high quality numerical implementations of Bessel functions with high accuracy without comprimising on computational time. In general, we try to match (and often exceed) the accuracy of other open source routines such as those provided by [SpecialFunctions.jl](https://github.com/JuliaMath/SpecialFunctions.jl). There are instances where we don't quite match that desired accuracy (within a digit or two) but in general will provide implementations that are 5-10x faster (see [benchmarks](https://github.com/JuliaMath/Bessels.jl#benchmarks)).
1313

14-
The library currently supports Bessel functions, modified Bessel functions, Hankel functions, spherical Bessel functions, and Airy functions of the first and second kind for positive real arguments and integer and noninteger orders. Negative arguments are also supported only if the return value is real. We plan to support complex arguments in the future. An unexported gamma function is also provided.
14+
The library currently supports Bessel functions, modified Bessel functions, Hankel functions, spherical Bessel functions, and Airy functions of the first and second kind for positive real arguments and integer and noninteger orders. Negative arguments are also supported only if the return value is real. [Limited support](https://github.com/JuliaMath/Bessels.jl#complex-numbers) is provided for complex arguments. An unexported gamma function is also provided.
1515

1616
# Quick start
1717

@@ -152,6 +152,10 @@ a = zeros(10)
152152
out = Bessels.besselj!(a, 1:10, 1.0)
153153
```
154154

155+
### Complex numbers
156+
157+
Support for complex numbers is only provided for the Airy functions (`airyai`, `airyaiprime`, `airybi`, `airybiprime`) and the Bessel functions of the first kind with orders 0 and 1 (`besselj0`, `besselj1`, `besseli0`, `besseli1`).
158+
155159
### Support for negative arguments
156160

157161
Support is provided for negative arguments and orders only if the return value is real. A domain error will be thrown if the return value is complex. See https://github.com/heltonmc/Bessels.jl/issues/30 for more details.

src/besseli.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function besseli0x(x::T) where T <: Union{Float32, Float64}
9090
end
9191

9292
"""
93-
besseli1(x::T) where T <: Union{Float32, Float64}
93+
besseli1(x::T) where T <: Union{Float32, Float64, ComplexF32, ComplexF64}
9494
9595
Modified Bessel function of the first kind of order one, ``I_1(x)``.
9696
@@ -489,7 +489,7 @@ function _besseli!(out::DenseVector{T}, nu::AbstractRange, x::T) where T
489489
k -= 1
490490
k < 1 && break
491491
end
492-
if k > 1
492+
if k >= 1
493493
out[k] = _besseli(nu[k], x)
494494
tmp = @view out[begin:k+1]
495495
besselk_down_recurrence!(tmp, x, nu[begin:k+1])

src/besselj.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function _besselj0(x::Float32)
102102
end
103103

104104
"""
105-
besselj1(x::T) where T <: Union{Float32, Float64}
105+
besselj1(x::T) where T <: Union{Float32, Float64, ComplexF32, ComplexF64}
106106
107107
Bessel function of the first kind of order one, ``J_1(x)``.
108108
@@ -358,7 +358,7 @@ function _besselj!(out::DenseVector{T}, nu::AbstractVector, x::T) where T <: Uni
358358
k -= 1
359359
k < 1 && break
360360
end
361-
if k > 1
361+
if k >= 1
362362
out[k] = _besselj(nu[k], x)
363363
tmp = @view out[begin:k+1]
364364
besselj_down_recurrence!(tmp, x, nu[begin:k+1])

src/besselk.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ function _besselk!(out::DenseVector{T}, nu::AbstractRange, x::T) where T
297297
k += 1
298298
k == len && break
299299
end
300-
if k < len
300+
if k <= len
301301
out[k] = _besselk(nu[k], x)
302302
tmp = @view out[k-1:end]
303303
besselk_up_recurrence!(tmp, x, nu[k-1:end])

test/besseli_test.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ end
118118
# test nu_range
119119
@test besseli(0:250, 2.0) SpecialFunctions.besseli.(0:250, 2.0) rtol=1e-13
120120
@test besseli(0.5:1:10.5, 2.0) SpecialFunctions.besseli.(0.5:1:10.5, 2.0) rtol=1e-13
121+
@test besseli(3:4, 1.2) SpecialFunctions.besseli.(3:4, 1.2)
121122
@test Bessels.besseli!(zeros(Float64, 10), 1:10, 1.0) besseli(1:10, 1.0)
122123

123124
### need to fix method ambiguities for other functions ######

test/besselj_test.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ end
134134
@test besselj(0:95, 100.0) SpecialFunctions.besselj.(0:95, 100.0) rtol=1e-11
135135
@test besselj(0.5:1:150.5, 2.0) SpecialFunctions.besselj.(0.5:1:150.5, 2.0) rtol=1e-11
136136
@test besselj(0.5:1:10.5, 40.0) SpecialFunctions.besselj.(0.5:1:10.5, 40.0) rtol=1e-11
137+
@test besselj(3:4, 1.2) SpecialFunctions.besselj.(3:4, 1.2)
137138
@test Bessels.besselj!(zeros(Float64, 10), 1:10, 1.0) besselj(1:10, 1.0)
138139

139140
# test Float16 and Float32

test/besselk_test.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ end
130130
@test besselk(0:50, 2.0) SpecialFunctions.besselk.(0:50, 2.0) rtol=1e-13
131131
@test besselk(0.5:1:10.5, 12.0) SpecialFunctions.besselk.(0.5:1:10.5, 12.0) rtol=1e-13
132132
@test besselk(1:700, 800.0) SpecialFunctions.besselk.(1:700, 800.0)
133+
@test besselk(3:4, 1.2) SpecialFunctions.besselk.(3:4, 1.2)
133134
@test Bessels.besselk!(zeros(Float64, 10), 1:10, 1.0) besselk(1:10, 1.0)
134135

135136
# test Float16

0 commit comments

Comments
 (0)