cachematrix.R updated according to programming assignment 2 (R Programming/Coursera)