[Basic Question] What is the difference in usage between numpy
and ndarray
key crates?
#387
-
I have been working with the Now, my questions is, what are the key differences in usage between |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
This crate integrates NumPy and The key functionality to enable this is that your |
Beta Was this translation helpful? Give feedback.
-
Hi @adamreichold, am I correct in understanding that passing a Rust Is there a way to avoid consumption or copying? |
Beta Was this translation helpful? Give feedback.
This crate integrates NumPy and
ndarray
and it is used to implement Python extensions using the PyO3 bindings which provide their Python API in terms of NumPy types but internally work on these arrays usingndarray
.The key functionality to enable this is that your
#[pyfunction]
can take for example aPyReadonlyArray2<f64>
to reference the NumPy array passed in on the Python side and usePyReadonlyArray::as_array
to turn this into aArrayView2<f64>
without copying the underlying data which you can operate on using the functionality provided byndarray
.