zenu_matrix/index/
mod.rs

1#![expect(clippy::module_name_repetitions)]
2
3pub mod index_dyn_impl;
4pub mod index_impl;
5
6pub use index_impl::{Index0D, Index1D, Index2D, Index3D};
7
8use crate::{dim::DimTrait, shape_stride::ShapeStride};
9
10pub trait SliceTrait: Copy {
11    type Dim: DimTrait;
12    fn sliced_shape_stride(&self, shape: Self::Dim, stride: Self::Dim) -> ShapeStride<Self::Dim>;
13    fn sliced_offset(&self, stride: Self::Dim) -> usize;
14}
15
16pub trait IndexAxisTrait: Copy {
17    fn get_shape_stride<Din: DimTrait, Dout: DimTrait>(
18        &self,
19        shape: Din,
20        stride: Din,
21    ) -> ShapeStride<Dout>;
22    fn offset<Din: DimTrait>(&self, stride: Din) -> usize;
23}