Re: [Numpy-discussion] Ill-defined in-place operations (#1085)

2009-04-15 Thread josef . pktd
On Wed, Apr 15, 2009 at 5:39 PM, Charles R Harris wrote: > > > On Wed, Apr 15, 2009 at 2:51 PM, Pauli Virtanen wrote: >> >> Wed, 15 Apr 2009 22:34:49 +0200, Matthieu Brucher wrote: >> >> > I think this is unavoidable. If we state clearly that every numpy >> > function assums non-pointer aliasing,

Re: [Numpy-discussion] Ill-defined in-place operations (#1085)

2009-04-15 Thread Charles R Harris
On Wed, Apr 15, 2009 at 2:51 PM, Pauli Virtanen wrote: > Wed, 15 Apr 2009 22:34:49 +0200, Matthieu Brucher wrote: > > > I think this is unavoidable. If we state clearly that every numpy > > function assums non-pointer aliasing, then people have to care about > > this themselves (like they would i

Re: [Numpy-discussion] Ill-defined in-place operations (#1085)

2009-04-15 Thread Pauli Virtanen
Wed, 15 Apr 2009 22:34:49 +0200, Matthieu Brucher wrote: > I think this is unavoidable. If we state clearly that every numpy > function assums non-pointer aliasing, then people have to care about > this themselves (like they would in Fortran, or in C++ for object-like > arrays). Nevertheless, thi

Re: [Numpy-discussion] Ill-defined in-place operations (#1085)

2009-04-15 Thread Matthieu Brucher
2009/4/15 : > On Wed, Apr 15, 2009 at 4:34 PM, Matthieu Brucher > wrote: >> I think this is unavoidable. If we state clearly that every numpy >> function assums non-pointer aliasing, then people have to care about >> this themselves (like they would in Fortran, or in C++ for object-like >> arrays

Re: [Numpy-discussion] Ill-defined in-place operations (#1085)

2009-04-15 Thread Pauli Virtanen
Wed, 15 Apr 2009 16:36:09 -0400, josef.pktd wrote: [clip] > Is there a list of gotchas for working with views that might produce > unexpected results? I don't think there is. Also, the reference manual would probably need a separate section about views. -- Pauli Virtanen __

Re: [Numpy-discussion] Ill-defined in-place operations (#1085)

2009-04-15 Thread josef . pktd
On Wed, Apr 15, 2009 at 4:34 PM, Matthieu Brucher wrote: > I think this is unavoidable. If we state clearly that every numpy > function assums non-pointer aliasing, then people have to care about > this themselves (like they would in Fortran, or in C++ for object-like > arrays). "non-pointer ali

Re: [Numpy-discussion] Ill-defined in-place operations (#1085)

2009-04-15 Thread josef . pktd
On Wed, Apr 15, 2009 at 4:10 PM, Charles R Harris wrote: > > > On Wed, Apr 15, 2009 at 1:52 PM, Pauli Virtanen wrote: >> >> Mixing views and mutating (eg. in-place) operations can cause surprising >> and ill-defined results. Consider >> http://projects.scipy.org/numpy/ticket/1085: >> >> >>> impor

Re: [Numpy-discussion] Ill-defined in-place operations (#1085)

2009-04-15 Thread Matthieu Brucher
I think this is unavoidable. If we state clearly that every numpy function assums non-pointer aliasing, then people have to care about this themselves (like they would in Fortran, or in C++ for object-like arrays). Matthieu 2009/4/15 Charles R Harris : > > > On Wed, Apr 15, 2009 at 1:52 PM, Pauli

Re: [Numpy-discussion] Ill-defined in-place operations (#1085)

2009-04-15 Thread Charles R Harris
On Wed, Apr 15, 2009 at 1:52 PM, Pauli Virtanen wrote: > > Mixing views and mutating (eg. in-place) operations can cause surprising > and ill-defined results. Consider > http://projects.scipy.org/numpy/ticket/1085: > > >>> import numpy as np > >>> x = np.array([[1,2], [3,4]]) > >>> x > array([[1,

[Numpy-discussion] Ill-defined in-place operations (#1085)

2009-04-15 Thread Pauli Virtanen
Mixing views and mutating (eg. in-place) operations can cause surprising and ill-defined results. Consider http://projects.scipy.org/numpy/ticket/1085: >>> import numpy as np >>> x = np.array([[1,2], [3,4]]) >>> x array([[1, 2], [3, 4]]) >>> x += x.T >>> x array([[2, 5], [8, 8]])