added Moore-Penrose pseudoinverse method