@@ -256,7 +256,7 @@ summary(p::ScaledPlan) = string(p.scale, " * ", summary(p.p))
256
256
* (p:: Plan , I:: UniformScaling ) = ScaledPlan (p, I. λ)
257
257
258
258
# Normalization for ifft, given unscaled bfft, is 1/prod(dimensions)
259
- normalization (T , sz, region) = one (T) / Int (prod ([sz... ][[region... ]])):: Int
259
+ normalization (:: Type{T} , sz, region) where T = one (T) / Int (prod ([sz... ][[region... ]])):: Int
260
260
normalization (X, region) = normalization (real (eltype (X)), size (X), region)
261
261
262
262
plan_ifft (x:: AbstractArray , region; kws... ) =
@@ -316,19 +316,17 @@ transformed dimensions (of the real output array) in order to obtain the inverse
316
316
"""
317
317
brfft
318
318
319
- function rfft_output_size (x:: AbstractArray , region)
319
+ rfft_output_size (x:: AbstractArray , region) = rfft_output_size (size (x), region)
320
+ function rfft_output_size (sz:: Dims{N} , region) where {N}
320
321
d1 = first (region)
321
- osize = [size (x)... ]
322
- osize[d1] = osize[d1]>> 1 + 1
323
- return osize
322
+ return ntuple (d -> d == d1 ? sz[d]>> 1 + 1 : sz[d], Val (N))
324
323
end
325
324
326
- function brfft_output_size (x:: AbstractArray , d:: Integer , region)
325
+ brfft_output_size (x:: AbstractArray , d:: Integer , region) = brfft_output_size (size (x), d, region)
326
+ function brfft_output_size (sz:: Dims{N} , d:: Integer , region) where {N}
327
327
d1 = first (region)
328
- osize = [size (x)... ]
329
- @assert osize[d1] == d>> 1 + 1
330
- osize[d1] = d
331
- return osize
328
+ @assert sz[d1] == d>> 1 + 1
329
+ return ntuple (i -> i == d1 ? d : sz[i], Val (N))
332
330
end
333
331
334
332
plan_irfft (x:: AbstractArray{Complex{T}} , d:: Integer , region; kws... ) where {T} =
@@ -432,7 +430,7 @@ Return the discrete Fourier transform (DFT) sample frequencies for a DFT of leng
432
430
bin centers at every sample point. `fs` is the sampling rate of the
433
431
input signal, which is the reciprocal of the sample spacing.
434
432
435
- Given a window of length `n` and a sampling rate `fs`, the frequencies returned are
433
+ Given a window of length `n` and a sampling rate `fs`, the frequencies returned are
436
434
437
435
```julia
438
436
[0:n÷2-1; -n÷2:-1] * fs/n # if n is even
@@ -467,7 +465,7 @@ The returned `Frequencies` object is an `AbstractVector`
467
465
containing the frequency bin centers at every sample point. `fs`
468
466
is the sampling rate of the input signal, which is the reciprocal of the sample spacing.
469
467
470
- Given a window of length `n` and a sampling rate `fs`, the frequencies returned are
468
+ Given a window of length `n` and a sampling rate `fs`, the frequencies returned are
471
469
472
470
```julia
473
471
[0:n÷2;] * fs/n # if n is even
0 commit comments