C-extensions for NumPy code available.
![](https://secure.gravatar.com/avatar/4b748d7edc52453d8470f5307b52db07.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/5c9fb379c4e97b58960d74dcbfc5dee5.jpg?s=120&d=mm&r=g)
On Fri, Dec 08, 2006 at 07:33:47AM -0800, Lou Pecora wrote:
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.
I think the scipy wiki ( http://www.scipy.org ) is the best way. You can create an account and start a sub-page of http://scipy.org/Cookbook/C_Extensions and modify this page. Gaƫl
![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
Lou Pecora wrote:
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.
Temporarily, you can write up a wiki page about it on www.scipy.org and attach the tarball to the page. Once we can look at the contents a bit more, we might have better ideas where they can go. Possibly, they can go into the numpy distribution as examples. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
![](https://secure.gravatar.com/avatar/4b748d7edc52453d8470f5307b52db07.jpg?s=120&d=mm&r=g)
This is a good idea, but I'm afraid I have no idea how to even start this process. I've never done anything on a Wiki. Is there some tutorial for newbies like me? Maybe I missed a link to one there. Thanks. -- Lou Pecora --- Robert Kern <robert.kern@gmail.com> wrote:
Temporarily, you can write up a wiki page about it on www.scipy.org and attach the tarball to the page. Once we can look at the contents a bit more, we might have better ideas where they can go. Possibly, they can go into the numpy distribution as examples.
-- Robert Kern
____________________________________________________________________________________ Any questions? Get answers on any topic at www.Answers.yahoo.com. Try it now.
![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
Lou Pecora wrote:
This is a good idea, but I'm afraid I have no idea how to even start this process. I've never done anything on a Wiki. Is there some tutorial for newbies like me? Maybe I missed a link to one there.
http://www.scipy.org/HelpContents http://www.scipy.org/HelpForBeginners -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
participants (3)
-
Gael Varoquaux
-
Lou Pecora
-
Robert Kern