[SciPy-user] C-extensions for NumPy code available.

Lou Pecora lou_boog2000 at yahoo.com
Fri Dec 8 09:33:47 CST 2006


For those of you who do numerical calculations, need
to speed up your code, and use NumPy arrays:

I've written several C extensions that handle NumPy
arrays.  They are simple, but they seem to work well.
They will show you how to pass Python variables and
NumPy arrays to your C code. Once you learn how to do
it, it's pretty straight-forward. I suspect they will
suffice for most numerical code.  I've written it up
as a draft and have made the code and document file
available.  If you want a copy, just email me or post
a followup here to this message.  I will send it to
you as a tar.gzip file (only 192 KB).

Remember it is only a draft (no guarantees or
warantees) and you should test the code for your own
uses.  I would really love people who are much more
knowledgable about these things than I to look it over
and set me straight on any mistakes (like not
INREF'ing something).

In addition, is there a place I could put this up on
the web for others?  I don't have any way to do that
at my lab.  I would like to share with the Python
community since I've been helped so much on these
mailing lists.

By the way I did this after a long time of searching
for ways to speed up Python and connect with my C and
C++ code.  There are a lot of solutions out there, but
I decided that they all provided so much more than I
needed and required so much more learning time that it
wasn't worth it. I am not knocking them. I found for
my numerical needs I really only need to pass a
limited set of things (integers, floats, strings, and
NumPy arrays).  If that's your category, this code
might help you.

-- Lou Pecora
    Naval Research Lab
    Washington, DC


 
____________________________________________________________________________________
Need a quick answer? Get one in minutes from people who know.
Ask your question on www.Answers.yahoo.com


More information about the SciPy-user mailing list