Re: [Numpy-discussion] array of matrices

2009-04-08 Thread Gael Varoquaux
On Wed, Apr 01, 2009 at 01:40:54AM +, Hans-Andreas Engel wrote: > By the way, matrix multiplication is one of the testcases for the generalized > ufuncs in numpy 1.3 -- this makes playing around with it easy: > In [1]: N = 10; a = randn(N, 4, 4); b = randn(N, 4, 4) > In [2]: import numpy.

Re: [Numpy-discussion] array of matrices

2009-03-31 Thread Hans-Andreas Engel
Robert Kern gmail.com> writes: > On Sat, Mar 28, 2009 at 23:15, Anne Archibald gmail.com> wrote: > > 2009/3/28 Geoffrey Irving naml.us>: > >> On Sat, Mar 28, 2009 at 12:47 AM, Robert Kern gmail.com> wrote: > >>> 2009/3/27 Charles R Harris gmail.com>: > > On Fri, Mar 27, 2009 at 4:43

Re: [Numpy-discussion] array of matrices

2009-03-31 Thread Bryan Cole
> > I think dot will work, though you'll need to work a little bit to get the > answer: > > >>> import numpy as np > >>> a = np.array([[1,2], [3,4]], np.float) > >>> aa = np.array([a,a+1,a+2]) > >>> bb = np.array((a*5, a*6, a*7, a*8)) > >>> np.dot(aa, bb).shape > (3, 2, 4, 2) > >>> for i, a_ in

Re: [Numpy-discussion] array of matrices

2009-03-31 Thread Alexandre Fayolle
Le Friday 27 March 2009 23:38:25 Bryan Cole, vous avez écrit : > I have a number of arrays of shape (N,4,4). I need to perform a > vectorised matrix-multiplication between pairs of them I.e. > matrix-multiplication rules for the last two dimensions, usual > element-wise rule for the 1st dimension (

Re: [Numpy-discussion] array of matrices

2009-03-28 Thread Robert Kern
On Sat, Mar 28, 2009 at 23:15, Anne Archibald wrote: > 2009/3/28 Geoffrey Irving : >> On Sat, Mar 28, 2009 at 12:47 AM, Robert Kern wrote: >>> 2009/3/27 Charles R Harris : On Fri, Mar 27, 2009 at 4:43 PM, Robert Kern wrote: > > On Fri, Mar 27, 2009 at 17:38, Bryan Cole wrote:

Re: [Numpy-discussion] array of matrices

2009-03-28 Thread Anne Archibald
2009/3/28 Geoffrey Irving : > On Sat, Mar 28, 2009 at 12:47 AM, Robert Kern wrote: >> 2009/3/27 Charles R Harris : >>> >>> On Fri, Mar 27, 2009 at 4:43 PM, Robert Kern wrote: On Fri, Mar 27, 2009 at 17:38, Bryan Cole wrote: > I have a number of arrays of shape (N,4,4). I need to p

Re: [Numpy-discussion] array of matrices

2009-03-28 Thread Geoffrey Irving
On Sat, Mar 28, 2009 at 12:47 AM, Robert Kern wrote: > 2009/3/27 Charles R Harris : >> >> On Fri, Mar 27, 2009 at 4:43 PM, Robert Kern wrote: >>> >>> On Fri, Mar 27, 2009 at 17:38, Bryan Cole wrote: >>> > I have a number of arrays of shape (N,4,4). I need to perform a >>> > vectorised matrix-mul

Re: [Numpy-discussion] array of matrices

2009-03-28 Thread Robert Kern
2009/3/27 Charles R Harris : > > On Fri, Mar 27, 2009 at 4:43 PM, Robert Kern wrote: >> >> On Fri, Mar 27, 2009 at 17:38, Bryan Cole wrote: >> > I have a number of arrays of shape (N,4,4). I need to perform a >> > vectorised matrix-multiplication between pairs of them I.e. >> > matrix-multiplicat

Re: [Numpy-discussion] array of matrices

2009-03-27 Thread Charles R Harris
On Fri, Mar 27, 2009 at 4:43 PM, Robert Kern wrote: > On Fri, Mar 27, 2009 at 17:38, Bryan Cole wrote: > > I have a number of arrays of shape (N,4,4). I need to perform a > > vectorised matrix-multiplication between pairs of them I.e. > > matrix-multiplication rules for the last two dimensions,

Re: [Numpy-discussion] array of matrices

2009-03-27 Thread Robert Kern
On Fri, Mar 27, 2009 at 17:38, Bryan Cole wrote: > I have a number of arrays of shape (N,4,4). I need to perform a > vectorised matrix-multiplication between pairs of them I.e. > matrix-multiplication rules for the last two dimensions, usual > element-wise rule for the 1st dimension (of length N).

[Numpy-discussion] array of matrices

2009-03-27 Thread Bryan Cole
I have a number of arrays of shape (N,4,4). I need to perform a vectorised matrix-multiplication between pairs of them I.e. matrix-multiplication rules for the last two dimensions, usual element-wise rule for the 1st dimension (of length N). (How) is this possible with numpy? thanks, BC _

Re: [Numpy-discussion] Array of matrices - Inverse and dot

2009-01-26 Thread Tom K.
Jean-Baptiste Rudant wrote: > > I would like to operate in an easy and efficient way (without python loop) > with arrays of matrices. > > Suppose a and b are some arrays of N1*N2 matrices of size 3*3, I would > like to calculate inv_a and dot_ab, which would be arrays of N1*N2 > (3*3)-matrice

Re: [Numpy-discussion] Array of matrices - Inverse and dot

2009-01-26 Thread David Cournapeau
On Mon, Jan 26, 2009 at 11:59 PM, Jean-Baptiste Rudant wrote: > Hello, > I would like to operate in an easy and efficient way (without python > loop) with arrays of matrices. > Suppose a and b are some arrays of N1*N2 matrices of size 3*3, I would like > to calculate inv_a and dot_ab, which would

[Numpy-discussion] Array of matrices - Inverse and dot

2009-01-26 Thread Jean-Baptiste Rudant
Hello, I would like to operate in an easy and efficient way (without python loop) with arrays of matrices. Suppose a and b are some arrays of N1*N2 matrices of size 3*3, I would like to calculate inv_a and dot_ab, which would be arrays of N1*N2 (3*3)-matrices, such as : inv_a[i, j] = np.lin