Inverse Matrix calculation

The methods below store the matrix and the calculated inverse in the
cache. When asked to compute the inverse for the matrix, it returns the
cached inverse if the matrix is the same. Else it calculates the new
inverse and stores it.