[SciPy-user] Swig and Numpy arrays
Matthieu Brucher
matthieu.brucher at gmail.com
Thu Jan 8 07:41:08 EST 2009
2009/1/8 Justin Bayer <bayer.justin at googlemail.com>:
>> In fact numpy typemaps extract the size of the array, so if I
>> understand correctly, this is what you don't want. So you only have to
>> delete this part of the typemap.
>
> Is there an elegant way to do this with reusing as much functionality
> of numpy.i as possible?
>
> I tried to just make my own typemap for this purpose and also a
> typemaps, but moved it out of the "fragment". No some functions which
> are defined in a numpy fragment are missing. %fragment seems to be a
> fairly underdocumented feature of swig, and I don't know how to
> elegantly get access to those functions except copypasting them
> somewhere, which gives me the shivers.
You will have to copy and paste the typemaps.
The other solution is to create a new method with SWIG that will have
additional parameters. The drawback is that you will have an
additional routine level, but there are several advantages: you will
use numpy.i, you can add checks inside your custom method, ...
Matthieu
--
Information System Engineer, Ph.D.
Website: http://matthieu-brucher.developpez.com/
Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn: http://www.linkedin.com/in/matthieubrucher
More information about the SciPy-User
mailing list