logaddexp

logaddexp(x1: array, x2: array, /) array

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.

Parameters:
  • x1 (array) – first input array. Should have a real-valued floating-point data type.

  • x2 (array) – second input array. Must be compatible with x1 (see Broadcasting). Should have a real-valued floating-point data type.

Returns:

out (array) – an array containing the element-wise results. The returned array must have a real-valued floating-point data type determined by Type Promotion Rules.

Notes

Special cases

For floating-point operands,

  • If either x1_i or x2_i is NaN, the result is NaN.

  • If x1_i is +infinity and x2_i is not NaN, the result is +infinity.

  • If x1_i is not NaN and x2_i is +infinity, the result is +infinity.