A parallel algorithm for matrix inversion based on the Sherman-Morrison formula