Trait IndexableMatrix

Source
pub trait IndexableMatrix {
    // Required methods
    fn rows(&self) -> usize;
    fn cols(&self) -> usize;
    unsafe fn get_unchecked(&self, row: usize, column: usize) -> f32;
    unsafe fn get_unchecked_mut(
        &mut self,
        row: usize,
        column: usize,
    ) -> &mut f32;

    // Provided methods
    fn get(&self, row: usize, column: usize) -> f32 { ... }
    fn get_mut(&mut self, row: usize, column: usize) -> &mut f32 { ... }
    fn set(&mut self, row: usize, column: usize, value: f32) { ... }
    unsafe fn set_unchecked(&mut self, row: usize, column: usize, value: f32) { ... }
}
Expand description

Trait representing a shaped matrix whose entries can be accessed at will using their row and column position.

Required Methods§

Source

fn rows(&self) -> usize

Return the number of rows of the matrix.

Source

fn cols(&self) -> usize

Return the number of columns of the matrix.

Source

unsafe fn get_unchecked(&self, row: usize, column: usize) -> f32

Get the value of the entry at (row, column) without bounds checking.

Source

unsafe fn get_unchecked_mut(&mut self, row: usize, column: usize) -> &mut f32

Get a mutable reference to the value of the entry at (row, column) without bounds checking.

Provided Methods§

Source

fn get(&self, row: usize, column: usize) -> f32

Get the value of the entry at (row, column).

§Panics

Will panic if the element accessed is out of bounds.

Source

fn get_mut(&mut self, row: usize, column: usize) -> &mut f32

Get a mutable reference to value of the entry at (row, column).

§Panics

Will panic if the element accessed is out of bounds.

Source

fn set(&mut self, row: usize, column: usize, value: f32)

Set the value of the entry at (row, column) to value.

§Panics

Will panic if the element accessed is out of bounds.

Source

unsafe fn set_unchecked(&mut self, row: usize, column: usize, value: f32)

Set the value of the entry at (row, column) to value without bounds checking.

Implementors§