I am working on a project where I am doing some interfacing with numpy
arrays at a C level.
One thing that I want to do (using pyrex) is to call numpy functions, then
directly access the underlying double * array of the resulting ndarray and
operate on it in C/pyrex (I don't want to copy it). I want to ensure that
the underlying double * wont be deallocated until I'm ready. I was going to
take the resulting ndarray and set the ownership bit of the result to 0 and
then I would be responsible for deallocating the memory when I was ready.
Contrary to what I expected I noticed that it seems all numpy functions, for
example numpy.linalg.pinv as well as numpy.linalg.eig return matrices that
don't own their data.
(If m is a numpy array)
n=numpy.linalg.pinv(m)
n.flags
shows that n does not own its data.
So I can't take their underlying data * with any certaintly that it won't be
deallocated before I'm ready. If n doesn't own its data, who does. Is there
a safe way to do what I want?
Thanks,
Josh
_________________________________________________________________
The MSN Entertainment Guide to Golden Globes is here. Get all the scoop.
http://tv.msn.com/tv/globes2007/?icid=nctagline2
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion