created cache matrix functions