Reputation: 5072
I have a very big matrix that I want to invert. numpy.linalg.inv
works great but is it also possible to do this in place (without allocating a new matrix)?
Upvotes: 2
Views: 906
Reputation: 9620
No. However scipy.linalg.inv gives you roughly this functionality with the overwrite_a
option:
http://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.inv.html#scipy.linalg.inv
But why do you want to invert it? This is almost always the wrong thing to do. http://www.johndcook.com/blog/2010/01/19/dont-invert-that-matrix/
Instead, use numpy.linalg.solve and provide stack all your independent vectors into a single matrix so that you can solve them all at one go. Cheaper, and better numerical stability.
Upvotes: 4