Re: [Numpy-discussion] vectorized multi-matrix multiplication

2012-08-26 Thread Alex Flint
Thank you. On Sun, Aug 26, 2012 at 11:04 AM, Alex Flint wrote: > I have two lists of 3x3 arrays and I would like to compute the matrix > product of the i-th element in the first list with the i-th element in > the second list. Of course, I could just loop over the lists: > > for i in range(n): >

Re: [Numpy-discussion] vectorized multi-matrix multiplication

2012-08-26 Thread Jonathan Taylor
Assuming matrices1 and matrices2 are actually arrays of size (N, 3, 3) you can do: np.einsum('nij,njk->nik', matrices1, matrices2) On Sun, Aug 26, 2012 at 11:04 AM, Alex Flint wrote: > I have two lists of 3x3 arrays and I would like to compute the matrix > product of the i-th element in the firs

[Numpy-discussion] vectorized multi-matrix multiplication

2012-08-26 Thread Alex Flint
I have two lists of 3x3 arrays and I would like to compute the matrix product of the i-th element in the first list with the i-th element in the second list. Of course, I could just loop over the lists: for i in range(n): out[i] = dot( matrices1[i], matrices2[i] ) However, the list is quite