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

Jean-Baptiste Rudant boogaloojb@yahoo...
Mon Jan 26 08:59:35 CST 2009


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.linalg.inv(a[i, j])
dot_ab[i, j] = np.dot(a[i, j], b[i, j])

(where a and b could be  :
N1 = 5
N2 = 6
a = np.random((N1, N2, 3, 3)
b = np.random((N1, N2, 3, 3)

Thank you,

(Sorry to ask the list : I think it is quite a basic stuff, but searching for "array of matrices" on google didn't help me so much.)

Jean-Baptiste Rudant

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20090126/6fe5d6e5/attachment.html 

More information about the Numpy-discussion mailing list