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

Method col_mut

src/complex/matrix.rs:2215–2236  ·  view source on GitHub ↗
(&mut self, idx: usize)

Source from the content-addressed store, hash-verified

2213 type Scalar = C64;
2214
2215 unsafe fn col_mut(&mut self, idx: usize) -> Vec<*mut C64> {
2216 assert!(idx < self.col, "Index out of range");
2217 match self.shape {
2218 Shape::Col => {
2219 let mut v: Vec<*mut C64> = vec![&mut Complex::zero(); self.row];
2220 let start_idx = idx * self.row;
2221 let p = self.mut_ptr();
2222 for (i, j) in (start_idx..start_idx + v.len()).enumerate() {
2223 v[i] = p.add(j);
2224 }
2225 v
2226 }
2227 Shape::Row => {
2228 let mut v: Vec<*mut C64> = vec![&mut Complex::zero(); self.row];
2229 let p = self.mut_ptr();
2230 for (i, slot) in v.iter_mut().enumerate() {
2231 *slot = p.add(idx + i * self.col);
2232 }
2233 v
2234 }
2235 }
2236 }
2237
2238 unsafe fn row_mut(&mut self, idx: usize) -> Vec<*mut C64> {
2239 assert!(idx < self.row, "Index out of range");

Callers 4

col_mut_mapMethod · 0.45
luMethod · 0.45
solve_matMethod · 0.45
swapMethod · 0.45

Calls 3

mut_ptrMethod · 0.45
lenMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected