scipp.cross#

scipp.cross(x, y)#

Element-wise cross product.

Parameters:
Raises:

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

Returns:

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

Examples

Compute cross product of 3D vectors:

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

The cross product of two vectors is perpendicular to both input vectors. Units are multiplied in the result.