first version of the cache matrix functions