Compute the cross product of two 3-D vectors.
Returns the standard 3-D vector cross product
Parameters
Returns
TensorCross product, same shape as inputs.
Raises
DtypeMismatchIf
input and other have different dtypes, as the reference
does.NotImplementedErrorIf both are bool tensors: the reference has no bool kernel. An
integer pair is answered.
Notes
Implemented via gather + element-wise products so that
autograd flows through naturally. Recall that
is orthogonal to both and ,
with magnitude .
Examples
>>> import lucid
>>> from lucid.linalg import cross
>>> cross(lucid.tensor([1.0, 0.0, 0.0]), lucid.tensor([0.0, 1.0, 0.0]))
tensor([0., 0., 1.])