[Numpy-discussion] multiply a lign matrix with a column matrix should return a scalar( matlab yes, numpy no)!!!

Nikolas Tezak Nikolas.Tezak@gmx...
Wed Feb 3 02:21:17 CST 2010


Hi Laurent,
I'm not sure why this was implemented this way (probably due to  
numerical precision, because the numpy datatypes offer a greater  
variety than python), but in any case you can easily convert the  
result to a float:
 >>> float(line*col)
10
(You probably knew this, but well... :) )

Regards,
Nikolas

Am 03.02.2010 um 09:08 schrieb laurent.feron@free.fr:

> Hello,
>
> if i multiply two matrix, one with a unique line and the second one  
> with a unique column, i should have a scalar:
>
>>>> line
> matrix([[1, 3, 1]])
>>>> col
> matrix([[2],
>        [2],
>        [2]])
>>>> line*col
> matrix([[10]])
>
> Matlab give me a scalar, Numpy does not...
>
> Do you know why?
>
> Regards,
> Laurent
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion



More information about the NumPy-Discussion mailing list