logaddexp#

rbc.stdlib.elementwise_functions.logaddexp(x1, x2)#

Calculates the logarithm of the sum of exponentiations log(exp(x1) + exp(x2)) for each element x1_i of the input array x1 with the respective element x2_i of the input array x2.

Examples

>>> from rbc.stdlib import array_api
>>> @heavydb('double(double, double)')
... def array_api_logaddexp(x1, x2):
...     return array_api.logaddexp(x1, x2)
>>> prob1 = np.log(1e-50)
>>> prob2 = np.log(2.5e-50)
>>> array_api_logaddexp(prob1, prob2).execute()
-113.876495

Array-API ‘logaddexp’ doc