R script to cache inverse matrix