|
56 | 56 | dims = ndims(x)
|
57 | 57 | y = AbstractFFTs.fft(x, dims)
|
58 | 58 | @test y ≈ fftw_fft
|
59 |
| - P = plan_fft(x, dims) |
60 |
| - @test eltype(P) === ComplexF64 |
61 |
| - @test P * x ≈ fftw_fft |
62 |
| - @test P \ (P * x) ≈ x |
63 |
| - @test fftdims(P) == dims |
| 59 | + # test plan_fft and also inv and plan_inv of plan_ifft, which should all give |
| 60 | + # functionally identical plans |
| 61 | + for P in [plan_fft(x, dims), inv(plan_ifft(x, dims)), |
| 62 | + AbstractFFTs.plan_inv(plan_ifft(x, dims))] |
| 63 | + @test eltype(P) === ComplexF64 |
| 64 | + @test P * x ≈ fftw_fft |
| 65 | + @test P \ (P * x) ≈ x |
| 66 | + @test fftdims(P) == dims |
| 67 | + end |
64 | 68 |
|
65 | 69 | fftw_bfft = complex.(size(x, dims) .* x)
|
66 | 70 | @test AbstractFFTs.bfft(y, dims) ≈ fftw_bfft
|
|
71 | 75 |
|
72 | 76 | fftw_ifft = complex.(x)
|
73 | 77 | @test AbstractFFTs.ifft(y, dims) ≈ fftw_ifft
|
74 |
| - P = plan_ifft(x, dims) |
75 |
| - @test P * y ≈ fftw_ifft |
76 |
| - @test P \ (P * y) ≈ y |
77 |
| - @test fftdims(P) == dims |
| 78 | + # test plan_ifft and also inv and plan_inv of plan_fft, which should all give |
| 79 | + # functionally identical plans |
| 80 | + for P in [plan_ifft(x, dims), inv(plan_fft(x, dims)), |
| 81 | + AbstractFFTs.plan_inv(plan_fft(x, dims))] |
| 82 | + @test P * y ≈ fftw_ifft |
| 83 | + @test P \ (P * y) ≈ y |
| 84 | + @test fftdims(P) == dims |
| 85 | + end |
78 | 86 |
|
79 | 87 | # real FFT
|
80 | 88 | fftw_rfft = fftw_fft[
|
|
83 | 91 | ]
|
84 | 92 | ry = AbstractFFTs.rfft(x, dims)
|
85 | 93 | @test ry ≈ fftw_rfft
|
86 |
| - P = plan_rfft(x, dims) |
87 |
| - @test eltype(P) === Int |
88 |
| - @test P * x ≈ fftw_rfft |
89 |
| - @test P \ (P * x) ≈ x |
90 |
| - @test fftdims(P) == dims |
| 94 | + # test plan_rfft and also inv and plan_inv of plan_irfft, which should all give |
| 95 | + # functionally identical plans |
| 96 | + for P in [plan_rfft(x, dims), inv(plan_irfft(ry, size(x, dims), dims)), |
| 97 | + AbstractFFTs.plan_inv(plan_irfft(ry, size(x, dims), dims))] |
| 98 | + @test eltype(P) <: Real |
| 99 | + @test P * x ≈ fftw_rfft |
| 100 | + @test P \ (P * x) ≈ x |
| 101 | + @test fftdims(P) == dims |
| 102 | + end |
91 | 103 |
|
92 | 104 | fftw_brfft = complex.(size(x, dims) .* x)
|
93 | 105 | @test AbstractFFTs.brfft(ry, size(x, dims), dims) ≈ fftw_brfft
|
|
98 | 110 |
|
99 | 111 | fftw_irfft = complex.(x)
|
100 | 112 | @test AbstractFFTs.irfft(ry, size(x, dims), dims) ≈ fftw_irfft
|
101 |
| - P = plan_irfft(ry, size(x, dims), dims) |
102 |
| - @test P * ry ≈ fftw_irfft |
103 |
| - @test P \ (P * ry) ≈ ry |
104 |
| - @test fftdims(P) == dims |
| 113 | + # test plan_rfft and also inv and plan_inv of plan_irfft, which should all give |
| 114 | + # functionally identical plans |
| 115 | + for P in [plan_irfft(ry, size(x, dims), dims), inv(plan_rfft(x, dims)), |
| 116 | + AbstractFFTs.plan_inv(plan_rfft(x, dims))] |
| 117 | + @test P * ry ≈ fftw_irfft |
| 118 | + @test P \ (P * ry) ≈ ry |
| 119 | + @test fftdims(P) == dims |
| 120 | + end |
105 | 121 | end
|
106 | 122 | end
|
107 | 123 |
|
|
0 commit comments