On the computation of a generalized inverse of a matrix