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)
| 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> { |