I need to compute the Drazin inverse $A^D$ of a singular M-matrix $A$, i.e., a matrix in the form $A=\lambda I -P$, where $P$ has nonnegative entries and $\lambda$ is the spectral radius (Perron value) of $P$. I already know the right and left eigenvectors $v$ and $u^T$ of $P$ with eigenvalue $\lambda$ (that is, the vectors in the left and right kernel of $A$).

1) Is there a Matlab subroutine around for computing Drazin inverses? I can't seem to find any, so I had to create my own (which is probably very inefficient)

2) Is there a way to exploit the knowledge of the two nullspaces (and the fact that they are 1-dimensional) to speed up this computation?