[Numpy-discussion] untenable matrix behavior in SVN

Christopher Barker Chris.Barker@noaa....
Mon Apr 28 14:03:25 CDT 2008

Gael Varoquaux wrote:
> * to use a syntax similar to dictionnaries:
>     for row in A.rows():
> 	for col in row.cols()
>   I actually think this is much better than the code you currently use,
> * or implement row and column objects.
> The problem in your code is that you do not distinguish iterating over
> rows and columns, and in linear algebra these are different objects. The
> two solutions I propose do this distinction. My favorite one is the first
> one (the rows and cols methods).

What would rows() and columns() return? I'd like them to return a vector 
object. If they return matrices, then you can't index them with a single 
value, if they return 1-d arrays, then you can't distinguish between 
rows and columns (which may be OK).

Travis E. Oliphant wrote:

> I'm not personally persuaded by the iteration argument, because we can 
> change iteration independently of mapping (__getitem__) access.

or just use:

for row in M.A:

How hard is that?


Christopher Barker, Ph.D.

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception


More information about the Numpy-discussion mailing list