Implement cached matrix