Assignment 2. Functions to set/get matrix and inverse, with caching.