Implemented matrix inversion.