Hi,

First time post, and pretty new to numpy. I'm wrapping another library 
(SUNDIALS) in python, using ctypes, and was wondering if
there were a way to create an ndarray python object around an array 
(ctypes.c_float*32, for example) without copying it?

For example, I have an array created using ctypes

----
import ctypes
import numpy

ctarray = (ctypes.c_float*32)()
----

And want to create an ndarray such that both the ndarray and the ctypes array 
are using the same actual memory area. The reason
for doing this this, is because using numpy methods to manipulate the contents 
of 'ctarray' may be useful to some people, and
the array should optimally be changed in place, rather than creating a copy as 
an ndarray, manipulating, then copying back. Of
course, if the ndarray object were garbage collected, the memory allocated for 
the actual array shouldn't be deallocated. Is
this possible?

Thanks,
James
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to