Example #1
0
    def testVdotExecution(self):
        a_data = np.array([1 + 2j, 3 + 4j])
        b_data = np.array([5 + 6j, 7 + 8j])
        a = tensor(a_data, chunk_size=1)
        b = tensor(b_data, chunk_size=1)

        t = vdot(a, b)

        res = self.executor.execute_tensor(t)[0]
        expected = np.vdot(a_data, b_data)
        np.testing.assert_equal(res, expected)

        a_data = np.array([[1, 4], [5, 6]])
        b_data = np.array([[4, 1], [2, 2]])
        a = tensor(a_data, chunk_size=1)
        b = tensor(b_data, chunk_size=1)

        t = vdot(a, b)

        res = self.executor.execute_tensor(t)[0]
        expected = np.vdot(a_data, b_data)
        np.testing.assert_equal(res, expected)
Example #2
0
def test_vdot_execution(setup):
    a_data = np.array([1 + 2j, 3 + 4j])
    b_data = np.array([5 + 6j, 7 + 8j])
    a = tensor(a_data, chunk_size=1)
    b = tensor(b_data, chunk_size=1)

    t = vdot(a, b)

    res = t.execute().fetch()
    expected = np.vdot(a_data, b_data)
    np.testing.assert_equal(res, expected)

    a_data = np.array([[1, 4], [5, 6]])
    b_data = np.array([[4, 1], [2, 2]])
    a = tensor(a_data, chunk_size=1)
    b = tensor(b_data, chunk_size=1)

    t = vdot(a, b)

    res = t.execute().fetch()
    expected = np.vdot(a_data, b_data)
    np.testing.assert_equal(res, expected)