Functions for caching of inverse of a matrix