[SciPy-dev] is this a bug (take with indices in a matrix)
Charles R Harris
charlesr.harris@gmail....
Thu Nov 26 18:54:11 CST 2009
On Thu, Nov 26, 2009 at 5:40 PM, Thouis (Ray) Jones <thouis@broad.mit.edu>wrote:
> >>> from numpy import *
> >>> q = matrix(arange(9).reshape((3,3)))
> >>> take(q, matrix([[0]]), axis=0)
> matrix([[0, 1, 2]])
> >>> take(q, matrix([[0]]), axis=1)
> matrix([[0, 3, 6]])
>
> Expected behavior for the last expression:
> >>> take(q, [0], axis=1)
> matrix([[0],
> [3],
> [6]])
> ____
Bug or feature could be the subject of much discussion, but it is definitely
a wart. What looks to be happening is a two step thing. First the column is
taken ndarray wise, resulting in a 1d array, which is then converted using
the default 1d -> row for matrix conversions.
I think it could be fixed, but the whole problem with the current matrix
class is that fixing all these warts starts to intrude on the base ndarray
class.
You should raise the issue on the numpy mailing list, it's time for another
discussion of the matrix class.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20091126/41afc029/attachment.html
More information about the SciPy-Dev
mailing list