Added method body for computing cache matrix