Skip to main content

index_order_into

Function index_order_into 

Source
pub fn index_order_into(
    strides: &[isize],
    out: &mut [usize],
) -> Result<(), StridedError>
Expand description

index_order written into out instead of a new vector, so a caller with its own storage computes the order without allocating at any rank.

§Errors

crate::StridedError::StrideLengthMismatch when out.len() differs from strides.len(); nothing is written then.

§Examples

use strided_view::auxiliary::index_order_into;

let mut order = [0usize; 3];
index_order_into(&[4, 1, 2], &mut order).unwrap();
assert_eq!(order, [3, 1, 2]);