Background: Let $\Omega$ be the state space of an absorbing Markov chain with $\Omega_a$ being the set of absorbing states, and its complement $\Omega_a^c$, being the set of transient states. The infinitesimal generator matrix $Q$ of this Markov chain in the canonical form is: \begin{align} Q_= \begin{array}{c|cc} & \Omega_a & \Omega_a^c \\ \hline \Omega_a & 0 & 0 \\ \Omega_a^c & W_1 & W_2 \\ \end{array} .\label{kao} \end{align} Based on the theory of Markov chain, $W_2$ is inverse-negative. That is, $W_2^{-1}$ exists and all of its elements are negative.
My Problem: For a problem that I am dealing with, I use Matlab to calculate $W_2^{-1}$. When my state space is small, it works as expected, however, when my state space is large (> 15000) Matlab fails to calculate the inverse correctly and gives me an inverse that has positive elements (note that all elements of the inverse matrix have to be negative theoretically, but some elements turn out to be in the order of $10^{12}$) and even $W_2 * W_2^{-1} \neq I$. I wonder if someone can suggest an efficient way of calculating the inverse of large matrices.
Here is how I calculate the inverse in Matlab: as $W_2$ is highly sparse, I use the following line of command (note that I avoid using inv($W_2$)):
inverse = sparse($W_2$)\sparse(eye(size($W_2$)));
You can download the .dat file of my matrix $W_2$ from my Google Drive.
I'm no expert with Matlab but when you call upon the inv() function it applies different methods depending upon the structure of your Matrix. I'm guessing that you're looking to form an Eigenvalue Decomposition for your Markov Chain Matrix. I would recommend that you first check the Eigenvalues for $W_2$, following that it's non-degenerate that you check that your $W_2$ is properly formed and structured.
Finally, it may be that your Matrix is sound and non-degenerate but that computationally it's unstable and difficult to compute the inverse. In that case, I would ask exactly what you are going to use the inverse for? if it's to solve a Matrix System, then instead of computing the inverse that it's better to script an algorithm to solve the system you are working with.