(&mut self, row: &[T])
| 667 | } |
| 668 | |
| 669 | pub fn add_row(&mut self, row: &[T]) { |
| 670 | |
| 671 | if self.rows() == 0 { |
| 672 | self.ncols = row.len(); |
| 673 | } else { |
| 674 | if self.cols() != row.len() { |
| 675 | panic!("Invalid dimension."); |
| 676 | } |
| 677 | } |
| 678 | self.nrows += 1; |
| 679 | for i in row { |
| 680 | self.data.push(i.clone()); |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | /// Extends the current matrix by putting the matrix `m` below it. |
| 685 | pub fn push_matrix_below(&self, m: &Matrix<T>) -> Option<Matrix<T>> { |