scipp.dot#

scipp.dot(x, y)#

Element-wise dot product.

Parameters:
Raises:

scipp.DTypeError – If the dtype of the input is not vector3.

Returns:

TypeVar(VariableLikeType, Variable, DataArray, Dataset, DataGroup[Any]) – The dot product of the input vectors.

Examples

Compute dot product of 3D vectors:

>>> import scipp as sc
>>> v1 = sc.vectors(dims=['x'], values=[[1.0, 0.0, 0.0], [1.0, 1.0, 0.0]], unit='m')
>>> v2 = sc.vectors(dims=['x'], values=[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]], unit='m')
>>> sc.dot(v1, v2)
<scipp.Variable> (x: 2)    float64            [m^2]  [1, 1]

The result is a scalar for each pair of vectors. Units are multiplied in the result.