@@ -201,16 +201,19 @@ end
201
201
202
202
@testset " output size" begin
203
203
@testset " complex fft output size" begin
204
- for x in (randn (3 ), randn (3 , 4 ), randn (3 , 4 , 5 ))
205
- N = ndims (x)
206
- y = randn (size (x))
207
- for dims in unique ((1 , 1 : N, N))
208
- P = plan_fft (x, dims)
209
- @test @inferred (AbstractFFTs. output_size (P)) == size (x)
210
- @test AbstractFFTs. output_size (P' ) == size (x)
211
- Pinv = plan_ifft (x)
212
- @test AbstractFFTs. output_size (Pinv) == size (x)
213
- @test AbstractFFTs. output_size (Pinv' ) == size (x)
204
+ for x_shape in ((3 ,), (3 , 4 ), (3 , 4 , 5 ))
205
+ N = length (x_shape)
206
+ real_x = randn (x_shape)
207
+ complex_x = randn (ComplexF64, x_shape)
208
+ for x in (real_x, complex_x)
209
+ for dims in unique ((1 , 1 : N, N))
210
+ P = plan_fft (x, dims)
211
+ @test @inferred (AbstractFFTs. output_size (P)) == size (x)
212
+ @test AbstractFFTs. output_size (P' ) == size (x)
213
+ Pinv = plan_ifft (x)
214
+ @test AbstractFFTs. output_size (Pinv) == size (x)
215
+ @test AbstractFFTs. output_size (Pinv' ) == size (x)
216
+ end
214
217
end
215
218
end
216
219
end
222
225
Px_sz = size (P * x)
223
226
@test AbstractFFTs. output_size (P) == Px_sz
224
227
@test AbstractFFTs. output_size (P' ) == size (x)
225
- y = randn (Complex{Float64} , Px_sz)
228
+ y = randn (ComplexF64 , Px_sz)
226
229
Pinv = plan_irfft (y, size (x)[first (dims)], dims)
227
230
@test AbstractFFTs. output_size (Pinv) == size (Pinv * y)
228
231
@test AbstractFFTs. output_size (Pinv' ) == size (y)
@@ -233,21 +236,25 @@ end
233
236
234
237
@testset " adjoint" begin
235
238
@testset " complex fft adjoint" begin
236
- for x in (randn (3 ), randn (3 , 4 ), randn (3 , 4 , 5 ))
237
- N = ndims (x)
238
- y = randn (size (x))
239
- for dims in unique ((1 , 1 : N, N))
240
- P = plan_fft (x, dims)
241
- @test (P' )' === P # test adjoint of adjoint
242
- @test size (P' ) == AbstractFFTs. output_size (P) # test size of adjoint
243
- @test dot (y, P * x) ≈ dot (P' * y, x) # test validity of adjoint
244
- @test dot (y, P \ x) ≈ dot (P' \ y, x)
245
- Pinv = plan_ifft (y)
246
- @test (Pinv' )' * y == Pinv * y
247
- @test size (Pinv' ) == AbstractFFTs. output_size (Pinv)
248
- @test dot (x, Pinv * y) ≈ dot (Pinv' * x, y)
249
- @test dot (x, Pinv \ y) ≈ dot (Pinv' \ x, y)
250
- @test_throws MethodError mul! (x, P' , y)
239
+ for x_shape in ((3 ,), (3 , 4 ), (3 , 4 , 5 ))
240
+ N = length (x_shape)
241
+ real_x = randn (x_shape)
242
+ complex_x = randn (ComplexF64, x_shape)
243
+ y = randn (ComplexF64, x_shape)
244
+ for x in (real_x, complex_x)
245
+ for dims in unique ((1 , 1 : N, N))
246
+ P = plan_fft (x, dims)
247
+ @test (P' )' === P # test adjoint of adjoint
248
+ @test size (P' ) == AbstractFFTs. output_size (P) # test size of adjoint
249
+ @test dot (y, P * x) ≈ dot (P' * y, x) # test validity of adjoint
250
+ @test dot (y, P \ x) ≈ dot (P' \ y, x)
251
+ Pinv = plan_ifft (y)
252
+ @test (Pinv' )' * y == Pinv * y
253
+ @test size (Pinv' ) == AbstractFFTs. output_size (Pinv)
254
+ @test dot (x, Pinv * y) ≈ dot (Pinv' * x, y)
255
+ @test dot (x, Pinv \ y) ≈ dot (Pinv' \ x, y)
256
+ @test_throws MethodError mul! (x, P' , y)
257
+ end
251
258
end
252
259
end
253
260
end
256
263
N = ndims (x)
257
264
for dims in unique ((1 , 1 : N, N))
258
265
P = plan_rfft (x, dims)
259
- y = randn (Complex{Float64} , size (P * x))
266
+ y = randn (ComplexF64 , size (P * x))
260
267
@test (P' )' * x == P * x
261
268
@test size (P' ) == AbstractFFTs. output_size (P)
262
269
@test dot (real .(y), real .(P * x)) + dot (imag .(y), imag .(P * x)) ≈ dot (P' * y, x)
306
313
for x_shape in ((2 ,), (2 , 3 ), (3 , 4 , 5 ))
307
314
N = length (x_shape)
308
315
x = randn (x_shape)
309
- complex_x = x + randn (x_shape) * im
316
+ complex_x = randn (ComplexF64, x_shape)
310
317
for dims in unique ((1 , 1 : N, N))
311
318
# fft, ifft, bfft
312
319
for f in (fft, ifft, bfft)
0 commit comments