From c2c6ace29fe0a90ad2f0a520b63fe4b1e3520d1a Mon Sep 17 00:00:00 2001 From: Martin Reinecke Date: Mon, 22 Apr 2019 18:10:29 +0200 Subject: [PATCH] stricter 1D tests --- test.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test.py b/test.py index b063df5..8808061 100644 --- a/test.py +++ b/test.py @@ -11,6 +11,16 @@ shapes2D = ((128, 128), (128, 129), (1, 129), (129,1)) shapes3D = ((32,17,39),) 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) def test_fftn(shp): a=np.random.rand(*shp)-0.5 + 1j*np.random.rand(*shp)-0.5j -- GitLab