@@ -4,6 +4,10 @@ using LinearAlgebra
44using  AbstractFFTs
55using  AbstractFFTs:  Plan
66
7+ struct  TestBackend <:  AbstractFFTBackend  end 
8+ backend () =  TestBackend ()
9+ activate! () =  AbstractFFTs. set_active_backend! (TestPlans)
10+ 
711mutable struct  TestPlan{T,N,G} <:  Plan{T} 
812    region:: G 
913    sz:: NTuple{N,Int} 
@@ -30,10 +34,10 @@ Base.ndims(::InverseTestPlan{T,N}) where {T,N} = N
3034AbstractFFTs. AdjointStyle (:: TestPlan ) =  AbstractFFTs. FFTAdjointStyle ()
3135AbstractFFTs. AdjointStyle (:: InverseTestPlan ) =  AbstractFFTs. FFTAdjointStyle ()
3236
33- function  AbstractFFTs. plan_fft (x:: AbstractArray{T} , region; kwargs... ) where  {T}
37+ function  AbstractFFTs. plan_fft (:: TestBackend ,  x:: AbstractArray{T} , region; kwargs... ) where  {T  <:   Complex }
3438    return  TestPlan {T} (region, size (x))
3539end 
36- function  AbstractFFTs. plan_bfft (x:: AbstractArray{T} , region; kwargs... ) where  {T}
40+ function  AbstractFFTs. plan_bfft (:: TestBackend ,  x:: AbstractArray{T} , region; kwargs... ) where  {T  <:   Complex }
3741    return  InverseTestPlan {T} (region, size (x))
3842end 
3943
@@ -119,10 +123,10 @@ end
119123AbstractFFTs. AdjointStyle (:: TestRPlan ) =  AbstractFFTs. RFFTAdjointStyle ()
120124AbstractFFTs. AdjointStyle (p:: InverseTestRPlan ) =  AbstractFFTs. IRFFTAdjointStyle (p. d)
121125
122- function  AbstractFFTs. plan_rfft (x:: AbstractArray{T} , region; kwargs... ) where  {T<: Real }
126+ function  AbstractFFTs. plan_rfft (:: TestBackend ,  x:: AbstractArray{T} , region; kwargs... ) where  {T<: Real }
123127    return  TestRPlan {T} (region, size (x))
124128end 
125- function  AbstractFFTs. plan_brfft (x:: AbstractArray{Complex{T}} , d, region; kwargs... ) where  {T}
129+ function  AbstractFFTs. plan_brfft (:: TestBackend ,  x:: AbstractArray{Complex{T}} , d, region; kwargs... ) where  {T}
126130    return  InverseTestRPlan {T} (d, region, size (x))
127131end 
128132function  AbstractFFTs. plan_inv (p:: TestRPlan{T,N} ) where  {T,N}
@@ -265,10 +269,10 @@ Base.ndims(p::InplaceTestPlan) = ndims(p.plan)
265269AbstractFFTs. fftdims (p:: InplaceTestPlan ) =  fftdims (p. plan)
266270AbstractFFTs. AdjointStyle (p:: InplaceTestPlan ) =  AbstractFFTs. AdjointStyle (p. plan)
267271
268- function  AbstractFFTs. plan_fft! (x:: AbstractArray , region; kwargs... )
272+ function  AbstractFFTs. plan_fft! (:: TestBackend ,  x:: AbstractArray , region; kwargs... )
269273    return  InplaceTestPlan (plan_fft (x, region; kwargs... ))
270274end 
271- function  AbstractFFTs. plan_bfft! (x:: AbstractArray , region; kwargs... )
275+ function  AbstractFFTs. plan_bfft! (:: TestBackend ,  x:: AbstractArray , region; kwargs... )
272276    return  InplaceTestPlan (plan_bfft (x, region; kwargs... ))
273277end 
274278
0 commit comments