More efficient way to invert a matrix knowing it i

2020-06-22 12:58发布

问题:

I'm inverting covariance matrices with numpy in python. Covariance matrices are symmetric and positive semi-definite.

I wondered if there exists an algorithm optimised for symmetric positive semi-definite matrices, faster than numpy.linalg.inv() (and of course if an implementation of it is readily accessible from python!). I did not manage to find something in numpy.linalg or searching the web.

EDIT:

As observed by @yixuan, positive semi-definite matrices are not in general strictly invertible. I checked that in my case I just got positive definite matrices, so I accepted an answer that works for positive definiteness. Anyway, in the LAPACK low-level routines I found DSY* routines that are optimised for just simmetric/hermitian matrices, although it seems they are missing in scipy (maybe it is just a matter of installed versions).