pub fn partition_axis(
a: impl AsRef<Array>,
kth: i32,
axis: i32,
) -> Result<Array>Expand description
Returns a partitioned copy of the array such that the smaller kth elements are first.
Returns an error if the arguments are invalid.
The ordering of the elements in partitions is undefined.
§Params
array: input arraykth: Element at thekthindex will be in its sorted position in the output. All elements before the kth index will be less or equal to thekthelement and all elements after will be greater or equal to thekthelement in the output.axis: axis to partition over
§Example
use mlx_rs::{Array, ops::*};
let a = Array::from_slice(&[3, 2, 1], &[3]);
let kth = 1;
let axis = 0;
let result = partition_axis(&a, kth, axis);