-
Is there a way to obtain the address of a JavaCPP array (e.g. IntPointer) that is usable in numpy in python? Similar to how ctypes is used for C when a C program output some variable
I am trying to create a numpy array in python from the output of a library running in Java (called from python). I tried to pass the p.address long pointer in place of the ctypes pointer into numpy but that did not seem to work (e.g. Any advice is greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Yes we can do that. There's a working example doing matrix multiplication using data from Java here: |
Beta Was this translation helpful? Give feedback.
-
Thanks for pointing to the MatMul example. I should have clarified, I'm trying to use the numpy object in python rather than in java. My library that is using JavaCPP is running in Java and I have an API exposed to python. So after studying the MatMul example a bit, I did manage to get this working.
I do have a follow-up question. Do you have some suggestions on how we can do this for a GPU array? So have |
Beta Was this translation helpful? Give feedback.
Yes we can do that. There's a working example doing matrix multiplication using data from Java here:
https://github.com/bytedeco/javacpp-presets/blob/master/numpy/samples/MatMul.java