@@ -42,18 +42,22 @@ function test_fft_backend(array_constructor)
4242 18.0 + 0.0im - 4.5 + 2.598076211353316im - 4.5 - 2.598076211353316im ]),
4343 )
4444 x = array_constructor (_x)
45+ xcopy_float = array_constructor (copy (float .(x)))
46+ xcopy_complex = array_constructor (copy (complex .(xcopy_float)))
4547 fftw_fft = array_constructor (_fftw_fft)
4648
4749 # FFT
4850 dims = ndims (x)
4951 y = AbstractFFTs. fft (x, dims)
52+ ycopy = array_constructor (copy (y))
5053 @test y ≈ fftw_fft
5154 # test plan_fft and also inv and plan_inv of plan_ifft, which should all give
5255 # functionally identical plans
5356 for P in [plan_fft (x, dims), inv (plan_ifft (x, dims)),
5457 AbstractFFTs. plan_inv (plan_ifft (x, dims))]
5558 @test eltype (P) <: Complex
5659 @test P * x ≈ fftw_fft
60+ @test mul! (ycopy, P, x) ≈ fftw_fft
5761 @test P \ (P * x) ≈ x
5862 @test fftdims (P) == dims
5963 end
@@ -64,6 +68,7 @@ function test_fft_backend(array_constructor)
6468 P = plan_bfft (x, dims)
6569 @test P * y ≈ fftw_bfft
6670 @test P \ (P * y) ≈ y
71+ @test mul! (xcopy_complex, P, y) ≈ fftw_bfft
6772 @test fftdims (P) == dims
6873
6974 # IFFT
@@ -72,6 +77,7 @@ function test_fft_backend(array_constructor)
7277 for P in [plan_ifft (x, dims), inv (plan_fft (x, dims)),
7378 AbstractFFTs. plan_inv (plan_fft (x, dims))]
7479 @test P * y ≈ fftw_ifft
80+ @test mul! (xcopy_complex, P, y) ≈ fftw_ifft
7581 @test P \ (P * y) ≈ y
7682 @test fftdims (P) == dims
7783 end
@@ -82,11 +88,13 @@ function test_fft_backend(array_constructor)
8288 1 : (size (fftw_fft, ndims (fftw_fft)) ÷ 2 + 1 )
8389 ]
8490 ry = AbstractFFTs. rfft (x, dims)
91+ rycopy = array_constructor (copy (ry))
8592 @test ry ≈ fftw_rfft
8693 for P in [plan_rfft (x, dims), inv (plan_irfft (ry, size (x, dims), dims)),
8794 AbstractFFTs. plan_inv (plan_irfft (ry, size (x, dims), dims))]
8895 @test eltype (P) <: Real
8996 @test P * x ≈ fftw_rfft
97+ @test mul! (rycopy, P, x) ≈ fftw_rfft
9098 @test P \ (P * x) ≈ x
9199 @test fftdims (P) == dims
92100 end
@@ -96,6 +104,7 @@ function test_fft_backend(array_constructor)
96104 @test AbstractFFTs. brfft (ry, size (x, dims), dims) ≈ fftw_brfft
97105 P = plan_brfft (ry, size (x, dims), dims)
98106 @test P * ry ≈ fftw_brfft
107+ @test mul! (xcopy_float, P, ry) ≈ fftw_brfft
99108 @test P \ (P * ry) ≈ ry
100109 @test fftdims (P) == dims
101110
@@ -105,6 +114,7 @@ function test_fft_backend(array_constructor)
105114 for P in [plan_irfft (ry, size (x, dims), dims), inv (plan_rfft (x, dims)),
106115 AbstractFFTs. plan_inv (plan_rfft (x, dims))]
107116 @test P * ry ≈ fftw_irfft
117+ @test mul! (xcopy_float, P, ry) ≈ fftw_irfft
108118 @test P \ (P * ry) ≈ ry
109119 @test fftdims (P) == dims
110120 end
0 commit comments