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

laurent.feron@fr... laurent.feron@fr...
Wed Feb 3 16:31:45 CST 2010


Thanks all for your replies...
yes i start with numpy.
i translate a dtw algorithm for voice recogniton from matlab to python
Rgds,
Laurent
----- Mail Original -----
De: "Alan G Isaac" <aisaac@american.edu>
À: "Discussion of Numerical Python" <numpy-discussion@scipy.org>
Envoyé: Mercredi 3 Février 2010 15h36:07 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
Objet: Re: [Numpy-discussion] multiply a lign matrix with a column matrix should return a scalar( matlab yes, numpy no)!!!

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

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


More information about the NumPy-Discussion mailing list