Added cached matrix routines.