Skip to contents

Vector cross product with mlx arrays

Usage

mlx_cross(a, b, axis = -1L)

Arguments

a, b

Input mlx arrays containing 3D vectors.

axis

Axis along which to compute the cross product (1-indexed, default last).

Value

An mlx array of cross products.

See also

Examples

u <- as_mlx(c(1, 0, 0))
v <- as_mlx(c(0, 1, 0))
mlx_cross(u, v)
#> mlx array [3]
#>   dtype: float32
#>   device: gpu
#>   values:
#> [1] 0 0 1