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

Method col_ptr

src/traits/pointer.rs:322–343  ·  view source on GitHub ↗
(&self, idx: usize)

Source from the content-addressed store, hash-verified

320 }
321
322 unsafe fn col_ptr(&self, idx: usize) -> Vec<*const f64> {
323 assert!(idx < self.col, "Index out of range");
324 match self.shape {
325 Shape::Col => {
326 let mut v: Vec<*const f64> = vec![&0f64; self.row];
327 let start_idx = idx * self.row;
328 let p = self.ptr();
329 for (i, j) in (start_idx..start_idx + v.len()).enumerate() {
330 v[i] = p.add(j);
331 }
332 v
333 }
334 Shape::Row => {
335 let mut v: Vec<*const f64> = vec![&0f64; self.row];
336 let p = self.ptr();
337 for (i, elem) in v.iter_mut().enumerate() {
338 *elem = p.add(idx + i * self.col);
339 }
340 v
341 }
342 }
343 }
344}

Callers

nothing calls this directly

Calls 3

ptrMethod · 0.45
lenMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected