Trait rustlearn::array::traits::IndexableMatrix
[−]
[src]
pub trait IndexableMatrix {
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;
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) { ... }
}Trait representing a shaped matrix whose entries can be accessed at will using their row and column position.
Required Methods
fn rows(&self) -> usize
Return the number of rows of the matrix.
fn cols(&self) -> usize
Return the number of columns of the matrix.
unsafe fn get_unchecked(&self, row: usize, column: usize) -> f32
Get the value of the entry at (row, column) without bounds checking.
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
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.
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.
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.
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
impl IndexableMatrix for Arrayimpl IndexableMatrix for SparseRowArrayimpl IndexableMatrix for SparseColumnArray