to create a cache matrix