Re: [Numpy-discussion] Broadcasting and indexing

2010-01-22 Thread josef . pktd
On Thu, Jan 21, 2010 at 1:03 PM, Emmanuelle Gouillart wrote: > > Hi Thomas, > > broadcasting rules are only for ufuncs (and by extension, some numpy > functions using ufuncs). Indexing obeys different rules and always starts > by the first dimension. Just a clarification: If there are several ind

Re: [Numpy-discussion] Broadcasting and indexing

2010-01-21 Thread Emmanuelle Gouillart
Hi Thomas, broadcasting rules are only for ufuncs (and by extension, some numpy functions using ufuncs). Indexing obeys different rules and always starts by the first dimension. However, you don't have to use broadcasting for such indexing operations: >>> a[:, c] = 0 zeroes columns indexed by c.

[Numpy-discussion] Broadcasting and indexing

2010-01-21 Thread Thomas Robitaille
Hello, I'm trying to understand how array broadcasting can be used for indexing. In the following, I use the term 'row' to refer to the first dimension of a 2D array, and 'column' to the second, just because that's how numpy prints them out. If I consider the following example: >>> a = np.ran