Assignment 2 with cached matrix verification