pub fn partition_all(a: impl AsRef<Array>, kth: i32) -> Result<Array>
Expand description
Returns a partitioned copy of the flattened 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 thekth
index will be in its sorted position in the output. All elements before the kth index will be less or equal to thekth
element and all elements after will be greater or equal to thekth
element in the output.
§Example
use mlx_rs::{Array, ops::*};
let a = Array::from_slice(&[3, 2, 1], &[3]);
let kth = 1;
let result = partition_all(&a, kth);