numpy/numpy — pull request #2694 by seberg (2012-10-22 11:34:10+00:00)
Title: ENH: Make 1-dimensional axes not matter for contiguous flags

This PR implements that ie. a 1x3x1 array will be both C- and F-Contiguous (or neither). I have mentioned this before and cleaned up the branch a little against current master and I though I am not completly certain I think it should cover the change fully. I am not sure if the tests should be done differently or more extensive though.

Personally I see only one possible problem with it, and that is external libraries relying on `strides[-1] == itemsize` (for C-contiguous arrays) or `strides[0] == itemsize` (for F-Contiguous arrays). They could break in very bad ways then. I doubt this should be common or even occur, but there was code in numpy itself that relied on it.

I have run `scipy.test()` (admittingly old ubuntu) with this as well and no (new) errors occured even when I filled bogus values for the 1-dim strides in array creation. I have checked numpy test for that as well.reverted that change to it to fix Issue #434 with wrong sorting and included it here since the rest of this commit makes that kind of special casing unnecessary (so I am not sure the fix is quite correct outside of this context).

I have also removed some strides cleanup code, I don't really see much of a point to make strides look nice when it doesn't do anything else.

Because I am not sure what the special casing in `CreateSortedStridePerm` was for and I thought it might be to ensure contiguouity of the new array in some cases, I have reverted that change to it to fix Issue #434 with wrong sorting and included it here since the rest of this commit makes that kind of special casing unnecessary (so I am not sure the fix is quite correct outside of this context).