filled in cachematrix functions