[SciPy-User] Dot product of a matrix and an array

Alan G Isaac alan.isaac at gmail.com
Fri Feb 17 08:55:01 EST 2012


On 2/17/2012 6:04 AM, Jaakko Luttinen wrote:
> The dot product of a matrix and an array seems to return a matrix.
> However, this resulting matrix seems to have inconsistent shape. For
> simplicity, let I be an identity matrix (matrix object) and x a vector
> (1-d array object). Then np.dot gives wrong dimensions for I*x which
> causes that one can not compute I*(I*x).


It is unclear what a consistent shape means in this context.
(For me it would be to return a 1d array.)
For this reason, the suggestion resurfaces from time to time
to raise an error for multiplication between a matrix and an array.
In any case, computations mixing matrices and arrays are a "bad idea".

fwiw,
Alan Isaac



More information about the SciPy-User mailing list