Thanx to everybody! On Mar 29, 2010, at 4:57 PM, Paul Anton Letnes wrote:
On 26. mars 2010, at 04.10, Graziano Mirata wrote:
Hi guys, it's me again. Still problems with matrices multiplication.
So i have used dot(w,R) to multiply two arrays but now i cannot access to elements. I.e
In [224]: w.shape Out[224]: (3,) In [226]: R.shape Out[226]: (24000, 3)
It is easier to work with matrices. To convert arrays to matrices, just type:
R = numpy.mat(R) w = numpy.mat(w) r = R * w Notice that arrays can have _any_ number of dimensions, while matrices _always_ are 2-dimensional (2 indices). Use the matrix class, and you'll always be sure that matrix multiplication is performed as desired for any shape of matrices, and also, you'll always end up with a 2-dimensional array-like object, which is what you want. You can always convert back to arrays later, using myarray = numpy.array(mymatrix)
Cheers, Paul
Thanx
G
_______________________________________________ SciPy-User mailing list SciPy-User@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user
_______________________________________________ SciPy-User mailing list SciPy-User@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user