Update cachematrix.R

Enhanced the code to set matrix as per defined rows and columns