mlx_split() divides an array along an axis either into equal sections
(sections scalar) or at explicit 1-based split points (sections list),
returning a list of mlx arrays.
Arguments
- x
An mlx array, or an R array/matrix/vector that will be converted via
as_mlx().- sections
Either a single integer (number of equal parts) or a list of 1-based split points along
axis.- axis
Axis (1-indexed) to operate on.
Examples
x <- mlx_matrix(1:4, 2, 2)
parts <- mlx_split(x, sections = 2, axis = 1)
custom_parts <- mlx_split(x, sections = list(1), axis = 2)