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

Alan G Isaac aisaac@american....
Wed Feb 3 08:36:07 CST 2010


On 2/3/2010 3:08 AM, laurent.feron@free.fr wrote:
> if i multiply two matrix, one with a unique line and the second one
> with a unique column, i should have a scalar


What definition of matrix multiplication is that??

If you really want a scalar product,
ask for it::

         >>> import numpy as np
         >>> m1 = np.mat('0 1 2')
         >>> m2 = m1.T
         >>> np.dot(m1.flat,m2.flat)
         5

Alan Isaac



More information about the NumPy-Discussion mailing list