diff --git a/src/definitions.jl b/src/definitions.jl index a9c4e7f..b481a3a 100644 --- a/src/definitions.jl +++ b/src/definitions.jl @@ -271,8 +271,12 @@ summary(p::ScaledPlan) = string(p.scale, " * ", summary(p.p)) *(p::Plan, I::UniformScaling) = ScaledPlan(p, I.λ) # Normalization for ifft, given unscaled bfft, is 1/prod(dimensions) +# ensure that region is a subset of eachindex(sz). +_checkindex(sz, region::AbstractVector) = checkindex(Bool, sz, region) +# this method handles the case where region is not an array, e.g. it is a Tuple +_checkindex(sz, region) = all(r -> checkindex(Bool, eachindex(sz), r), region) function normalization(::Type{T}, sz, region) where T - @boundscheck !isempty(region) && checkindex(Bool, eachindex(sz), region) + @boundscheck !isempty(region) && _checkindex(eachindex(sz), region) one(T) / mapreduce(r -> Int(@inbounds sz[r])::Int, *, region; init=oneunit(eltype(sz)))::Int end normalization(X, region) = normalization(real(eltype(X)), size(X), region)