def test_blas_dot(backend, n):
b = backend()
x = (np.random.rand(n) + 1j * np.random.rand(n))
y = (np.random.rand(n) + 1j * np.random.rand(n))
x = np.require(x, dtype=np.dtype('complex64'), requirements='F')
y = np.require(y, dtype=np.dtype('complex64'), requirements='F')
x_d = b.copy_array(x)
y_d = b.copy_array(y)
y_exp = np.vdot(x, y).real
y_act = b.dot(x_d, y_d)
np.testing.assert_allclose(y_exp, y_act, atol=1e-5)
评论列表
文章目录