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!