R code commit for matrix inversion functionality with cache