[Numpy-discussion] incorporating C/C++ code

Louis Cordier lcordier at point45.com
Thu Jun 29 13:55:39 EDT 2006


>> For heavy number crunching I would like to include C and/or C++ functions
>> in my NumPy programs. They should have/give NumPy arrays as input/output.
>> On http://www.scipy.org/Topical_Software I find several suggestions to wrap
>> C/C++ code: SWIG, weave, Pyrex, Instant, ... but it's quite difficult for me
>> to have an idea which one I can/should use.
>>
> This is my personal preference order:
>
> 1) If you can write Fortran code --- do it and use f2py
>
> 2) If you have well-encapsulated functions to call then use
>    either weave or ctypes (both are very nice).
>
> 3) PyRex is a great option for writing a custom extension module
>    that needs a lot of capability built in.
>
> At this point I would not use SWIG or Instant.
>
> So, if Fortran is out for you, then install scipy (or install weave
> separately) and start with weave  http://www.scipy.org/Weave


Now since we are on the topic ;)

I was wondering if there where any issues with say using Psyco
with NumPy ?  http://psyco.sourceforge.net/

Then those number crunching code could still be in Python at least.
Anyone have some benchmarks/comments ?

Regards, Louis.

-- 
Louis Cordier <lcordier at point45.com> cell: +27721472305
Point45 Entertainment (Pty) Ltd. http://www.point45.org





More information about the NumPy-Discussion mailing list