[Numpy-discussion] matrix vs. array

Bill Baxter wbaxter at gmail.com
Wed Mar 15 15:18:07 CST 2006


I thought this was just expected behavior.  Great.  Now I can get rid of all
those calls to squeeze().

Did it get logged as a bug in the first place, though, before it was fixed?
Still probably worth having it in the bug tracker, though.  And Travis, do
you mean it's fixed in CVS or fixed in 0.9.6?

Incidentally, you don't need to index a matrix with a matrix to see it,
indexing a matrix with a simple python list also returns the same shape.
So
     mm = m[numpy.matrix('[0 1]')]
can also be
     mm = m[[0,1]]
and the bug still happens in 0.9.5.  Don't know about 0.9.6 or CVS though.

--bb

On 3/16/06, Travis Oliphant <oliphant.travis at ieee.org> wrote:
>
> Andrew Straw wrote:
> > Bill Baxter wrote:
> >
> >
> >> On 3/15/06, *Paulo J. S. Silva* <pjssilva at ime.usp.br
> >> <mailto:pjssilva at ime.usp.br>> wrote:
> >>
> >>
> >>     > The other difference which isn't really obvious from looking at
> the
> >>     > source code is that matrices always have at least rank
> >>
> >>     Just to make clear. They *always* have rank two.
> >>
> >>
> >> Not necessarily.
> >>
> >>
> >>>>> m = numpy.matrix('[1 2 3; 4 5 6]')
> >>>>> mm = m[numpy.matrix('[0 1]')]
> >>>>> m
> >>>>>
> >> matrix([[1, 2, 3],
> >>        [4, 5, 6]])
> >>
> >>>>> mm
> >>>>>
> >> matrix([[[[1, 2, 3]],
> >>
> >>         [[4, 5, 6]]]])
> >>
> >>>>> mm.shape
> >>>>>
> >> (1, 2, 1, 3)
> >>
> >>
> > Could you enter this as a bug so it doesn't get forgotten?
> > http://projects.scipy.org/scipy/numpy/newticket
> >
>
> Please check to see if it actually is still broken.   I think it's fixed.
>
>
> -Travis
>
> > Cheers!
> > Andrew
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> > that extends applications into web and mobile media. Attend the live
> webcast
> > and join the prime developer group breaking into this new coding
> territory!
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> > _______________________________________________
> > Numpy-discussion mailing list
> > Numpy-discussion at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/numpy-discussion
> >
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>



--
William V. Baxter III
OLM Digital
Kono Dens Building Rm 302
1-8-8 Wakabayashi Setagaya-ku
Tokyo, Japan  154-0023
+81 (3) 3422-3380
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060315/1eb206c1/attachment-0001.html 


More information about the Numpy-discussion mailing list