-
I have a numpy array of numpy arrays of floats that I wish to pass to a c++ function that will read and modify the data as if it were a std::vector. What would the c++ argument type be for: This type declaration: I can't see to get this type declaration to work: I have searched through documentation, github issues and examples I can find online but have not found anything that works or that I can make sense of, if anyone could help me with this, it would be much appreciated :) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Can you add some reproducer? It seems quite unusual to encounter such error since pybind has a great basic out-of-the-box support for numpy. Did you try using just replacing dtype with |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply - sorry for the delayed response. |
Beta Was this translation helpful? Give feedback.
Thanks for the reply - sorry for the delayed response.
I got an answer on stack overflow which works, effectively using Eigen Matrices:
https://stackoverflow.com/questions/69831285/pybind11-how-to-pass-an-n-dimentional-numpy-array-from-python-c
The conversion is automatic and using the Eigen::Ref, there is no copying of data