Avoiding inverse of a matrix

10 次查看(过去 30 天)
N Madani SYED
N Madani SYED 2012-7-27
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

回答(2 个)

Mike Hosea
Mike Hosea 2012-7-27
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 2012-7-27
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

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by