added code to get and set cached matrix inverses