switching from Numeric to numpy
I have the following C code which is an extension to my python code.
The python and C code use
#include
On Mon, Oct 7, 2013 at 5:27 PM, john fernando
I have the following C code which is an extension to my python code.
The python and C code use #include
what is the equivalent I can use in numpy that causes the minimum code change?
I did look through the old messages but didn't really find the answer-any help to a novice just starting out in numpy/python/C is much appreciated.
I haven't done any porting myself, but you might want to look at
numpy/oldnumeric to see how compatibility is done. That module is gone in
numpy master, but is included in earlier versions. As to the include, for
numpy it is `
John, Just noticed this message, We are already cleaning up all of our code to not be numpy based but for porting from Numeric to numpy: In our C code we settled for the following, #define NUMPY #if !defined(NUMPY) #include "arrayobject.h" #else #include "numpy/oldnumeric.h" #endif And this, #ifdef NUMPY pyArray = (PyArrayObject *) PyArray_SimpleNew( 1, dims, PyArray_DOUBLE); #else pyArray = (PyArrayObject *) PyArray_FromDims( 1, dims, PyArray_DOUBLE); #endif And I think that was all the changes we needed and while we were transitioning we could easily compile for Numeric or numpy. Most of our headaches were on the python code because of very subtle things but even there, the bulk of the changes worked out rather nicely using the oldnumeric stuff. Raul On 07/10/2013 5:27 PM, john fernando wrote:
I have the following C code which is an extension to my python code.
The python and C code use #include
what is the equivalent I can use in numpy that causes the minimum code change?
I did look through the old messages but didn't really find the answer-any help to a novice just starting out in numpy/python/C is much appreciated.
____________________________________________________________ FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family! Visit http://www.inbox.com/photosharing to find out more!
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (3)
-
Charles R Harris
-
john fernando
-
Raul Cota