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

Travis Oliphant oliphant.travis at ieee.org
Thu Jun 29 13:48:21 EDT 2006

Joris De Ridder wrote:
> Hi,
> 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

If you can compile your C/C++ functions as a shared-library, then 
check-out ctypes as well.


> So, a few questions:
> Any suggestion for which package I should use? Does this heavily depend
> for which purpose I want to use it?
> Where can I find the docs for Weave? I find several links on the internet
> pointing to http://www.scipy.org/documentation/weave for more info,
> but there is nothing anymore.
> Thanks in advance,
> Joris
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion

More information about the NumPy-Discussion mailing list