Updated and completed cachematrix for RProg Assignment #2