Caching inverse of matrices