Thanks, it is very useful.
On Wed, Mar 9, 2011 at 7:41 PM, Benjamin Root wrote:
> This is a very good webpage that helped me when I was transitioning from
> matlab to numpy. I hope it is helpful for you as well.
>
> http://www.scipy.org/NumPy_for_Matlab_Users
>
> Ben Root
>
>
__
-- Forwarded message --
From: shu wei
Date: Wed, Mar 9, 2011 at 6:34 PM
Subject: Re: [Numpy-discussion] How to sum weighted matrices
To: Nicolas SCHEFFER
Thanks very much.
I just copied the code your guys gave me. Both of them work great
I used to program in Matlab. not
matrices = np.array([matrix1,matrix2])
>
> weighted_sum = np.tensordot(weights, matrices, (0,0))
>
> --
>
> On Mon, Mar 07, 2011 at 06:16:15AM -0600, shu wei wrote:
> >Hello all,
> >
> >I am new to python and numpy.
> >My quest
Hello all,
I am new to python and numpy.
My question is how to sum up N weighted matrices.
For example w=[1,2] (N=2 case)
m1=[1 2 3,
3 4 5]
m2=[3 4 5,
4 5 6]
I want to get a matrix Y=w[1]*m1+w[2]*m2 by using a loop.
My original problem is like this
X=[1 2 3,
3 4 5,
4 5 6]