0

I am looking to invert a (lower) triangular matrix that comes from the Cholesky decomposition of A, as A = L @ L.T. There are a few potential solutions, including numpy: inverting an upper triangular matrix. Unfortunately, this question is now more than 11 years old so newer solutions might exist now. Is there any method in numpy or scipy or any other relevant package that could be used to compute the inverse of a triangular matrix, upper or lower?

I can obviously code a solution myself (inverse of diagonal terms and ensuring that non-diagonal products are null) but this is error-prone and might not be as stable and tested as more common packages.

1 Answers1

1

Echoing the previous post, it is often unnecessary to obtain the explicit inverse, and refactoring the code to call a triangular solver routine wherever it is used next is usually preferable. Using a triangular solver with identity as the complementary argument produces the explicit inverse if it is really necessary.

Tensorflow's triangular solver can be much faster than those mentioned in the previous post if used correctly. See:

https://www.tensorflow.org/api_docs/python/tf/linalg/triangular_solve https://www.tensorflow.org/guide/function

Other than that (as someone who does a lot of work with Cholesky decompositions) the answers in the previous post still ring true from my perspective.

Jeremy
  • 136
  • 1
  • 5
  • Thank you for the reply, in fact the exact problem I have is [here](https://math.stackexchange.com/questions/4491029/cholesky-inverse). Basically, I have `L` a lower triangular matrix and `A = L @ X @ L.T` is known, can I get back to `X` somehow? –  Jul 12 '22 at 03:45
  • 1
    Oh yeah, I can help with that. Let me put something together and I'll post the relevant info where it is appropriate between here and math.stackexchange – Jeremy Jul 12 '22 at 03:50
  • Just to clarify, you only have A, not `chol(A)`, correct? Because if you already have `chol(A)` there is a very clear path forward – Jeremy Jul 12 '22 at 03:53
  • Yes I have only `L` which comes from another Cholesky decomposition that is not related to `A` directly. –  Jul 12 '22 at 03:54
  • `A` is actually a matrix that I already diagonalized as `P @ D @ P.T`, with `D` being diagonal and `P` is an orthogonal basis. –  Jul 12 '22 at 03:58
  • 1
    See math exchange answer and let me know if you need further assistance. – Jeremy Jul 12 '22 at 04:25
  • Also, section 6.4 (pg216) of Grewal's Kalman filtering: theory and practice using MATLAB may be helpful. The pdf is easy to find free of charge. – Jeremy Jul 12 '22 at 04:26