[SciPy-User] Vectorize matrix inversion
davide_fiocco at yahoo.it
davide_fiocco at yahoo.it
Sat May 7 19:15:54 EDT 2011
Hey all,
I have a NxNxP array. Let's call it foo. foo[:,:,p] contains a
matrix
I want to invert. Is there a pure python/scipy way to compute an array
bar without loops such that it
would be equivalent to the following?
import scipy.linalg as la
import numpy as np
bar = np.zeros((N, N, P)) + 0j
for i in range(0,P):
bar[:,:,i] = la.inv(foo[:,:,i])
I realize I could write some fortran code to do this or even use
cython, but it would be nice if I could do this without needing to
compile some extra code. As a summary, does anyone know how to
compute
the above (either example, but preferably both) without using loops?
Cheers,
Davide
P.S. This is almost necrobumping a question that was never answered on
this very same forum, on a post by Josh Lawrence, Nov 12 11:23:26 CST
2008.
More information about the SciPy-User
mailing list