Assignment 2. Implements a cached matrix solver