Create a Buffer from a numpy array (zero-copy for contiguous f64).
(array: PyReadonlyArray1<f64>)
| 53 | |
| 54 | /// Create a Buffer from a numpy array (zero-copy for contiguous f64). |
| 55 | pub fn asarray_from_numpy(array: PyReadonlyArray1<f64>) -> Buffer { |
| 56 | let slice = array.as_slice().expect("contiguous array required"); |
| 57 | Buffer::from_f64_vec(slice.to_vec()) |
| 58 | } |
| 59 | |
| 60 | #[cfg(test)] |
| 61 | mod tests { |
no outgoing calls