[Numpy-discussion] ANN: numpy.i - added managed deallocation to ARGOUTVIEW_ARRAY1 (ARGOUTVIEWM_ARRAY1)
Egor Zindy
ezindy at gmail.com
Thu Jan 8 11:22:19 EST 2009
Hello list,
I've moved my wiki to the scipy cookbook:
http://www.scipy.org/Cookbook/SWIG_Memory_Deallocation
For the time being, the listed example files are still stored on the google
code SVN, but these could easily be moved if necessary.
I've also just finished adding an ARGOUTVIEWM_ARRAY2 example. The example
shows how to return a two-dimensional array from C which also benefits from
the automatic memory deallocation.
A naive "crop" function is wrapped using SWIG/numpy.i and returns a slice of
the input array. When used as
array_out = crop.crop(array_in, d1_0,d1_1, d2_0,d2_1)
it is equivalent to the native numpy slicing
array_out = array_in[d1_0:d1_1, d2_0:d2_1]
Hope this helps!
Regards,
Egor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090109/5dd052f9/attachment.html>
More information about the NumPy-Discussion
mailing list