On Tue, Feb 21, 2017 at 3:05 PM, Alex Rogozhnikov <
[email protected]> wrote:

> a question about numpy.recarray:
> There is a parameter order in constructor https://docs.scipy.org/doc/
> numpy-1.10.1/reference/generated/numpy.recarray.html, but it seems to
> have no effect:
> x = numpy.recarray(dtype=[('a', int), ('b', float)], shape=[1000],
> order='C')
>

you are creating a 1D array here -- there is no difference between Fortran
and C order for a 1D array. For 2D:

In [2]: x = numpy.recarray(dtype=[('a', int), ('b', float)], shape=[10,10],
order='C')


In [3]: x.strides
Out[3]: (160, 16)


In [4]: y = numpy.recarray(dtype=[('a', int), ('b', float)], shape=[10,10],
order='F')


In [5]: y.strides
Out[5]: (16, 160)

note the easier way to get the strides, too :-)

-CHB



-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[email protected]
_______________________________________________
NumPy-Discussion mailing list
[email protected]
https://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to