leto-ops 0.45.2

Math, reduction, SIMD, and parallel kernels for Leto arrays
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#[inline]
pub(super) fn decode_index<const N: usize>(
    mut flat: usize,
    shape: &[usize; N],
    index: &mut [usize; N],
) {
    for axis in (0..N).rev() {
        let extent = shape[axis];
        if extent == 0 {
            index[axis] = 0;
        } else {
            index[axis] = flat % extent;
            flat /= extent;
        }
    }
}