Matrix caching