My cachematrix function