# Numerical Precision in Matrix Inversion Routines

Let's say I have a matrix $\mathbf{A}\in\mathbb{R}^{n\times n}$, and its associated inverse, $\mathbf{A}^{-1}$. The elements of $\mathbf{A}$ are given in IEEE single precision, i.e. 23-bit mantissa, and I use the lapack routines $\texttt{sgetrf}$ and $\texttt{sgetri}$ to compute $\mathbf{A}^{-1}$ through a single-precision LU-decomposition.

How am I to ascertain the error associated with the matrix product $\mathbf{A}\mathbf{A}^{-1}$. More concretely, I'd quite like to be able to approximate, a priori, what the maximum error, $\varepsilon = \max_i \Big|\big( \mathbf{AA}^{-1}\big)_{ii} - 1.0\Big|$, will be. Furthermore, is there a way to approximate the errors for other matrix inversion routines, such as Gauss-Jordan or a QR decomposition? I'm guessing I should use their computational scaling, e.g. the LU-decomposition scales as $\frac{4}{3}n^3$, but I'm unsure how to proceed beyond that.

• Use sgesvx instead with condition number estimates and refined solution – percusse Sep 10 '17 at 23:49
• Wasn't familiar with that routine, many thanks for the input! Question still stands on how to estimate the bounds on the error though before the calculation. I should have mentioned that I'm also assuming the matrix is well-conditioned, so $1/\kappa(\mathbf{A})$ is smaller than the precision of the numerical format. – Homer Simpson Sep 11 '17 at 0:01
• Errors in numerical matrix factorizations have nothing to do with the amount of work being performed; the errors don't come at a constant rate per operation, they are much more mathematical in nature. – Kirill Sep 11 '17 at 17:19