[Numpy-discussion] slight MapIter change

Frédéric Bastien nouiz at nouiz.org
Mon May 13 13:10:31 EDT 2013


ok,

thanks for the associated PR.

Fred


On Mon, May 13, 2013 at 10:19 AM, Sebastian Berg <sebastian at sipsolutions.net
> wrote:

> On Mon, 2013-05-13 at 09:58 -0400, Frédéric Bastien wrote:
> > Hi,
> >
> > this is used in Theano. What is the consequence of not doing this?
> > There is people that use it, the question is how many.
> >
> There are no consequences. Only if you use the equivalent to
> `array[np.newaxis, fancy_index, <possibly more>]` the result would be
> wrong. But all code that used to work will continue to work, since such
> an index was not legal before anyway.
>
> > Is there a way to detect witch version need to be used?
> >
> There is no released version of numpy with the other definition. Also
> changing it should be safe even for someone who has an older NumPy
> development version, because as far as I can tell the check is only an
> optimization in the first place.
>
> So just remove that check and you are good. And even if someone uses a
> new numpy with an old thaeno development version, they would have to do
> weird things to run into problems.
>
> - Sebastian
>
>
> > thanks
> >
> > Fred
> >
> >
> >
> > On Sat, May 11, 2013 at 11:41 AM, Sebastian Berg
> > <sebastian at sipsolutions.net> wrote:
> >         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
> >
> >         _______________________________________________
> >         NumPy-Discussion mailing list
> >         NumPy-Discussion at scipy.org
> >         http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
> >
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion at scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130513/3bc910ce/attachment.html>


More information about the NumPy-Discussion mailing list