1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
pub mod index_dyn_impl;
pub mod index_impl;

pub use index_impl::{Index0D, Index1D, Index2D, Index3D};

use crate::{dim::DimTrait, shape_stride::ShapeStride};

pub trait SliceTrait {
    type Dim: DimTrait;
    fn sliced_shape_stride(&self, shape: Self::Dim, stride: Self::Dim) -> ShapeStride<Self::Dim>;
    fn sliced_offset(&self, stride: Self::Dim, original_offset: usize) -> usize;
}

pub trait IndexAxisTrait {
    fn get_shape_stride<Din: DimTrait, Dout: DimTrait>(
        &self,
        shape: Din,
        stride: Din,
    ) -> ShapeStride<Dout>;
    fn offset<Din: DimTrait>(&self, stride: Din) -> usize;
}