Implement a pair of functions that cache the inverse of amatrix.