[Numpy-discussion] switching from Numeric to numpy
Raul Cota
raul at virtualmaterials.com
Fri Oct 18 16:34:44 EDT 2013
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 <Numeric/arrayobject.h>
>
> 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 at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
More information about the NumPy-Discussion
mailing list