First draft of cachematrix functions