Avoiding inverse of a matrix

11 views (last 30 days)
N Madani SYED
N Madani SYED on 27 Jul 2012
Hi all,
I need to compute the following (RHS matrices known):
Z bb = M bb - ( M bi * inv( M ii ) * M ib )
where bold letters denote large (of the order 5000 or more) sparse complex matrices;
italic letters denote size of matrices.
I need to perform this operation many a times (say 2000 or so).
Now, for a matrix of size 4000x4000; the above calculation needs approximately 90 s. If I have to repeat this calculation for 2000 times, it would need 50 hours!!
Is there any way to avoid finding the inverse of the matrix in above calculation (since inv function takes the most time) and speed up the computational time (hopefully exponentially).
Regards
N Madani SYED

Answers (2)

Mike Hosea
Mike Hosea on 27 Jul 2012
We usually write A\B instead of inv(A)*B. So if you're computing D - C*inv(A)*B, then write it D - C*(A\B). It's hard to predict exactly how much that will help, but give it a try.

Bjorn Gustavsson
Bjorn Gustavsson on 27 Jul 2012
Well if it is just one and the same matrix you're using for every case it must be better to "invert" it once - then the equation becomes a simple sequence of matrix multiplications. I write "invert" inside auotation marks because there might be better ways than straightforward matrix inverstion. Have a look at this file exchange submission:
HTH Bjeorn

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!