Re: [Numpy-discussion] Combination of element-wise and matrix multiplication

2008-07-04 Thread Jonno
Awesome. I just added rollaxis(c,0,3) and was done. Cheers mate. On Fri, Jul 4, 2008 at 2:38 AM, lorenzo bolla <[EMAIL PROTECTED]> wrote: > If a and b are 2d arrays, you can use numpy.dot: > > In [36]: a > Out[36]: > array([[1, 2], >[3, 4]]) > In [37]: b > Out[37]: > array([[5, 6], >

Re: [Numpy-discussion] Combination of element-wise and matrix multiplication

2008-07-04 Thread lorenzo bolla
If a and b are 2d arrays, you can use numpy.dot: In [36]: a Out[36]: array([[1, 2], [3, 4]]) In [37]: b Out[37]: array([[5, 6], [7, 8]]) In [38]: numpy.dot(a,b) Out[38]: array([[19, 22], [43, 50]]) If a and b are 3d arrays of shape 2x2xN, you can use something like that: In [

[Numpy-discussion] Combination of element-wise and matrix multiplication

2008-07-03 Thread Jonno
I have two 2d arrays a & b for example: a=array([c,d],[e,f]) b=array([g,h],[i,j]) Each of the elements of a & b are actually 1d arrays of length N so I guess technically a & b have shape (2,2,N). However I want to matrix multiply a & b to create a 2d array x, where the elements of x are created wit