MatIndex

Trait MatIndex 

Source
pub trait MatIndex {
    type Rows: Copy + Eq + Debug;
    type Cols: Copy + Eq + Debug;
    type Index: Copy;
    type LayoutTransform: Copy;
    type Item;
    type Dyn: MatIndex<Dyn = Self::Dyn, LayoutTransform = Self::LayoutTransform, Item = Self::Item, Slice = Self::Slice>;
    type Slice: for<'a> SliceFamily<'a, Self::Item>;

    // Required methods
    fn nrows(this: &Self) -> Self::Rows;
    fn ncols(this: &Self) -> Self::Cols;
    unsafe fn get_slice_unchecked<'a>(
        this: &'a mut Self,
        idx: Self::Index,
        n_elems: usize,
    ) -> <Self::Slice as SliceFamily<'a, Self::Item>>::Slice;
    unsafe fn from_dyn_idx(idx: <Self::Dyn as MatIndex>::Index) -> Self::Index;
    unsafe fn get_unchecked(this: &mut Self, index: Self::Index) -> Self::Item;
    unsafe fn next_unchecked<'a>(
        slice: &mut <Self::Slice as SliceFamily<'a, Self::Item>>::Slice,
    ) -> Self::Item;
    fn is_contiguous(this: &Self) -> bool;
    fn preferred_layout(this: &Self) -> Self::LayoutTransform;
    fn with_layout(this: Self, layout: Self::LayoutTransform) -> Self::Dyn;
}
Expand description

type with a given matrix shape

Required Associated Types§

Source

type Rows: Copy + Eq + Debug

type of rows

Source

type Cols: Copy + Eq + Debug

type of columns

Source

type Index: Copy

indexing type

Source

type LayoutTransform: Copy

layout transformation type

Source

type Item

item produced by the zip views

Source

type Dyn: MatIndex<Dyn = Self::Dyn, LayoutTransform = Self::LayoutTransform, Item = Self::Item, Slice = Self::Slice>

matrix type with type erased dimensions

Source

type Slice: for<'a> SliceFamily<'a, Self::Item>

Required Methods§

Source

fn nrows(this: &Self) -> Self::Rows

returns the number of rows

Source

fn ncols(this: &Self) -> Self::Cols

returns the number of columns

Source

unsafe fn get_slice_unchecked<'a>( this: &'a mut Self, idx: Self::Index, n_elems: usize, ) -> <Self::Slice as SliceFamily<'a, Self::Item>>::Slice

returns slice at index of length n_elems

Source

unsafe fn from_dyn_idx(idx: <Self::Dyn as MatIndex>::Index) -> Self::Index

converts a type erased index back to its original representation

Source

unsafe fn get_unchecked(this: &mut Self, index: Self::Index) -> Self::Item

get the item at the given index, skipping bound checks

Source

unsafe fn next_unchecked<'a>( slice: &mut <Self::Slice as SliceFamily<'a, Self::Item>>::Slice, ) -> Self::Item

get the item at the given slice position, skipping bound checks

Source

fn is_contiguous(this: &Self) -> bool

checks if the zip matrices are contiguous

Source

fn preferred_layout(this: &Self) -> Self::LayoutTransform

computes the preferred iteration layout of the matrices

Source

fn with_layout(this: Self, layout: Self::LayoutTransform) -> Self::Dyn

applies the layout transformation to the matrices

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'b, T, Len: Shape, Strd: Stride> MatIndex for ColMut<'b, T, Len, Strd>

Source§

impl<'b, T, Len: Shape, Strd: Stride> MatIndex for ColRef<'b, T, Len, Strd>

Source§

impl<'b, T, Len: Shape, Strd: Stride> MatIndex for RowMut<'b, T, Len, Strd>

Source§

impl<'b, T, Len: Shape, Strd: Stride> MatIndex for RowRef<'b, T, Len, Strd>

Source§

impl<'b, T, Rows: Shape, Cols: Shape, RStride: Stride, CStride: Stride> MatIndex for MatMut<'b, T, Rows, Cols, RStride, CStride>

Source§

impl<'b, T, Rows: Shape, Cols: Shape, RStride: Stride, CStride: Stride> MatIndex for MatRef<'b, T, Rows, Cols, RStride, CStride>

Source§

type Cols = Cols

Source§

type Dyn = Mat<Ref<'b, T>>

Source§

type Index = (<Rows as ShapeIdx>::Idx<usize>, <Cols as ShapeIdx>::Idx<usize>)

Source§

type Item = &'b T

Source§

type LayoutTransform = MatLayoutTransform

Source§

type Rows = Rows

Source§

type Slice = SliceRef<'b, T>

Source§

impl<Rows: Copy + Eq + Debug, Cols: Copy + Eq + Debug, L: MatIndex<Rows = Rows, Cols = Cols>, R: MatIndex<Rows = Rows, Cols = Cols, Index = L::Index, LayoutTransform = L::LayoutTransform>> MatIndex for ZipEq<Rows, Cols, L, R>
where R::Dyn: MatIndex<Rows = <L::Dyn as MatIndex>::Rows, Cols = <L::Dyn as MatIndex>::Cols, Index = <L::Dyn as MatIndex>::Index>,

Source§

type Cols = <L as MatIndex>::Cols

Source§

type Dyn = ZipEq<<<L as MatIndex>::Dyn as MatIndex>::Rows, <<L as MatIndex>::Dyn as MatIndex>::Cols, <L as MatIndex>::Dyn, <R as MatIndex>::Dyn>

Source§

type Index = <L as MatIndex>::Index

Source§

type Item = Zip<<L as MatIndex>::Item, <R as MatIndex>::Item>

Source§

type LayoutTransform = <L as MatIndex>::LayoutTransform

Source§

type Rows = <L as MatIndex>::Rows

Source§

type Slice = Zip<<L as MatIndex>::Slice, <R as MatIndex>::Slice>

Source§

impl<Rows: Copy + Eq + Debug, Cols: Copy + Eq + Debug, Mat: MatIndex<Rows = Rows, Cols = Cols>> MatIndex for LastEq<Rows, Cols, Mat>

Source§

type Cols = <Mat as MatIndex>::Cols

Source§

type Dyn = LastEq<<<Mat as MatIndex>::Dyn as MatIndex>::Rows, <<Mat as MatIndex>::Dyn as MatIndex>::Cols, <Mat as MatIndex>::Dyn>

Source§

type Index = <Mat as MatIndex>::Index

Source§

type Item = Last<<Mat as MatIndex>::Item>

Source§

type LayoutTransform = <Mat as MatIndex>::LayoutTransform

Source§

type Rows = <Mat as MatIndex>::Rows

Source§

type Slice = Last<<Mat as MatIndex>::Slice>