Cache matrix code