Added functionality to supplied functions

Computes inverse of matrix and caches the inverse matrix