My cachematrix functions