198
198
@test @inferred (f9 (plan_fft (zeros (10 ), 1 ), 10 )) == 1 / 10
199
199
end
200
200
201
+ @testset " output size" begin
202
+ @testset " complex fft output size" begin
203
+ for x in (randn (3 ), randn (3 , 4 ), randn (3 , 4 , 5 ))
204
+ N = ndims (x)
205
+ y = randn (size (x))
206
+ for dims in unique ((1 , 1 : N, N))
207
+ P = plan_fft (x, dims)
208
+ @test AbstractFFTs. output_size (P) == size (P * x)
209
+ Pinv = plan_ifft (x)
210
+ @test AbstractFFTs. output_size (Pinv) == size (Pinv * x)
211
+ end
212
+ end
213
+ end
214
+ @testset " real fft output size" begin
215
+ for x in (randn (3 ), randn (4 ), randn (3 , 4 ), randn (3 , 4 , 5 )) # test odd and even lengths
216
+ N = ndims (x)
217
+ for dims in unique ((1 , 1 : N, N))
218
+ P = plan_rfft (x, dims)
219
+ Px_sz = size (P * x)
220
+ @test AbstractFFTs. output_size (P) == Px_sz
221
+ y = randn (Px_sz) .+ randn (Px_sz) * im
222
+ Pinv = plan_irfft (y, size (x)[first (dims)], dims)
223
+ @test AbstractFFTs. output_size (Pinv) == size (Pinv * y)
224
+ end
225
+ end
226
+ end
227
+ end
228
+
201
229
@testset " adjoint" begin
202
230
@testset " complex fft adjoint" begin
203
231
for x in (randn (3 ), randn (3 , 4 ), randn (3 , 4 , 5 ))
@@ -217,13 +245,13 @@ end
217
245
for x in (randn (3 ), randn (4 ), randn (3 , 4 ), randn (3 , 4 , 5 )) # test odd and even lengths
218
246
N = ndims (x)
219
247
for dims in unique ((1 , 1 : N, N))
220
- P = plan_rfft (similar (x) , dims)
248
+ P = plan_rfft (x , dims)
221
249
y_real = randn (size (P * x))
222
250
y_imag = randn (size (P * x))
223
251
y = y_real .+ y_imag .* im
224
252
@test dot (y_real, real .(P * x)) + dot (y_imag, imag .(P * x)) ≈ dot (P' * y, x)
225
253
@test_broken dot (y_real, real .(P \ x)) + dot (y_imag, imag .(P \ x)) ≈ dot (P' * y, x)
226
- Pinv = plan_irfft (similar (y) , size (x)[first (dims)], dims)
254
+ Pinv = plan_irfft (y , size (x)[first (dims)], dims)
227
255
@test dot (x, Pinv * y) ≈ dot (y_real, real .(Pinv' * x)) + dot (y_imag, imag .(Pinv' * x))
228
256
@test_broken dot (x, Pinv \ y) ≈ dot (y_real, real .(Pinv' \ x)) + dot (y_imag, imag .(Pinv' \ x))
229
257
end
0 commit comments