Functions for storing matrix and caching inverse.