complete cache matrix functions