198198 @test @inferred (f9 (plan_fft (zeros (10 ), 1 ), 10 )) == 1 / 10
199199end
200200
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+
201229@testset " adjoint" begin
202230 @testset " complex fft adjoint" begin
203231 for x in (randn (3 ), randn (3 , 4 ), randn (3 , 4 , 5 ))
@@ -217,13 +245,13 @@ end
217245 for x in (randn (3 ), randn (4 ), randn (3 , 4 ), randn (3 , 4 , 5 )) # test odd and even lengths
218246 N = ndims (x)
219247 for dims in unique ((1 , 1 : N, N))
220- P = plan_rfft (similar (x) , dims)
248+ P = plan_rfft (x , dims)
221249 y_real = randn (size (P * x))
222250 y_imag = randn (size (P * x))
223251 y = y_real .+ y_imag .* im
224252 @test dot (y_real, real .(P * x)) + dot (y_imag, imag .(P * x)) ≈ dot (P' * y, x)
225253 @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)
227255 @test dot (x, Pinv * y) ≈ dot (y_real, real .(Pinv' * x)) + dot (y_imag, imag .(Pinv' * x))
228256 @test_broken dot (x, Pinv \ y) ≈ dot (y_real, real .(Pinv' \ x)) + dot (y_imag, imag .(Pinv' \ x))
229257 end
0 commit comments