[Numpy-discussion] defmatrix.py
Travis Oliphant
oliphant at ee.byu.edu
Mon Mar 26 18:02:02 EDT 2007
> I think that might be the simplest thing, dot overrides subtypes. BTW,
> here is another ambiguity
>
> In [6]: dot(array([[1]]),ones(2))
> ---------------------------------------------------------------------------
> exceptions.ValueError Traceback (most
> recent call last)
>
> /home/charris/<ipython console>
>
> ValueError: matrices are not aligned
>
> Note that in this case dot acts like the rhs is always a column vector
> although it returns a 1-d vector. I don't know that this is a bad
> thing, but perhaps we should extend this behaviour to matrices, which
> would be different from the now current 1-d is always a *row* vector, i.e.
The rule 1-d is always a *row* vector only applies when converting to a
matrix.
In this case, the dot operator does not "convert to a matrix" but uses
rules for operating with mixed 2-d and 1-d arrays inherited from Numeric.
I'm very hesitant to change those rules.
-Travis
More information about the NumPy-Discussion
mailing list