Trait TIndex

Source
pub trait TIndex {
    // Required methods
    fn inc_ro(&mut self, shape: &[usize]);
    fn dec_ro(&mut self, shape: &[usize]);
    fn inc_co(&mut self, shape: &[usize]);
    fn dec_co(&mut self, shape: &[usize]);
    fn is_zero(&mut self) -> bool;
    fn to_pos(&self, shape: &[usize], strides: &[usize]) -> usize;
}
Expand description

A trait which adds indexing functions to simplify index manipulation.

Required Methods§

Source

fn inc_ro(&mut self, shape: &[usize])

Increment an index in the row-major order.

Source

fn dec_ro(&mut self, shape: &[usize])

Decrement an index in the row-major order.

Source

fn inc_co(&mut self, shape: &[usize])

Increment an index in the column-major order.

Source

fn dec_co(&mut self, shape: &[usize])

Decrement an index in the column-major order.

Source

fn is_zero(&mut self) -> bool

Return true if the index is zero for all dimensions.

Source

fn to_pos(&self, shape: &[usize], strides: &[usize]) -> usize

Compute the resulting position in a linear storage array.

Implementations on Foreign Types§

Source§

impl TIndex for [usize]

Source§

fn inc_ro(&mut self, shape: &[usize])

Source§

fn dec_ro(&mut self, shape: &[usize])

Source§

fn inc_co(&mut self, shape: &[usize])

Source§

fn dec_co(&mut self, shape: &[usize])

Source§

fn is_zero(&mut self) -> bool

Source§

fn to_pos(&self, shape: &[usize], strides: &[usize]) -> usize

Implementors§