n is symmetric, it may be assumed without loss of
generality that <span class="math inline">\(u \geq v\)</span>, so that</p>
<p><span class="math display">\[
\mathrm{log\_sum\_exp}(u, v) = u + \log(1 + \exp(v - u)).
\]</span></p>
<p>The inner term may itself be evaluated using <code>log1p</code>, there is only
limited gain because <span class="math inline">\(\exp(v - u)\)</span> is only near zero when <span class="math inline">\(u\)</span> is much
larger than <span class="math inline">\(v\)</span>, meaning 