[Numpy-discussion] Options for wrapping C and C++ code for use with Numeric

Bruce Southey bsouthey at gmail.com
Thu Nov 3 14:33:26 CST 2005


Hi,
I found SIWG extremely to use but it only exposes a function to Python but
not to numpy. Thus it is very slow for matrix functions. So if you want
speed then you will have to deal with the APIs.

Regards
Bruce

On 11/3/05, Chris Barker <Chris.Barker at noaa.gov> wrote:
>
> Hi all,
>
> I suddenly seem to have the need for working with a bunch of different
> existing C and C++ code, so I'm looking for a way to make it easier. I
> love NumPy, so I really want to use NumPy arrays My needs fall into
> three categories:
>
> 1) Writing custom extension code from scratch:
>
> In the past, I've done this by just using the NumPy API, but it seems
> that I shouldn't have to do all that book keeping myself.
>
> 2) Wrapping existing libraries:
>
> At the moment, I'd like to wrap Richard Shewchuk's triangle:
>
> http://www.cs.cmu.edu/~quake/triangle.html
>
> Which is straight C, as well as the Proj4 map projections library, also
> C, and there may be others.
>
> 3) Wrapping in house code, C & C++, that is under development, but I
> want to be able to use it from Python and C++, and also perhaps to write
> tests for it in Python.
>
> The options I'm looking at are:
>
> Pyrex:
>
> This seems like perhaps the easiest way to write extension code, but it
> doesn't do any automatic wrapping.
>
> Boost::Python:
>
> This looks like a very nice way to write extension modules, and it even
> appears to already include support for NumPy arrays (which ones? is that
> support being maintained, and will it support SciPy.base?)
>
> SWIG:
>
> The has the major advantage of automatically wrapping code. I see this
> as a particular strength for wrapping our in house code that is under
> development. In theory, once I've written a bunch of type maps, i can
> just re-run it whenever the code base changes.
>
>
> For each of these, I'd love to hear what people's experiences have been,
> and it would be great if anyone can point me to samples that are small
> but non-trivial. Other options I should consider would be great too.
>
>
> One more question: Should I use NumPy arrays to pass data back and forth
> between Python and C, or should I use the new array object/protocol
> instead? If so, has anyone developed examples, SWIG type maps, etc for
> this?
>
> Thanks for any feedback,
>
> -Chris
>
>
>
>
>
>
>
> --
> Christopher Barker, Ph.D.
> Oceanographer
>
> NOAA/OR&R/HAZMAT (206) 526-6959 voice
> 7600 Sand Point Way NE (206) 526-6329 fax
> Seattle, WA 98115 (206) 526-6317 main reception
>
> Chris.Barker at noaa.gov
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server.
> Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20051103/2c5763ed/attachment.html 


More information about the Numpy-discussion mailing list