more efficient thomas & compute error