[Numpy-discussion] matrix-related bug in 1.0b1
Sven Schreiber
svetosch at gmx.net
Mon Jul 24 07:49:59 EDT 2006
Thanks for helping out on matrix stuff, Bill!
Bill Baxter schrieb:
> On 7/22/06, Sven Schreiber <svetosch at gmx.net> wrote:
>>
>> Note the array slicing works correct, but the equivalent thing with the
>> matrix does not.
>
> Looks like it happened in rev 2698 of defmatrix.py, matrix.__getitem__
> method:
>
> if isscalar(index[1]):
> if isscalar(index[0]):
> retscal = True
> elif out.shape[0] == 1:
> sh = out.shape
> out.shape = (sh[1], sh[0])
> ==> elif isinstance(index[1], (slice, types.EllipsisType)):
> ==> if out.shape[0] == 1 and not isscalar(index[0]):
>
> It behaves like array if you remove the 'not' in the last line.
> But maybe that breaks some other cases?
> Maybe you can try making that change in your numpy/core/defmatrix.py
> (around line 140) and see if anything else breaks for you.
>
Hm, I don't know -- if you don't mind I'd like to get a second opinion
before I mess around there. It's funny though that the changeset has the
title "fixing up matrix slicing" or something like that...
>>
>> Why is the direct access to matlib impossible?
>
> Maybe the thinking is that since it's a compatibily module, if you
> want it you should explicity import it. Like you have to do with
> oldnumeric.
>
If that is the reason I can't really follow the logic, but I don't
really mind the status quo, either.
-sven
More information about the NumPy-Discussion
mailing list