Wrote in the matrix/inverse caching functions required by PA2.