Implementing matrix inverse caching for ProgrammingAssignment2