Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav Arya committed Jun 9, 2022
1 parent 3b2a754 commit c5c3755
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,12 @@ end
for dims in unique((1, 1:N, N))
P = plan_fft(x, dims)
@test (P')' * x == P * x # test adjoint of adjoint
@test dot(y, P * x) dot(P' * y, x)
@test size(P') == AbstractFFTs.output_size(P) # test size of adjoint
@test dot(y, P * x) dot(P' * y, x) # test validity of adjoint
@test_broken dot(y, P \ x) dot(P' \ y, x)
Pinv = plan_ifft(y)
@test (Pinv')' * y == Pinv * y # test adjoint of adjoint
@test (Pinv')' * y == Pinv * y
@test size(Pinv') == AbstractFFTs.output_size(Pinv)
@test dot(x, Pinv * y) dot(Pinv' * x, y)
@test_broken dot(x, Pinv \ y) dot(Pinv' \ x, y)
end
Expand All @@ -252,14 +254,16 @@ end
N = ndims(x)
for dims in unique((1, 1:N, N))
P = plan_rfft(x, dims)
@test (P')' * x == P * x
y_real = randn(size(P * x))
y_imag = randn(size(P * x))
y = y_real .+ y_imag .* im
@test (P')' * x == P * x
@test size(P') == AbstractFFTs.output_size(P)
@test dot(y_real, real.(P * x)) + dot(y_imag, imag.(P * x)) dot(P' * y, x)
@test_broken dot(y_real, real.(P \ x)) + dot(y_imag, imag.(P \ x)) dot(P' * y, x)
Pinv = plan_irfft(y, size(x)[first(dims)], dims)
@test (Pinv')' * y == Pinv * y
@test size(Pinv') == AbstractFFTs.output_size(Pinv)
@test dot(x, Pinv * y) dot(y_real, real.(Pinv' * x)) + dot(y_imag, imag.(Pinv' * x))
@test_broken dot(x, Pinv \ y) dot(y_real, real.(Pinv' \ x)) + dot(y_imag, imag.(Pinv' \ x))
end
Expand Down

0 comments on commit c5c3755

Please sign in to comment.