MCPcopy Create free account
hub / github.com/Axect/Peroxide / apply

Method apply

src/structure/sparse.rs:123–134  ·  view source on GitHub ↗
(&self, rhs: &Vec<f64>)

Source from the content-addressed store, hash-verified

121
122impl 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

Callers 1

mulMethod · 0.45

Calls 3

row_icsMethod · 0.80
dataMethod · 0.80
col_ptrMethod · 0.45

Tested by

no test coverage detected