Re: [Numpy-discussion] slight MapIter change

2013-05-13 Thread Frédéric Bastien
ok,

thanks for the associated PR.

Fred


On Mon, May 13, 2013 at 10:19 AM, Sebastian Berg  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, ]` 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
> >  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@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
> >
> > ___
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] slight MapIter change

2013-05-13 Thread Sebastian Berg
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, ]` 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
>  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@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
> 
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] slight MapIter change

2013-05-13 Thread Frédéric Bastien
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.
Is there a way to detect witch version need to be used?

thanks

Fred


On Sat, May 11, 2013 at 11:41 AM, Sebastian Berg  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@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion