Fast matrix inversion without packet

Suppose I have a square matrix M Suppose I would like to invert the matrix M

I am trying to use the mpq fraction mpq inside gmpy2 as elements of my M matrix. If you are not familiar with these fractions, they are functionally similar to the python fractions built-in package. The only problem is that there are no packages that will invert my matrix unless I select them from the fractional form. I need numbers and answers in the form of fractions. Therefore, I will have to write my own function to invert M

There are well-known algorithms that I could program, for example gaussian elim . However, performance is a problem, so my question is this:

Is there a computationally fast algorithm that I could use to calculate the inverse of the matrix M ?

+7
python matrix matrix-inverse
source share
1 answer

Is there anything else you know about these matrices? For example, for symmetric positive definite matrices , Cholesky decomposition allows you to invert faster than the standard Gauss-Jordan method you talked about.

For general matrix inversions, the Strassen algorithm will give you a faster result than Gauss-Jordan, but slower than Cholesky.

It seems that you need accurate results, but if you are fine with approximate inversions, then there are algorithms that approximate the opposite much faster than the algorithms mentioned earlier.

However, you may ask yourself if you need the entire matrix inverse to your specific application. Depending on what you are doing, it’s faster to use a different matrix property. In my experience, calculating the matrix inversion is an unnecessary step.

I hope this helps!

+4
source share

All Articles