Skip to content

Commit 7e82207

Browse files
centralize kmax constant, extend it to 1e6
1 parent 1db8f56 commit 7e82207

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "HypergeometricFunctions"
22
uuid = "34004b35-14d8-5ef3-9330-4cdb6864b03a"
3-
version = "0.3.14"
3+
version = "0.3.15"
44

55
[deps]
66
DualNumbers = "fa6b7ba4-c1ee-5f82-b5fc-ecf0adba8f74"

src/HypergeometricFunctions.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ using DualNumbers, LinearAlgebra, SpecialFunctions
99

1010
export _₁F₁, _₂F₁, _₃F₂, pFq
1111

12+
const KMAX = 1_000_000
13+
1214
include("specialfunctions.jl")
1315
include("gauss.jl")
1416
include("confluent.jl")

src/drummond.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# using Drummond's sequence transformation
33

44
# ₀F₀(;z)
5-
function pFqdrummond(::Tuple{}, ::Tuple{}, z::T; kmax::Int = 10_000) where T
5+
function pFqdrummond(::Tuple{}, ::Tuple{}, z::T; kmax::Int = KMAX) where T
66
if norm(z) < eps(real(T))
77
return one(T)
88
end
@@ -28,7 +28,7 @@ function pFqdrummond(::Tuple{}, ::Tuple{}, z::T; kmax::Int = 10_000) where T
2828
end
2929

3030
# ₁F₀(α;z)
31-
function pFqdrummond::Tuple{T1}, ::Tuple{}, z::T2; kmax::Int = 10_000) where {T1, T2}
31+
function pFqdrummond::Tuple{T1}, ::Tuple{}, z::T2; kmax::Int = KMAX) where {T1, T2}
3232
α = α[1]
3333
T = promote_type(T1, T2)
3434
absα = abs(T(α))
@@ -72,7 +72,7 @@ function pFqdrummond(α::Tuple{T1}, ::Tuple{}, z::T2; kmax::Int = 10_000) where
7272
end
7373

7474
# ₀F₁(β;z)
75-
function pFqdrummond(::Tuple{}, β::Tuple{T1}, z::T2; kmax::Int = 10_000) where {T1, T2}
75+
function pFqdrummond(::Tuple{}, β::Tuple{T1}, z::T2; kmax::Int = KMAX) where {T1, T2}
7676
β = β[1]
7777
T = promote_type(T1, T2)
7878
if norm(z) < eps(real(T))
@@ -103,7 +103,7 @@ function pFqdrummond(::Tuple{}, β::Tuple{T1}, z::T2; kmax::Int = 10_000) where
103103
end
104104

105105
# ₂F₀(α,β;z)
106-
function pFqdrummond::Tuple{T1, T1}, ::Tuple{}, z::T2; kmax::Int = 10_000) where {T1, T2}
106+
function pFqdrummond::Tuple{T1, T1}, ::Tuple{}, z::T2; kmax::Int = KMAX) where {T1, T2}
107107
(α, β) = α
108108
T = promote_type(T1, T2)
109109
absα = abs(T(α))
@@ -147,7 +147,7 @@ function pFqdrummond(α::Tuple{T1, T1}, ::Tuple{}, z::T2; kmax::Int = 10_000) wh
147147
end
148148

149149
# ₁F₁(α,β;z)
150-
function pFqdrummond::Tuple{T1}, β::Tuple{T2}, z::T3; kmax::Int = 10_000) where {T1, T2, T3}
150+
function pFqdrummond::Tuple{T1}, β::Tuple{T2}, z::T3; kmax::Int = KMAX) where {T1, T2, T3}
151151
α = α[1]
152152
β = β[1]
153153
T = promote_type(T1, T2, T3)
@@ -200,7 +200,7 @@ function pFqdrummond(α::Tuple{T1}, β::Tuple{T2}, z::T3; kmax::Int = 10_000) wh
200200
end
201201

202202
# ₀F₂(α,β;z)
203-
function pFqdrummond(::Tuple{}, β::Tuple{T1, T1}, z::T2; kmax::Int = 10_000) where {T1, T2}
203+
function pFqdrummond(::Tuple{}, β::Tuple{T1, T1}, z::T2; kmax::Int = KMAX) where {T1, T2}
204204
(α, β) = β
205205
T = promote_type(T1, T2)
206206
if norm(z) < eps(real(T)) || norm(α) < eps(real(T)) || norm(β) < eps(real(T))
@@ -237,7 +237,7 @@ function pFqdrummond(::Tuple{}, β::Tuple{T1, T1}, z::T2; kmax::Int = 10_000) wh
237237
end
238238

239239
# ₂F₁(α,β,γ;z)
240-
function pFqdrummond::Tuple{T1, T1}, β::Tuple{T2}, z::T3; kmax::Int = 10_000) where {T1, T2, T3}
240+
function pFqdrummond::Tuple{T1, T1}, β::Tuple{T2}, z::T3; kmax::Int = KMAX) where {T1, T2, T3}
241241
γ = β[1]
242242
(α, β) = α
243243
T = promote_type(T1, T2, T3)
@@ -299,7 +299,7 @@ function pFqdrummond(α::NTuple{p, Any}, β::NTuple{q, Any}, z; kwds...) where {
299299
T2 = isempty(β) ? Any : mapreduce(typeof, promote_type, β)
300300
pFqdrummond(T1.(α), T2.(β), z; kwds...)
301301
end
302-
function pFqdrummond::NTuple{p, T1}, β::NTuple{q, T2}, z::T3; kmax::Int = 10_000) where {p, q, T1, T2, T3}
302+
function pFqdrummond::NTuple{p, T1}, β::NTuple{q, T2}, z::T3; kmax::Int = KMAX) where {p, q, T1, T2, T3}
303303
T = promote_type(eltype(α), eltype(β), T3)
304304
absα = abs.(T.(α))
305305
if norm(z) < eps(real(T)) || norm(prod(α)) < eps(prod(absα))

src/weniger.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# using Weniger's sequence transformation
33

44
# ₀F₀(;z), γ = 2.
5-
function pFqweniger(::Tuple{}, ::Tuple{}, z::T; kmax::Int = 10_000) where T
5+
function pFqweniger(::Tuple{}, ::Tuple{}, z::T; kmax::Int = KMAX) where T
66
if norm(z) < eps(real(T))
77
return one(T)
88
end
@@ -24,7 +24,7 @@ function pFqweniger(::Tuple{}, ::Tuple{}, z::T; kmax::Int = 10_000) where T
2424
end
2525

2626
# ₁F₀(α;z), γ = 2.
27-
function pFqweniger::Tuple{T1}, ::Tuple{}, z::T2; kmax::Int = 10_000) where {T1, T2}
27+
function pFqweniger::Tuple{T1}, ::Tuple{}, z::T2; kmax::Int = KMAX) where {T1, T2}
2828
α = α[1]
2929
T = promote_type(T1, T2)
3030
absα = abs(T(α))
@@ -59,7 +59,7 @@ function pFqweniger(α::Tuple{T1}, ::Tuple{}, z::T2; kmax::Int = 10_000) where {
5959
end
6060

6161
# ₂F₀(α,β;z), algorithm γ = 2.
62-
function pFqweniger::Tuple{T1, T1}, ::Tuple{}, z::T2; kmax::Int = 10_000) where {T1, T2}
62+
function pFqweniger::Tuple{T1, T1}, ::Tuple{}, z::T2; kmax::Int = KMAX) where {T1, T2}
6363
(α, β) = α
6464
T = promote_type(T1, T2)
6565
absα = abs(T(α))
@@ -118,7 +118,7 @@ function pFqweniger(α::Tuple{T1, T1}, ::Tuple{}, z::T2; kmax::Int = 10_000) whe
118118
end
119119

120120
# ₂F₁(α,β,γ;z), algorithm γ = 2.
121-
function pFqweniger::Tuple{T1, T1}, β::Tuple{T2}, z::T3; kmax::Int = 10_000) where {T1, T2, T3}
121+
function pFqweniger::Tuple{T1, T1}, β::Tuple{T2}, z::T3; kmax::Int = KMAX) where {T1, T2, T3}
122122
γ = β[1]
123123
(α, β) = α
124124
T = promote_type(T1, T2, T3)
@@ -192,7 +192,7 @@ function pFqweniger(α::NTuple{p, Any}, β::NTuple{q, Any}, z; kwds...) where {p
192192
T2 = isempty(β) ? Any : mapreduce(typeof, promote_type, β)
193193
pFqweniger(T1.(α), T2.(β), z; kwds...)
194194
end
195-
function pFqweniger::NTuple{p, T1}, β::NTuple{q, T2}, z::T3; kmax::Int = 10_000) where {p, q, T1, T2, T3}
195+
function pFqweniger::NTuple{p, T1}, β::NTuple{q, T2}, z::T3; kmax::Int = KMAX) where {p, q, T1, T2, T3}
196196
T = promote_type(eltype(α), eltype(β), T3)
197197
absα = abs.(T.(α))
198198
if norm(z) < eps(real(T)) || norm(prod(α)) < eps(real(T)(prod(absα)))

0 commit comments

Comments
 (0)