Пример #1
0
    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))
Пример #2
0
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)
Пример #3
0
def test_hfft_execution(setup):
    raw = np.random.rand(10, 20, 30)
    t = tensor(raw, chunk_size=(8, 8, 30))

    r = hfft(t)
    res = r.execute().fetch()
    expected = np.fft.hfft(raw)
    np.testing.assert_allclose(res, expected)

    r = hfft(t, norm='ortho')
    res = r.execute().fetch()
    expected = np.fft.hfft(raw, norm='ortho')
    np.testing.assert_allclose(res, expected)

    r = hfft(t, n=11)
    res = r.execute().fetch()
    expected = np.fft.hfft(raw, n=11)
    np.testing.assert_allclose(res, expected)
Пример #4
0
    def testHFFTExecution(self):
        raw = np.random.rand(10, 20, 30)
        t = tensor(raw, chunk_size=(4, 4, 30))

        r = hfft(t)
        res = self.executor.execute_tensor(r, concat=True)[0]
        expected = np.fft.hfft(raw)
        np.testing.assert_allclose(res, expected)

        r = hfft(t, norm='ortho')
        res = self.executor.execute_tensor(r, concat=True)[0]
        expected = np.fft.hfft(raw, norm='ortho')
        np.testing.assert_allclose(res, expected)

        r = hfft(t, n=11)
        res = self.executor.execute_tensor(r, concat=True)[0]
        expected = np.fft.hfft(raw, n=11)
        np.testing.assert_allclose(res, expected)