Let a be a vector in and be
a corresponding vector in . The dot product is defined as:
x1
b
x2
a⋅b=i=0∑n−1aibi
where the sum is over the last dimension (unless axis is specified) and
where ai denotes the complex conjugate if ai
is complex and the identity otherwise.
Parameters:
x1, x2 : array_like
Input arrays, scalars not allowed.
out : ndarray, optional
A 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.
**kwargs
For other keyword-only arguments, see the
ufunc docs.
Returns:
y : ndarray
The vector dot product of the inputs.
This is a scalar only when both x1, x2 are 1-d vectors.
Raises:
ValueError
If the last dimension of x1 is not the same size as
the last dimension of x2.
If a scalar value is passed in.
Examples
>>> importnumpyasnp
Get the projected size along a given normal for an array of vectors.