[Numpy-discussion] untenable matrix behavior in SVN
Gael Varoquaux
gael.varoquaux@normalesup....
Tue Apr 29 16:42:24 CDT 2008
On Tue, Apr 29, 2008 at 11:16:15PM +0200, Anne Archibald wrote:
> On 29/04/2008, Gael Varoquaux <gael.varoquaux@normalesup.org> wrote:
> > On Tue, Apr 29, 2008 at 11:03:58PM +0200, Anne Archibald wrote:
> > > I am puzzled by this. What is the rationale for x[i,:] not being a 1-d
> > > object?
> > It breaks A*B[i, :] where A and B are matrices.
> Really? How?
> In [26]: A = np.matrix([[1,0],[0,1],[1,1]])
> In [28]: A*np.ones(2)
> Out[28]: matrix([[ 1., 1., 2.]])
> In [29]: np.ones(3)*A
> Out[29]: matrix([[ 2., 2.]])
Yes, sorry, I am shameful. I should have thought a bit more before
posting.
There is no big problem with x[i,:] not being a 1-d object. The problem
is for x[:, i]. However I would find it nice that, for linear algebra,
x[i, :] == x[:, i].T
This is the kind of behavior I expect, and we won't be getting it with 1D
arrays.
Cheers,
Gaël
More information about the Numpy-discussion
mailing list