Skip to content

Zero Copy getter for struct of ndarrays in rust to python #385

Answered by adamreichold
sdrap asked this question in Q&A
Discussion options

You must be logged in to vote

if a struct is written as a [#pyclass(frozen)] and use PyArray then it works zero copy (as above)

Sorry if I mislead you there but the frozen part is completely optional for this to be zero-copy. It is just more efficient if you only store references to Python objects, i.e. Py<T>. The guide has some information on that.

will consume the underlying array and therefore in the use of a separate standalone library will necessitate a copy.

You mean if using that library prevents you from consuming the arrays?

I was wondering if there is a way to have a standalone library with ndarrays and interfacing their struct and implementations with a simple wrapping #[pyclass] zero copy with pyo3 (a…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@sdrap
Comment options

@adamreichold
Comment options

@sdrap
Comment options

@adamreichold
Comment options

Answer selected by sdrap
@sdrap
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants