dpnp.vdot

dpnp.vdot(a, b)[source]

Return the dot product of two vectors.

For full documentation refer to numpy.dot.

Parameters:
  • a ({dpnp.ndarray, usm_ndarray, scalar}) -- First input array. Both inputs a and b can not be scalars at the same time. If a is complex, the complex conjugate is taken before the calculation of the dot product.

  • b ({dpnp.ndarray, usm_ndarray, scalar}) -- Second input array. Both inputs a and b can not be scalars at the same time.

Returns:

out -- Returns the dot product of a and b.

Return type:

dpnp.ndarray

See also

dpnp.dot

Returns the dot product.

dpnp.matmul

Returns the matrix product.

Examples

>>> import dpnp as np
>>> a = np.array([1+2j,3+4j])
>>> b = np.array([5+6j,7+8j])
>>> np.vdot(a, b)
array(70-8j)
>>> np.vdot(b, a)
array(70+8j)

Note that higher-dimensional arrays are flattened!

>>> a = np.array([[1, 4], [5, 6]])
>>> b = np.array([[4, 1], [2, 2]])
>>> np.vdot(a, b)
array(30)
>>> np.vdot(b, a)
array(30)
>>> 1*4 + 4*1 + 5*2 + 6*2
30