devela/num/geom/metric/
stride.rs

1// devela::num::geom::metric::stride
2//
3//! Defines [`Stride`].
4//
5
6/// A step size for traversing dimensions or repetitions.
7///
8/// `Stride` defines the spacing between adjacent elements in a structured layout.
9/// It does not define structure itself, but rather **how elements are accessed within it**.
10///
11/// - In **1D**, `Stride<T, 1>` represents uniform step spacing (e.g. sampling rate).
12/// - In **nD**, `Stride<T, N>` defines the step sizes across `N` dimensions.
13///
14/// Common applications:
15/// - **Numerical computing** (matrix row/column strides)
16/// - **Memory layouts** (pixel buffers, structured arrays)
17/// - **Geometric traversal** (lattices, grids, fractal stepping)
18#[must_use]
19#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
20pub struct Stride<T, const D: usize> {
21    /// Step sizes per dimension.
22    pub step: [T; D],
23}