[Numpy-discussion] untenable matrix behavior in SVN
Keith Goodman
kwgoodman@gmail....
Tue Apr 29 17:23:58 CDT 2008
On Tue, Apr 29, 2008 at 2:18 PM, Anne Archibald
<peridot.faceted@gmail.com> wrote:
> On 29/04/2008, Keith Goodman <kwgoodman@gmail.com> wrote:
> > In my use i is most commonly an array (i = M.where(y.A)[0] where y is
> > a nx1 matrix), sometimes a list, and in ipython when debugging or
> > first writing the code, a scalar. It would seem odd to me if x[i,:]
> > returned different types of objects based on the type of i:
> >
> > array index
> > idx = M.where(y.A)[0] where y is a nx1 matrix
> > x[dx,:] --> matrix
> >
> > list index
> > idx = [0]
> > x[idx,:] --> matrix?
> >
> > scalar index
> > idx = 0
> > x[idx,:] --> not matrix
>
> It is actually pretty unreasonable to hope that
>
> A[0]
>
> and
>
> A[[1,2,3]]
> or
> A[[True,False,True]]
>
> should return objects of the same rank.
Why it unreasonable to hope that
x[0,:]
and
x[0, [1,2,3]]
or
x[0, [True,False,True]]
where x is a matrix, continue to return matrices?
More information about the Numpy-discussion
mailing list