mindsponge.common.vecs_cross_vecs

mindsponge.common.vecs_cross_vecs(v1, v2)[source]

Cross product of vectors \(v_1 = (x_1, x_2, x_3)\) and \(v_2 = (y_1, y_2, y_3)\).

\[cross_{res} = (x_2 * y_3 - x_3 * y_2, x_3 * y_1 - x_1 * y_3, x_1 * y_2 - x_2 * y_1)\]
Parameters
  • v1 (tuple) – vectors \(\vec v_1\) , length is 3. Data type is constant or Tensor with same shape.

  • v2 (tuple) – vectors \(\vec v_2\) , length is 3. Data type is constant or Tensor with same shape.

Returns

tuple, cross product result of two vectors, length is 3.

Data type is constant or Tensor with same shape.

Supported Platforms:

Ascend GPU

Examples

>>> import mindsponge
>>> v1 = (1, 2, 3)
>>> v2 = (3, 4, 5)
>>> ans = mindsponge.common.vecs_cross_vecs(v1, v2)
>>> print(ans)
(-2, 4, -2)