added core funtionality of matrix inverse caching