[Numpy-discussion] untenable matrix behavior in SVN
Stéfan van der Walt
stefan@sun.ac...
Tue Apr 29 08:24:58 CDT 2008
Hi Charles
2008/4/29 Charles R Harris <charlesr.harris@gmail.com>:
> May I add that if I edit defmatrix.py to act like an array for scalar
> indexing, then the following works.
>
> In [1]: a = matrix(eye(2))
>
> In [2]: array([a,a])
> Out[2]:
> array([[[ 1., 0.],
> [ 0., 1.]],
>
> [[ 1., 0.],
> [ 0., 1.]]])
>
> This generates an error with the current version of matrix and, frankly, I
> am not going to be bothered going all through the numpy c sources to special
> case matrices to fix that. Someone else can do it if they wish. There are
> recursive routines that expect the dimensions to decrease on each call.
I'd also like to see matrices become proper hierarchical containers --
the question is just how to do that. Thus far, I'm most convinced by
the arguments for RowVectors/Columns, which leaves us with a sane
model for doing linear algebra, while providing the enhancements you
mentioned here and in comments to another ticket.
We were thinking of raising a warning on scalar indexing for 1.1, but
given the above, would that be sensical?
Regards
Stéfan
More information about the Numpy-discussion
mailing list