code for matrix inverse computation