[Numpy-discussion] fortran array storage question

Georg Holzmann grh@mur...
Fri Oct 26 07:30:57 CDT 2007


I found now a way to get the 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;

if in that example I also change the strides:

   int s = tmp->strides[1];
   tmp->strides[0] = s;
   tmp->strides[1] = s * dim0[0];

Then I get in python the fortran-style array in right order.

However, I don't know if this is the usual way or if it has a 
performance overhead ...


More information about the Numpy-discussion mailing list