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

Nils Wagner nwagner@iam.uni-stuttgart...
Fri Feb 17 08:02:19 CST 2012

On Fri, 17 Feb 2012 08:55:01 -0500
  Alan G Isaac <alan.isaac@gmail.com> wrote:
> 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 
> (For me it would be to return a 1d array.)
>For this reason, the suggestion resurfaces from time to 
> 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

This reminds me of an old ticket



More information about the SciPy-User mailing list