Update cachematrix.R

Wrote classes - perhaps final commit, pending more testing.