R functions for creating a matrix which caches its inverse