tridiag_worker: use a range-based 'for' loop for better genericity.