Avoiding inverse of a matrix
11 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(2 个)
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.
0 个评论
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
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!