[Numpy-discussion] matrix indexing question
Sven Schreiber
svetosch@gmx....
Mon Mar 26 07:07:36 CDT 2007
Alan G Isaac schrieb:
> Oooops, they should match of course. ::
> >>> X[1]
> array([3,4])
> >>> X[1,:]
> matrix([[3, 4]])
>
> But again the point is:
> indexing for submatrices should produce matrices.
> Normal Python indexing should access the constituent arrays.
>
I think this is a tricky business.
There's also the rule "indexing reduces the rank, slicing preserves it".
Numpy-matrices form an exception to this rule, always being 2d, but the
exception is consistently enforced.
Now it seems you want to have an exception from the exception, correct?
Isn't this why the .A1 method for numpy-matrices was introduced even
after 1.0rc?
-sven (matrix fan)
More information about the Numpy-discussion
mailing list