I am writing a program which requires me to find inverse of a complex 21*21 symmetric matrix several times(approx 35 million times).I initially do this with inv() from scipy.linalg. It works. Now I need to reduce the time it takes.
I searched out online for methods and found that LU decomposition can be used. When I tried to compare time taken by scipy inv and LU method. I found that scipy.inv takes less time even when compared only with the factorization part. Now I have multiple questions-->
Actually, only the diagonal values of the matrix are changed each time I find an inverse. So, if any approximation method also works if it reduces computational time as compared to time taken by scip.inv. One such example is finding inverse through iterative method. If anyone knows some good approximation method, please suggest.
If the matrix to be inverted is just a "rank one" update of the previous matrix, you can make use of the Sherman Morrison formula.
"rank one" update means that a matrix of rank 1 is added to the original matrix.
u
and v
are vectors. The denominator of the fraction is a scalar. Thus, the right-hand term is a matrix divided by a scalar.
This is explained in this article.