MCPcopy Create free account
hub / github.com/daniel-e/rustml / get

Method get

src/matrix.rs:554–560  ·  view source on GitHub ↗

Returns the element of the matrix at row `row` (indexing starts at zero) and column `col` or `None` if row or column does not exist. ``` # #[macro_use] extern crate rustml; use rustml::*; # fn main() { let m = mat![ 1.0, 1.5; 2.0, 2.5; 5.0, 5.5 ]; assert_eq!(m.get(0, 1).unwrap(), &1.5); assert_eq!(m.get(2, 0).unwrap(), &5.0); assert!(m.get(3, 0).is_none()); # } ```

(&self, row: usize, col: usize)

Source from the content-addressed store, hash-verified

552 /// # }
553 /// ```
554 pub fn get(&self, row: usize, col: usize) -> Option<&T> {
555
556 match self.idx(row, col) {
557 None => None,
558 Some(p) => self.data.get(p)
559 }
560 }
561
562 // TODO test
563 pub fn get_mut(&mut self, row: usize, col: usize) -> Option<&mut T> {

Callers 8

visitedMethod · 0.80
neighboursMethod · 0.80
get_clusterMethod · 0.80
nextMethod · 0.80
classifyFunction · 0.80
from_sliceMethod · 0.80
test_fontFunction · 0.80
mainFunction · 0.80

Calls 1

idxMethod · 0.80

Tested by 1

test_fontFunction · 0.64