bundles / numpy 2.4.3 / numpy / vecdot
ufunc
numpy:vecdot
source: /numpy/__init__.py
Summary
Vector dot product of two arrays.
Extended Summary
Let be a vector in x1 and be a corresponding vector in x2. The dot product is defined as:
where the sum is over the last dimension (unless axis is specified) and where denotes the complex conjugate if is complex and the identity otherwise.
Parameters
x1, x2: array_likeInput arrays, scalars not allowed.
out: ndarray, optionalA location into which the result is stored. If provided, it must have the broadcasted shape of x1 and x2 with the last axis removed. If not provided or None, a freshly-allocated array is used.
**kwargsFor other keyword-only arguments, see the
ufunc docs <ufuncs.kwargs>.
Returns
y: ndarrayThe vector dot product of the inputs. This is a scalar only when both x1, x2 are 1-d vectors.
Raises
: ValueErrorIf the last dimension of x1 is not the same size as the last dimension of x2.
If a scalar value is passed in.
Examples
import numpy as np
✓v = np.array([[0., 5., 0.], [0., 0., 10.], [0., 6., 8.]]) n = np.array([0., 0.6, 0.8]) np.vecdot(v, n)✓
See also
- einsum
Einstein summation convention.
- matmul
Matrix-matrix product.
- matvec
Matrix-vector product.
- vdot
same but flattens arguments first
- vecmat
Vector-matrix product.
Aliases
-
numpy.vecdot