Implement the matrix inverse cache

implement two functions