def testHermitianFFT(self): t = ones((10, 20, 30), chunk_size=(3, 20, 30)) t1 = hfft(t) self.assertEqual(t1.shape, np.fft.hfft(np.ones(t.shape)).shape) t1.tiles() self.assertEqual(t1.shape, tuple(sum(ns) for ns in t1.nsplits)) t = ones((10, 20, 30), chunk_size=(3, 20, 30)) t1 = hfft(t, n=100) self.assertEqual(t1.shape, np.fft.hfft(np.ones(t.shape), n=100).shape) t1.tiles() self.assertEqual(t1.shape, tuple(sum(ns) for ns in t1.nsplits)) t = ones((10, 20, 30), chunk_size=(3, 20, 30)) t1 = ihfft(t) self.assertEqual(t1.shape, np.fft.ihfft(np.ones(t.shape)).shape) t1.tiles() self.assertEqual(t1.shape, tuple(sum(ns) for ns in t1.nsplits)) t = ones((10, 20, 30), chunk_size=(3, 20, 30)) t1 = ihfft(t, n=100) self.assertEqual(t1.shape, np.fft.ihfft(np.ones(t.shape), n=100).shape) t1.tiles() self.assertEqual(t1.shape, tuple(sum(ns) for ns in t1.nsplits)) t1 = ihfft(t, n=101) self.assertEqual(t1.shape, np.fft.ihfft(np.ones(t.shape), n=101).shape) t1.tiles() self.assertEqual(t1.shape, tuple(sum(ns) for ns in t1.nsplits))
def test_hermitian_fft(): t = ones((10, 20, 30), chunk_size=(3, 20, 30)) t1 = hfft(t) assert t1.shape == np.fft.hfft(np.ones(t.shape)).shape t1 = tile(t1) assert t1.shape == tuple(sum(ns) for ns in t1.nsplits) t = ones((10, 20, 30), chunk_size=(3, 20, 30)) t1 = hfft(t, n=100) assert t1.shape == np.fft.hfft(np.ones(t.shape), n=100).shape t1 = tile(t1) assert t1.shape == tuple(sum(ns) for ns in t1.nsplits) t = ones((10, 20, 30), chunk_size=(3, 20, 30)) t1 = ihfft(t) assert t1.shape == np.fft.ihfft(np.ones(t.shape)).shape t1 = tile(t1) assert t1.shape == tuple(sum(ns) for ns in t1.nsplits) t = ones((10, 20, 30), chunk_size=(3, 20, 30)) t1 = ihfft(t, n=100) assert t1.shape == np.fft.ihfft(np.ones(t.shape), n=100).shape t1 = tile(t1) assert t1.shape == tuple(sum(ns) for ns in t1.nsplits) t1 = ihfft(t, n=101) assert t1.shape == np.fft.ihfft(np.ones(t.shape), n=101).shape t1 = tile(t1) assert t1.shape == tuple(sum(ns) for ns in t1.nsplits)
def test_ihfft_execution(setup): raw = np.random.rand(10, 20, 30) t = tensor(raw, chunk_size=(8, 8, 30)) r = ihfft(t) res = r.execute().fetch() expected = np.fft.ihfft(raw) np.testing.assert_allclose(res, expected) r = ihfft(t, norm='ortho') res = r.execute().fetch() expected = np.fft.ihfft(raw, norm='ortho') np.testing.assert_allclose(res, expected) r = ihfft(t, n=11) res = r.execute().fetch() expected = np.fft.ihfft(raw, n=11) np.testing.assert_allclose(res, expected) r = ihfft(t, n=12) res = r.execute().fetch() expected = np.fft.ihfft(raw, n=12) np.testing.assert_allclose(res, expected)
def testIHFFTExecution(self): raw = np.random.rand(10, 20, 30) t = tensor(raw, chunk_size=(4, 4, 30)) r = ihfft(t) res = self.executor.execute_tensor(r, concat=True)[0] expected = np.fft.ihfft(raw) np.testing.assert_allclose(res, expected) r = ihfft(t, norm='ortho') res = self.executor.execute_tensor(r, concat=True)[0] expected = np.fft.ihfft(raw, norm='ortho') np.testing.assert_allclose(res, expected) r = ihfft(t, n=11) res = self.executor.execute_tensor(r, concat=True)[0] expected = np.fft.ihfft(raw, n=11) np.testing.assert_allclose(res, expected) r = ihfft(t, n=12) res = self.executor.execute_tensor(r, concat=True)[0] expected = np.fft.ihfft(raw, n=12) np.testing.assert_allclose(res, expected)