[Numpy-discussion] Detect subclass of ndarray
Charles R Harris
Sat Mar 24 10:33:30 CDT 2007
On 3/24/07, Alan G Isaac <email@example.com> wrote:
> On Fri, 23 Mar 2007, Charles R Harris apparently wrote:
> > the following gives the wrong result:
> > In : I = matrix(eye(2))
> > In : I*ones(2)
> > Out: matrix([[ 1., 1.]])
> > where the output should be a column vector.
> Why should this output a column?
> I would prefer an exception.
> Add the axis if you want it:
> works fine.
Because it is mathematically correct. You can't multiply a vector by a 2x2
matrix and get a 1x2 matrix as the result. Sure, there are work arounds, but
if matrix multiplication is going to work when mixed with arrays, it should
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion