adding changes to functions to provide inverse caching for matrix objects