Cached Matrix Inverse Function

second commit... making the code a little nicer