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

Method row_mut

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

Source from the content-addressed store, hash-verified

2236 }
2237
2238 unsafe fn row_mut(&mut self, idx: usize) -> Vec<*mut C64> {
2239 assert!(idx < self.row, "Index out of range");
2240 match self.shape {
2241 Shape::Row => {
2242 let mut v: Vec<*mut C64> = vec![&mut Complex::zero(); self.col];
2243 let start_idx = idx * self.col;
2244 let p = self.mut_ptr();
2245 for (i, j) in (start_idx..start_idx + v.len()).enumerate() {
2246 v[i] = p.add(j);
2247 }
2248 v
2249 }
2250 Shape::Col => {
2251 let mut v: Vec<*mut C64> = vec![&mut Complex::zero(); self.col];
2252 let p = self.mut_ptr();
2253 for (i, slot) in v.iter_mut().enumerate() {
2254 *slot = p.add(idx + i * self.row);
2255 }
2256 v
2257 }
2258 }
2259 }
2260
2261 unsafe fn swap(&mut self, idx1: usize, idx2: usize, shape: Shape) {
2262 match shape {

Callers 2

row_mut_mapMethod · 0.45
swapMethod · 0.45

Calls 3

mut_ptrMethod · 0.45
lenMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected