dpnp.linalg.vecdot

dpnp.linalg.vecdot(x1, x2, /, *, axis=-1)[source]

Computes the vector dot product.

This function is restricted to arguments compatible with the Array API, contrary to dpnp.vecdot.

Let \(\mathbf{a}\) be a vector in x1 and \(\mathbf{b}\) be a corresponding vector in x2. The dot product is defined as:

\[\mathbf{a} \cdot \mathbf{b} = \sum_{i=0}^{n-1} \overline{a_i}b_i\]

over the dimension specified by axis and where \(\overline{a_i}\) denotes the complex conjugate if \(a_i\) is complex and the identity otherwise.

For full documentation refer to numpy.linalg.vecdot.

Parameters:
  • x1 ({dpnp.ndarray, usm_ndarray}) -- First input array.

  • x2 ({dpnp.ndarray, usm_ndarray}) -- Second input array.

  • axis (int, optional) -- Axis over which to compute the dot product. Default: -1.

Returns:

out -- The vector dot product of the inputs.

Return type:

dpnp.ndarray

See also

dpnp.vecdot

Similar function with support for more keyword arguments.

dpnp.vdot

Complex-conjugating dot product.

Examples

Get the projected size along a given normal for an array of vectors.

>>> import dpnp as np
>>> v = np.array([[0., 5., 0.], [0., 0., 10.], [0., 6., 8.]])
>>> n = np.array([0., 0.6, 0.8])
>>> np.linalg.vecdot(v, n)
array([ 3.,  8., 10.])