[Numpy-discussion] Numpy 1.6 schedule (was: Numpy 2.0 schedule)

Travis Oliphant oliphant at enthought.com
Sat Mar 5 23:00:08 EST 2011


My point is also that we need to make sure the broadcasting rules are consistent for both addition and array copy.   

Addition would not create an error if a (1,20) array was added to a (20,) array.   Therefore, a (1,20) array can also copied into a (20,) array --- as can a (1,1,1,1,20) array.   Conversely, a (20,1) or a (1,1,20,1,1) array can not be copied into a (20,) array. 

For the purposes of assignment, NumPy was designed so that if the rhs and lhs could be broadcast to the same shape, then the assignment could proceed: otherwise, it would fail. 

This behavior should not change in 1.6.  

-Travis



On Mar 5, 2011, at 8:51 PM, Charles R Harris wrote:

> 
> 
> On Sat, Mar 5, 2011 at 7:41 PM, Charles R Harris <charlesr.harris at gmail.com> wrote:
> 
> 
> On Sat, Mar 5, 2011 at 7:23 PM, Enthought <oliphant at enthought.com> wrote:
> This should be changed back so that the former works and the later does not.   It was intentional that the former worked --- it was consistent with broadcasting rules.
> 
> A (1,20) array can be interpreted as a (20,) array.
> 
> 
> So should a (1,1,1,1,20) array also be interpreted as a (20,) array? From what you say, an arbitrary number of 1's can not only be appended on the left, the usual broadcasting, but an arbitrary number of 1's can also be removed. Is that so?
> 
> 
> The point being, that assignment is now a special case that does not follow the same rules as, say, addition.
> 
> Chuck 
> 
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

---
Travis Oliphant
Enthought, Inc.
oliphant at enthought.com
1-512-536-1057
http://www.enthought.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110305/2139f45f/attachment.html>


More information about the NumPy-Discussion mailing list