Skip to content

Commit

Permalink
Use parametric type for region field (#119)
Browse files Browse the repository at this point in the history
This gives a concrete type to the `region` field in FFTWPlan structs.
  • Loading branch information
jipolanco authored May 11, 2020
1 parent 158c391 commit d5a74b9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/fft.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ end
abstract type FFTWPlan{T<:fftwNumber,K,inplace} <: Plan{T} end
for P in (:cFFTWPlan, :rFFTWPlan, :r2rFFTWPlan) # complex, r2c/c2r, and r2r
@eval begin
mutable struct $P{T<:fftwNumber,K,inplace,N} <: FFTWPlan{T,K,inplace}
mutable struct $P{T<:fftwNumber,K,inplace,N,G} <: FFTWPlan{T,K,inplace}
plan::PlanPtr
sz::NTuple{N,Int} # size of array on which plan operates (Int tuple)
osz::NTuple{N,Int} # size of output array (Int tuple)
Expand All @@ -235,16 +235,22 @@ for P in (:cFFTWPlan, :rFFTWPlan, :r2rFFTWPlan) # complex, r2c/c2r, and r2r
ialign::Int32 # alignment mod 16 of input
oalign::Int32 # alignment mod 16 of input
flags::UInt32 # planner flags
region::Any # region (iterable) of dims that are transormed
region::G # region (iterable) of dims that are transormed
pinv::ScaledPlan
function $P{T,K,inplace,N}(plan::PlanPtr, flags::Integer, R::Any,
X::StridedArray{T,N}, Y::StridedArray) where {T<:fftwNumber,K,inplace,N}
function $P{T,K,inplace,N,G}(plan::PlanPtr, flags::Integer, R::G,
X::StridedArray{T,N}, Y::StridedArray) where {T<:fftwNumber,K,inplace,N,G}
p = new(plan, size(X), size(Y), strides(X), strides(Y),
alignment_of(X), alignment_of(Y), flags, R)
finalizer(destroy_plan, p)
p
end
end

function $P{T,K,inplace,N}(plan::PlanPtr, flags::Integer, R::G,
X::StridedArray{T,N},
Y::StridedArray) where {T<:fftwNumber,K,inplace,N,G}
$P{T,K,inplace,N,G}(plan, flags, R, X, Y)
end
end
end

Expand Down

0 comments on commit d5a74b9

Please sign in to comment.