[Numpy-discussion] untenable matrix behavior in SVN

Gael Varoquaux gael.varoquaux@normalesup....
Tue Apr 29 13:55:28 CDT 2008

I will answer this question too, because I feel like Keith.

On Tue, Apr 29, 2008 at 02:21:34PM -0400, Alan G Isaac wrote:
> On Tue, 29 Apr 2008, Keith Goodman apparently wrote:
> > I often use x[i,:] and x[:,i] where x is a matrix and i is 
> > a scalar. I hope this continues to return a matrix. 

> 1. Could you give an example of the circumstances of this 
> use?

x[i, :]*A*x[:, i]

I find this cleaner, because more explicit, than x[i]*A*x[:, i]. I'd be
_very very_ upset if this broke. Breaking the explicit for the implicit
is a _bad_ idea, and if you go down this path you go down the path of

> 2. Would any or all of the following be just as good 
> a result?
>         a. 1d matrix


>         b. row and column vectors (1d but "oriented" for 
>         linear algebra purposes)


> 3. If 2a. and 2b. are no good for you,
>         a. would e.g. ``x[i:i+1,:]`` be too burdensome?

No way. This is hard to read and the best way to make long calculations
impossible to follow and debug.

>         b. would ``rows`` and ``columns`` attributes that
>         yielded matrics be an offsetting convenience?

Hum, I don't love this because it introduces noise in the formulas, but
at least it is explicit and readable. 

I would really like us to go down the way of the row/vector columns. This
is consistent at least.


More information about the Numpy-discussion mailing list