numpy/numpy — pull request #2735 by seberg (2012-11-14 00:14:36+00:00)
Title: REV: 8daf144 and following. Strides must be clean to be contiguous

This reverts those parts of PR gh-2694 that were directly related to the change in flag logic, since it seems that too much code relies at least on mostly clean strides. See also the discussion there.

Some changes remain:

1. 0-sized arrays are handled somewhat more stricter, forcing them to have matching strides including the dimension of size 0. (This means an array with `itemsize=8`, `strides=(16,)` and `shape=(0,)` is *not* contiguous). This is mostly so that its really always true that if C-Contiguous then `strides[-1] == itemsize`, and I can't see it hurting, and it "fixes" a corner case in scikits-learn.
2. 0-sized arrays can be both C- and F-Contiguous.
3. 1-sized arrays will be both C- and F-Contiguous (or neither).

Though I would consider 2 and 3 fixes.

On a side note, I think there should be code to clean up strides a little (better). This applies to:
1. Newaxis in slicing operations
2. Copy with Keeporder
3. reduce operations with Keepdims=True

Oh, I think the `ISONESEGMENT` should at least a bit more accurately check for `SIZE < 1`, the `NDIM` check is superfluous anyway.