Cached inverse of matrix implemented