cache matrix assignment code