@@ -42,18 +42,22 @@ function test_fft_backend(array_constructor)
42
42
18.0 + 0.0im - 4.5 + 2.598076211353316im - 4.5 - 2.598076211353316im ]),
43
43
)
44
44
x = array_constructor (_x)
45
+ xcopy_float = array_constructor (copy (float .(x)))
46
+ xcopy_complex = array_constructor (copy (complex .(xcopy_float)))
45
47
fftw_fft = array_constructor (_fftw_fft)
46
48
47
49
# FFT
48
50
dims = ndims (x)
49
51
y = AbstractFFTs. fft (x, dims)
52
+ ycopy = array_constructor (copy (y))
50
53
@test y ≈ fftw_fft
51
54
# test plan_fft and also inv and plan_inv of plan_ifft, which should all give
52
55
# functionally identical plans
53
56
for P in [plan_fft (x, dims), inv (plan_ifft (x, dims)),
54
57
AbstractFFTs. plan_inv (plan_ifft (x, dims))]
55
58
@test eltype (P) <: Complex
56
59
@test P * x ≈ fftw_fft
60
+ @test mul! (ycopy, P, x) ≈ fftw_fft
57
61
@test P \ (P * x) ≈ x
58
62
@test fftdims (P) == dims
59
63
end
@@ -64,6 +68,7 @@ function test_fft_backend(array_constructor)
64
68
P = plan_bfft (x, dims)
65
69
@test P * y ≈ fftw_bfft
66
70
@test P \ (P * y) ≈ y
71
+ @test mul! (xcopy_complex, P, y) ≈ fftw_bfft
67
72
@test fftdims (P) == dims
68
73
69
74
# IFFT
@@ -72,6 +77,7 @@ function test_fft_backend(array_constructor)
72
77
for P in [plan_ifft (x, dims), inv (plan_fft (x, dims)),
73
78
AbstractFFTs. plan_inv (plan_fft (x, dims))]
74
79
@test P * y ≈ fftw_ifft
80
+ @test mul! (xcopy_complex, P, y) ≈ fftw_ifft
75
81
@test P \ (P * y) ≈ y
76
82
@test fftdims (P) == dims
77
83
end
@@ -82,11 +88,13 @@ function test_fft_backend(array_constructor)
82
88
1 : (size (fftw_fft, ndims (fftw_fft)) ÷ 2 + 1 )
83
89
]
84
90
ry = AbstractFFTs. rfft (x, dims)
91
+ rycopy = array_constructor (copy (ry))
85
92
@test ry ≈ fftw_rfft
86
93
for P in [plan_rfft (x, dims), inv (plan_irfft (ry, size (x, dims), dims)),
87
94
AbstractFFTs. plan_inv (plan_irfft (ry, size (x, dims), dims))]
88
95
@test eltype (P) <: Real
89
96
@test P * x ≈ fftw_rfft
97
+ @test mul! (rycopy, P, x) ≈ fftw_rfft
90
98
@test P \ (P * x) ≈ x
91
99
@test fftdims (P) == dims
92
100
end
@@ -96,6 +104,7 @@ function test_fft_backend(array_constructor)
96
104
@test AbstractFFTs. brfft (ry, size (x, dims), dims) ≈ fftw_brfft
97
105
P = plan_brfft (ry, size (x, dims), dims)
98
106
@test P * ry ≈ fftw_brfft
107
+ @test mul! (xcopy_float, P, ry) ≈ fftw_brfft
99
108
@test P \ (P * ry) ≈ ry
100
109
@test fftdims (P) == dims
101
110
@@ -105,6 +114,7 @@ function test_fft_backend(array_constructor)
105
114
for P in [plan_irfft (ry, size (x, dims), dims), inv (plan_rfft (x, dims)),
106
115
AbstractFFTs. plan_inv (plan_rfft (x, dims))]
107
116
@test P * ry ≈ fftw_irfft
117
+ @test mul! (xcopy_float, P, ry) ≈ fftw_irfft
108
118
@test P \ (P * ry) ≈ ry
109
119
@test fftdims (P) == dims
110
120
end
0 commit comments