[Numpy-discussion] slight MapIter change

Sebastian Berg sebastian at sipsolutions.net
Sat May 11 11:41:25 EDT 2013


Hey,

(this is only interesting if you know what MapIter and actually use it)

In case anyone already uses the newly exposed mapiter (it was never
released yet). There is a tiny change, which only affects indexes that
start with np.newaxis but otherwise just simplifies a tiny bit. The old
block for swapping axes should be changed like this:

     if ((mit->subspace != NULL) && (mit->consec)) {
-        if (mit->iteraxes[0] > 0) {
-            PyArray_MapIterSwapAxes(mit, (PyArrayObject **)&arr, 0);
-            if (arr == NULL) {
-                return -1;
-            }
+        PyArray_MapIterSwapAxes(mit, (PyArrayObject **)&arr, 0);
+        if (arr == NULL) {
+            return -1;
         }
     }

Regards,

Sebastian




More information about the NumPy-Discussion mailing list