numpy/numpy — pull request #3104 by seberg (2013-03-01 20:10:04+00:00)
Title: Make AdvancedNew iter more 0-d aware

This is the old PR basically reincarnated, with some (actually relatively few) changes.

This changes the AdvancedIter to use `ndim == 0` when the iteration is 0-D. This means that unfortunately a few special need to be added, since before ndim was set to 1 for the scalar case. The approach here is to store one "axisdata" as if iteration was 1-d, and add special cases to fill and use this where necessary. I do not claim that it is the best approach, it may not be...

Since it does make some sense (and einsum "tries" to basicaly) to force 0-d iterations, the `oa_ndim` logic is changed to allow forcing a 0-D iteration if `op_axes` is not NULL. This means that `op_axes` not being NULL is important for signalling what should happen (is this ok?), and what was previously an error now makes a forced 0-d iteration. Since that seems not too great, -1 is used to signal the old 0 cleanly, but backwards compatibility doesn't allow deprecating that.

These changes enable to remove the 0-d nditer hack, and make einsum work for the 0-d special case without modification.