slicing suggestion

Keith Goodman kwgoodman at gmail.com
Mon Oct 23 19:26:56 CDT 2006


On 10/23/06, Travis Oliphant <oliphant.travis at ieee.org> wrote:
> Keith Goodman wrote:
> > On 10/20/06, JJ <josh8912 at yahoo.com> wrote:
> >
> >> My suggestion is to
> >> create a new attribute, such as .AR, so that the
> >> following could be used: M[K.AR,:]
> >>
> >
> > It would be even better if M[K,:] worked. Would such a patch be
> > accepted? (Not that I know how to make it.)
> >
> What exactly do you want to work?

x
matrix([[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11],
        [12, 13, 14, 15]])

idx
matrix([[1],
        [3]])

I'd like (if it doesn't break the consistency of numpy):

--------------------------------------

x[idx, :] to give

matrix([[ 4,  5, 6 , 7],
              12, 13, 14 ,15]])

instead of

matrix([[[ 4,  5,  6,  7]],

        [[12, 13, 14, 15]]])

--------------------------------------

x[:, idx] top give a 4x2 matrix instead of an error

--------------------------------------

x[x[:,0] > 4, :] to give a 2x4 matrix instead of a 1x2 matrix

--------------------------------------

I'd also like a pony.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Numpy-discussion mailing list