cupy.cross#
- cupy.cross(a, b, axisa=-1, axisb=-1, axisc=-1, axis=None)[source]#
Returns the cross product of two vectors.
The cross product of
aandbin \(R^3\) is a vector perpendicular to bothaandb. Ifaandbare arrays of vectors, the vectors are defined by the last axis ofaandbby default, and these axes can have dimensions 2 or 3. Where the dimension of eitheraorbis 2, the third component of the input vector is assumed to be zero and the cross product calculated accordingly. In cases where both input vectors have dimension 2, the z-component of the cross product is returned.- Parameters:
a (cupy.ndarray) – Components of the first vector(s).
b (cupy.ndarray) – Components of the second vector(s).
axisa (int, optional) – Axis of
athat defines the vector(s). By default, the last axis.axisb (int, optional) – Axis of
bthat defines the vector(s). By default, the last axis.axisc (int, optional) – Axis of
ccontaining the cross product vector(s). Ignored if both input vectors have dimension 2, as the return is scalar. By default, the last axis.axis (int, optional) – If defined, the axis of
a,bandcthat defines the vector(s) and cross product(s). Overridesaxisa,axisbandaxisc.
- Returns:
Vector cross product(s).
- Return type:
See also