[Numpy-discussion] fortran array storage question

Georg Holzmann grh@mur...
Thu Oct 25 15:25:38 CDT 2007


Hallo!

I have the following problem: I get a data array in column major storage 
order and want to use it as numpy array without copying data.

Therefore I do the following (2D example):

   obj = PyArray_FromDimsAndData(2, dim0, PyArray_DOUBLE, (char*)data);
   PyArrayObject *tmp = (PyArrayObject*)obj;
   tmp->flags = NPY_FARRAY;

In python I can see that the flag F_CONTIGUOUS is true, but the python 
numpy array is still displayed in the wrong (C-style) order, same as if 
I don't set the NPY_FARRAY flag.

Do I have to consider something more - or are there any other problems ? 
(sorry - I'm new to numpy ;)

Thanks for any hint,
LG
Georg


More information about the Numpy-discussion mailing list