3

What is the algorithm behind this routine and is there documentation available for it?

Discrete lizard
  • 8,392
  • 3
  • 25
  • 53
oogabooga
  • 31
  • 1

1 Answers1

3

The source code of this function is here, which is a wrapper for a C++ function here, which is calling some BLAS/LAPACK library functions. Specifically, in order to compute the inverse of a matrix $A$, it calls the "SGESV" routine to solve the equation $AX = I$ for the matrix $X$. (note that SGESV can solve arbitrary systems $AX = B$; $B$ does not have to be the identity matrix)

The SGESV routine first computes an LU-decomposition of $A$: it finds a lower triangular matrix $L$ and upper triangular matrix $U$ such that $L U = A$. Solving a system with a triangular matrix is easy, as we can go row by row; we only need to solve an equation with one unknown variable for each row. So, we can solve $AX=B$ as follows: let $X':=UX$, then we have $LX' = A$ and $UX= X'$. These are both systems with a triangular matrix, and solving them gives $X$.

Discrete lizard
  • 8,392
  • 3
  • 25
  • 53