Caching matrices