@@ -169,6 +169,19 @@ function create_plan(trajectory, image_size, threaded; kwargs...)
169169 end
170170end
171171
172+ # Helper to create matched forward/backward FFT plans so that JET can track
173+ # that both plans have the same element type T and dimension D.
174+ struct _MatchedFFTPlans{T, D}
175+ forward:: FFTW.cFFTWPlan{Complex{T}, -1, true, D, UnitRange{Int64}}
176+ backward:: FFTW.cFFTWPlan{Complex{T}, 1, true, D, UnitRange{Int64}}
177+ end
178+
179+ function _make_matched_fft_plans (tmpVec:: Array{Complex{T}, D} , dims_; kwargs... ) where {T, D}
180+ FP = FFTW. plan_fft! (tmpVec, dims_; kwargs... ):: FFTW.cFFTWPlan{Complex{T}, -1, true, D, UnitRange{Int64}}
181+ BP = FFTW. plan_bfft! (tmpVec, dims_; kwargs... ):: FFTW.cFFTWPlan{Complex{T}, 1, true, D, UnitRange{Int64}}
182+ return _MatchedFFTPlans {T, D} (FP, BP)
183+ end
184+
172185function NFFTPlan (
173186 k:: Matrix{T} ,
174187 N:: NTuple{D, Int} ;
@@ -187,8 +200,9 @@ function NFFTPlan(
187200 tmpVec = Array {Complex{T}, D} (undef, Ñ)
188201
189202 fftflags_ = (fftflags != = nothing ) ? (flags = fftflags,) : NamedTuple ()
190- FP = FFTW. plan_fft! (tmpVec, dims_; num_threads = FFTW. get_num_threads (), fftflags_... )
191- BP = FFTW. plan_bfft! (tmpVec, dims_; num_threads = FFTW. get_num_threads (), fftflags_... )
203+ plans = _make_matched_fft_plans (tmpVec, dims_; num_threads = FFTW. get_num_threads (), fftflags_... )
204+ FP = plans. forward
205+ BP = plans. backward
192206
193207 calcBlocks =
194208 (
0 commit comments