def test_UnscaledFFT_3d(backend, M, N, K, B ):
b = backend()
# forward
x = b.rand_array( (M*N*K, B) )
y = b.rand_array( (M*N*K, B) )
x_h = x.to_host().reshape( (M,N,K,B), order='F' )
A = b.UnscaledFFT( (M,N,K), dtype=x.dtype )
A.eval(y, x)
y_exp = np.fft.fftn( x_h, axes=(0,1,2) )
y_act = y.to_host().reshape( (M,N,K,B), order='F' )
npt.assert_allclose(y_act, y_exp, rtol=1e-2)
# adjoint
x = b.rand_array( (M*N*K, B) )
y = b.rand_array( (M*N*K, B) )
x_h = x.to_host().reshape( (M,N,K,B), order='F' )
A.H.eval(y, x)
y_exp = np.fft.ifftn( x_h, axes=(0,1,2) ) * (M*N*K)
y_act = y.to_host().reshape( (M,N,K,B), order='F' )
npt.assert_allclose(y_act, y_exp, rtol=1e-2)
评论列表
文章目录