2
2
# using Drummond's sequence transformation
3
3
4
4
# ₀F₀(;z)
5
- function drummond0F0 ( z:: T ; kmax:: Int = 10_000 ) where T
5
+ function pFqdrummond ( :: Tuple{} , :: Tuple{} , z:: T ; kmax:: Int = 10_000 ) where T
6
6
if norm (z) < eps (real (T))
7
7
return one (T)
8
8
end
@@ -28,7 +28,8 @@ function drummond0F0(z::T; kmax::Int = 10_000) where T
28
28
end
29
29
30
30
# ₁F₀(α;z)
31
- function drummond1F0 (α:: T1 , z:: T2 ; kmax:: Int = 10_000 ) where {T1, T2}
31
+ function pFqdrummond (α:: Tuple{T1} , :: Tuple{} , z:: T2 ; kmax:: Int = 10_000 ) where {T1, T2}
32
+ α = α[1 ]
32
33
T = promote_type (T1, T2)
33
34
absα = abs (T (α))
34
35
if norm (z) < eps (real (T)) || norm (α) < eps (absα)
@@ -71,7 +72,8 @@ function drummond1F0(α::T1, z::T2; kmax::Int = 10_000) where {T1, T2}
71
72
end
72
73
73
74
# ₀F₁(β;z)
74
- function drummond0F1 (β:: T1 , z:: T2 ; kmax:: Int = 10_000 ) where {T1, T2}
75
+ function pFqdrummond (:: Tuple{} , β:: Tuple{T1} , z:: T2 ; kmax:: Int = 10_000 ) where {T1, T2}
76
+ β = β[1 ]
75
77
T = promote_type (T1, T2)
76
78
if norm (z) < eps (real (T))
77
79
return one (T)
@@ -101,8 +103,9 @@ function drummond0F1(β::T1, z::T2; kmax::Int = 10_000) where {T1, T2}
101
103
end
102
104
103
105
# ₂F₀(α,β;z)
104
- function drummond2F0 (α:: T1 , β:: T2 , z:: T3 ; kmax:: Int = 10_000 ) where {T1, T2, T3}
105
- T = promote_type (T1, T2, T3)
106
+ function pFqdrummond (α:: Tuple{T1, T1} , :: Tuple{} , z:: T2 ; kmax:: Int = 10_000 ) where {T1, T2}
107
+ (α, β) = α
108
+ T = promote_type (T1, T2)
106
109
absα = abs (T (α))
107
110
absβ = abs (T (β))
108
111
if norm (z) < eps (real (T)) || norm (α* β) < eps (absα* absβ)
@@ -144,7 +147,9 @@ function drummond2F0(α::T1, β::T2, z::T3; kmax::Int = 10_000) where {T1, T2, T
144
147
end
145
148
146
149
# ₁F₁(α,β;z)
147
- function drummond1F1 (α:: T1 , β:: T2 , z:: T3 ; kmax:: Int = 10_000 ) where {T1, T2, T3}
150
+ function pFqdrummond (α:: Tuple{T1} , β:: Tuple{T2} , z:: T3 ; kmax:: Int = 10_000 ) where {T1, T2, T3}
151
+ α = α[1 ]
152
+ β = β[1 ]
148
153
T = promote_type (T1, T2, T3)
149
154
absα = abs (T (α))
150
155
if norm (z) < eps (real (T)) || norm (α) < eps (absα)
@@ -195,8 +200,9 @@ function drummond1F1(α::T1, β::T2, z::T3; kmax::Int = 10_000) where {T1, T2, T
195
200
end
196
201
197
202
# ₀F₂(α,β;z)
198
- function drummond0F2 (α:: T1 , β:: T2 , z:: T3 ; kmax:: Int = 10_000 ) where {T1, T2, T3}
199
- T = promote_type (T1, T2, T3)
203
+ function pFqdrummond (:: Tuple{} , β:: Tuple{T1, T1} , z:: T2 ; kmax:: Int = 10_000 ) where {T1, T2}
204
+ (α, β) = β
205
+ T = promote_type (T1, T2)
200
206
if norm (z) < eps (real (T)) || norm (α) < eps (real (T)) || norm (β) < eps (real (T))
201
207
return one (T)
202
208
end
@@ -231,8 +237,10 @@ function drummond0F2(α::T1, β::T2, z::T3; kmax::Int = 10_000) where {T1, T2, T
231
237
end
232
238
233
239
# ₂F₁(α,β,γ;z)
234
- function drummond2F1 (α:: T1 , β:: T2 , γ:: T3 , z:: T4 ; kmax:: Int = 10_000 ) where {T1, T2, T3, T4}
235
- T = promote_type (T1, T2, T3, T4)
240
+ function pFqdrummond (α:: Tuple{T1, T1} , β:: Tuple{T2} , z:: T3 ; kmax:: Int = 10_000 ) where {T1, T2, T3}
241
+ γ = β[1 ]
242
+ (α, β) = α
243
+ T = promote_type (T1, T2, T3)
236
244
absα = abs (T (α))
237
245
absβ = abs (T (β))
238
246
if norm (z) < eps (real (T)) || norm (α* β) < eps (absα* absβ)
@@ -283,15 +291,21 @@ function drummond2F1(α::T1, β::T2, γ::T3, z::T4; kmax::Int = 10_000) where {T
283
291
end
284
292
285
293
# ₘFₙ(α;β;z)
286
- function pFqdrummond (α:: AbstractVector{T1} , β:: AbstractVector{T2} , z:: T3 ; kmax:: Int = 10_000 ) where {T1, T2, T3}
287
- T = promote_type (T1, T2, T3)
294
+ function pFqdrummond (α:: AbstractVector{T1} , β:: AbstractVector{T2} , z:: T3 ; kwds... ) where {T1, T2, T3}
295
+ pFqdrummond (Tuple (α), Tuple (β), z; kwds... )
296
+ end
297
+ function pFqdrummond (α:: NTuple{p, Any} , β:: NTuple{q, Any} , z; kwds... ) where {p, q}
298
+ T1 = mapreduce (typeof, promote_type, α)
299
+ T2 = mapreduce (typeof, promote_type, β)
300
+ pFqdrummond (T1 .(α), T2 .(β), z; kwds... )
301
+ end
302
+ function pFqdrummond (α:: NTuple{p, T1} , β:: NTuple{q, T2} , z:: T3 ; kmax:: Int = 10_000 ) where {p, q, T1, T2, T3}
303
+ T = promote_type (eltype (α), eltype (β), T3)
288
304
absα = abs .(T .(α))
289
305
if norm (z) < eps (real (T)) || norm (prod (α)) < eps (prod (absα))
290
306
return one (T)
291
307
end
292
308
ζ = inv (z)
293
- p = length (α)
294
- q = length (β)
295
309
r = max (p+ 1 , q+ 2 )
296
310
err = one (real (T))
297
311
for j in 1 : p
@@ -380,3 +394,11 @@ function pFqdrummond(α::AbstractVector{T1}, β::AbstractVector{T2}, z::T3; kmax
380
394
end
381
395
return isfinite (R[r+ 1 ]) ? R[r+ 1 ] : R[r]
382
396
end
397
+
398
+ @deprecate drummond0F0 (x; kwds... ) pFqdrummond ((), (), x; kwds... ) false
399
+ @deprecate drummond1F0 (α, x; kwds... ) pFqdrummond ((α, ), (), x; kwds... ) false
400
+ @deprecate drummond0F1 (β, x; kwds... ) pFqdrummond ((), (β, ), x; kwds... ) false
401
+ @deprecate drummond2F0 (α, β, x; kwds... ) pFqdrummond ((α, β), (), x; kwds... ) false
402
+ @deprecate drummond1F1 (α, β, x; kwds... ) pFqdrummond ((α, ), (β, ), x; kwds... ) false
403
+ @deprecate drummond0F2 (α, β, x; kwds... ) pFqdrummond ((), (α, β), x; kwds... ) false
404
+ @deprecate drummond2F1 (α, β, γ, x; kwds... ) pFqdrummond ((α, β), (γ, ), x; kwds... ) false
0 commit comments