(&self, rhs: &Vec<f64>)
| 121 | |
| 122 | impl LinearOp<Vec<f64>, Vec<f64>> for SPMatrix { |
| 123 | fn apply(&self, rhs: &Vec<f64>) -> Vec<f64> { |
| 124 | let mut y = vec![0f64; self.row]; |
| 125 | let col_ptr = self.col_ptr(); |
| 126 | let row_ics = self.row_ics(); |
| 127 | let data = self.data(); |
| 128 | for j in 0..self.col { |
| 129 | for i in col_ptr[j]..col_ptr[j + 1] { |
| 130 | y[row_ics[i]] += data[i] * rhs[j]; |
| 131 | } |
| 132 | } |
| 133 | y |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | /// Linear algebra for sparse matrix |