Filled in the template to cache inverse of matrix