Ignore axes with dimension==1 for contiguous flags
Hey, Numpy currently assumes that if "ndim > 1" then it is impossible for any array to be both C- and F-contiguous, however an axes of dimension 1 does have no effect on the memory layout. I think I have made most important changes (actually really very few), though I bet some parts of numpy still need adapting because of smaller quirks: https://github.com/seberg/numpy/compare/master...cflags This example sums up two advantages. On that branch: In [9]: a = np.arange(9).reshape(3,3)[::3,:] In [10]: a.flags.contiguous, a.flags.fortran Out[10]: (True, True) Note that currently _both_ are false, because numpy does not reset the strides for the first dimension. The only real problem I see is that someone who assumes that for a contiguous array strides[0] or strides[-1] is elemsize has to change the code or face segmentation faults, but maybe I am missing something big? Any comments if this is the right idea? And if where would more changes be needed? Regards, Sebastian
participants (1)
-
Sebastian Berg