cache for matrix