jax.numpy.linalg.vecdot — JAX documentation (original) (raw)

jax.numpy.linalg.vecdot#

jax.numpy.linalg.vecdot(x1, x2, /, *, axis=-1, precision=None, preferred_element_type=None)[source]#

Compute the (batched) vector conjugate dot product of two arrays.

JAX implementation of numpy.linalg.vecdot().

Parameters:

Returns:

array containing the conjugate dot product of x1 and x2 along axis. The non-contracted dimensions are broadcast together.

Return type:

Array

See also

Examples

Vector dot product of two 1D arrays:

x1 = jnp.array([1, 2, 3]) x2 = jnp.array([4, 5, 6]) jnp.linalg.vecdot(x1, x2) Array(32, dtype=int32)

Batched vector dot product of two 2D arrays:

x1 = jnp.array([[1, 2, 3], ... [4, 5, 6]]) x2 = jnp.array([[2, 3, 4]]) jnp.linalg.vecdot(x1, x2, axis=-1) Array([20, 47], dtype=int32)