Commit c2c6ace2 authored by Martin Reinecke's avatar Martin Reinecke

stricter 1D tests

parent d3732c1b
...@@ -11,6 +11,16 @@ shapes2D = ((128, 128), (128, 129), (1, 129), (129,1)) ...@@ -11,6 +11,16 @@ shapes2D = ((128, 128), (128, 129), (1, 129), (129,1))
shapes3D = ((32,17,39),) shapes3D = ((32,17,39),)
shapes = shapes1D+shapes2D+shapes3D shapes = shapes1D+shapes2D+shapes3D
def test1D():
maxlen=8192
a=np.random.rand(maxlen)-0.5 + 1j*np.random.rand(maxlen)-0.5j
b=a.astype(np.complex64)
for i in range(1,maxlen+1):
assert_allclose(pypocketfft.ifftn(pypocketfft.fftn(a[:i]),fct=1./i),a[:i], atol=2e-15, rtol=0)
assert_allclose(pypocketfft.irfftn(pypocketfft.rfftn(a[:i].real),fct=1./i,lastsize=i),a[:i].real, atol=2e-15, rtol=0)
assert_allclose(pypocketfft.ifftn(pypocketfft.fftn(b[:i]),fct=1./i),b[:i], atol=8e-7, rtol=0)
assert_allclose(pypocketfft.irfftn(pypocketfft.rfftn(b[:i].real),fct=1./i,lastsize=i),b[:i].real, atol=8e-7, rtol=0)
@pmp("shp", shapes) @pmp("shp", shapes)
def test_fftn(shp): def test_fftn(shp):
a=np.random.rand(*shp)-0.5 + 1j*np.random.rand(*shp)-0.5j a=np.random.rand(*shp)-0.5 + 1j*np.random.rand(*shp)-0.5j
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment