flopscope.numpy.linalg.vecdot
fnp.linalg.vecdot(x1: 'ArrayLike', x2: 'ArrayLike', /, *, axis: 'int' = -1) -> 'FlopscopeArray'[flopscope source][numpy source]
Computes the vector dot product.
Adapted from NumPy docs np.linalg.vecdot
Delegates to `fnp.vecdot` which charges `2*n` FLOPs.
This function is restricted to arguments compatible with the Array API, contrary to flops.vecdot.
Let be a vector in x1 and be
a corresponding vector in x2. The dot product is defined as:
over the dimension specified by axis and where
denotes the complex conjugate if is complex and the identity
otherwise.
Parameters
- x1:array_like
First input array.
- x2:array_like
Second input array.
- axis:int, optional
Axis over which to compute the dot product. Default:
-1.
Returns
- output:ndarray
The vector dot product of the input.
See also
Examples
Get the projected size along a given normal for an array of vectors.
>>> v = flops.array([[0., 5., 0.], [0., 0., 10.], [0., 6., 8.]])
>>> n = flops.array([0., 0.6, 0.8])
>>> flops.linalg.vecdot(v, n)
array([ 3., 8., 10.])