Add a signed log_sum_exp
Description
When using log_sum_exp, it would be useful to be able specify a 'sign' for the variables being aggregated - such that some inputs are added and some subtracted.
I'm currently needing this for the gradients of hyper_pFq function, which are all computed on the log scale and the signs tracked through the infinite sum.
Example
The function would be:
log_sum_exp_signed(input_container, signs_container)
Which would be equivalent to:
log(sum(exp(input_container) .* signs_container))
But with the log_sum_exp approach to avoiding overflow
Current Version:
v4.1.0
I'm finding this will be better as an internal function for just grad_pFq, since it needs to track the sign of the returned sum as well. Will close for now
Belay that last request---this answered all my questions! Thanks for commenting the basis for the decision.
Re-opening this since I'm finding it's needed for other functions which aggregate on the log-scale but still track the sign