cross

cross(x1: array, x2: array, /, *, axis: int = -1) array

Returns the cross product of 3-element vectors. If x1 and x2 are multi-dimensional arrays (i.e., both have a rank greater than 1), then the cross-product of each pair of corresponding 3-element vectors is independently computed.

Parameters:
  • x1 (array) – first input array. Should have a numeric data type.

  • x2 (array) – second input array. Must have the same shape as x1. Should have a numeric data type.

  • axis (int) – the axis (dimension) of x1 and x2 containing the vectors for which to compute the cross product. If set to -1, the function computes the cross product for vectors defined by the last axis (dimension). Default: -1.

Returns:

out (array) – an array containing the cross products. The returned array must have a data type determined by Type Promotion Rules.