Added code

Added code to calculate matrix inverse or return a previous calculation.