[SciPy-user] Swig and Numpy arrays
Thu Jan 8 06:18:16 CST 2009
> 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.
> Be aware that you will not have any size checks anymore, but you still
> could extract the size, compare it with your memorized size.
> 2009/1/8 Justin Bayer <firstname.lastname@example.org>:
>> Hi group,
>> I am currently trying to connect a C++ library of mine via SWIG to
>> Python/Scipy. I have several classes that have methods which expect a
>> double* as an argument of which the length is known by the object.
>> So what I want to do is to connect a method with the signature
>> (double* array) to a Numpy array. I had a look at numpy.i and its
>> typemaps, but it seems that only typemaps are supplied which also deal
>> with such bound checking behaviour in the signature. As I said, the
>> bounds are held in a field of the object.
>> What is the best way to get around this? I am fairly new to swig and
>> wanted to know if somebody else has already encountered this problem.
>> SciPy-user mailing list
> 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
> SciPy-user mailing list
P.S.: No Dogs!
More information about the SciPy-user