Replaces the element at row `row` (indexing starts at zero) and column `col` with the new value `newval`. Returns true on success and false on failure, i.e. if the row or column does not exist. ``` # #[macro_use] extern crate rustml; use rustml::*; # fn main() { let mut m = mat![ 1.0, 1.5; 2.0, 2.5; 5.0, 5.5 ]; assert_eq!(m.get(1, 0).unwrap(), &2.0); m.set(1, 0, 8.0); assert_eq!(m.get(1, 0).unwr
(&mut self, row: usize, col: usize, newval: T)
| 643 | /// # } |
| 644 | /// ``` |
| 645 | pub fn set(&mut self, row: usize, col: usize, newval: T) -> bool { |
| 646 | |
| 647 | match self.idx(row, col) { |
| 648 | None => false, |
| 649 | Some(p) => match self.data.get_mut(p) { |
| 650 | Some(val) => { |
| 651 | *val = newval; |
| 652 | true |
| 653 | } |
| 654 | None => false, |
| 655 | } |
| 656 | } |
| 657 | } |
| 658 | |
| 659 | pub fn map<F, U>(&self, f: F) -> Matrix<U> |
| 660 | where F: FnMut(&T) -> U { |