Skip to content

Commit 23f04cf

Browse files
committed
Try fixing "user-facing"/default plan for real/complex integer|rationals ambig.
1 parent be75369 commit 23f04cf

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/definitions.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,11 @@ bfft!
260260
for f in (:fft, :bfft, :ifft)
261261
pf = Symbol("plan_", f)
262262
@eval begin
263+
$f(x::AbstractArray{<:Real}, region) = $f(complexfloat(x), region)
264+
$pf(x::AbstractArray{<:Real}, region; kws...) = $pf(complexfloat(x), region; kws...)
265+
$f(x::AbstractArray{<:Complex{<:Union{Integer,Rational}}}, region) = $f(complexfloat(x), region)
266+
$pf(x::AbstractArray{<:Complex{<:Union{Integer,Rational}}}, region; kws...) = $pf(complexfloat(x), region; kws...)
267+
# These methods run into ambig. if a backend does not specialise T further
263268
$f(b::AbstractFFTBackend, x::AbstractArray{<:Real}, region) = $f(b, complexfloat(x), region)
264269
$pf(b::AbstractFFTBackend, x::AbstractArray{<:Real}, region; kws...) = $pf(b, complexfloat(x), region; kws...)
265270
$f(b::AbstractFFTBackend, x::AbstractArray{<:Complex{<:Union{Integer,Rational}}}, region) = $f(b, complexfloat(x), region)

test/TestPlans.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ Base.ndims(::InverseTestPlan{T,N}) where {T,N} = N
3434
AbstractFFTs.AdjointStyle(::TestPlan) = AbstractFFTs.FFTAdjointStyle()
3535
AbstractFFTs.AdjointStyle(::InverseTestPlan) = AbstractFFTs.FFTAdjointStyle()
3636

37-
function AbstractFFTs.plan_fft(::TestBackend, x::AbstractArray{T}, region; kwargs...) where {T <: Complex}
37+
function AbstractFFTs.plan_fft(::TestBackend, x::AbstractArray{T}, region; kwargs...) where {T}
3838
return TestPlan{T}(region, size(x))
3939
end
40-
function AbstractFFTs.plan_bfft(::TestBackend, x::AbstractArray{T}, region; kwargs...) where {T <: Complex}
40+
function AbstractFFTs.plan_bfft(::TestBackend, x::AbstractArray{T}, region; kwargs...) where {T}
4141
return InverseTestPlan{T}(region, size(x))
4242
end
4343

0 commit comments

Comments
 (0)