Added the implementation of Cached Matrix type.