added implementation of cached matrix for programming assignment submission