From 1c2341a67b8278968d25c4dc93dc8d32da02b199 Mon Sep 17 00:00:00 2001 From: Stephannie Jimenez Date: Mon, 1 Feb 2021 23:46:14 -0500 Subject: [PATCH 1/3] Add logsumexp to the spec --- .../elementwise_functions.md | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/spec/API_specification/elementwise_functions.md b/spec/API_specification/elementwise_functions.md index 7b420afae..ee882e8cb 100644 --- a/spec/API_specification/elementwise_functions.md +++ b/spec/API_specification/elementwise_functions.md @@ -1007,6 +1007,36 @@ Computes the logical XOR for each element `x1_i` of the input array `x1` with th - an array containing the element-wise results. The returned array must have a data type of `bool`. +(function-logsumexp)= +### logsumexp(x1, x2) + +Calculates the logarithm of the sum of exponentiations of the inputs, `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`. + +#### Special Cases + +For floating-point operands, + +- If `x1_i` or `x2_i` is `NaN`, the result is `NaN`. +- If `x1_i` or `x2_i` is `+infinity`, the result is `+infinity`. + +#### Parameters +- **x1**: _<array>_ + + - first input array. + +- **x2**: _<array>_ + + - second input array. Must be compatible with `x1` (see {ref}`broadcasting`). + +#### Returns + +- **out**: _<array>_ + + - an array containing the element-wise results. The returned array must have a floating-point + data type determined by {ref}`type-promotion`. + (function-multiply)= ### multiply(x1, x2, /) From 24663b2d6681561d4b6eb5dced1110dcda42ff0f Mon Sep 17 00:00:00 2001 From: Stephannie Jimenez Date: Thu, 4 Feb 2021 14:50:45 -0500 Subject: [PATCH 2/3] rename back to logaddexp --- .../elementwise_functions.md | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/spec/API_specification/elementwise_functions.md b/spec/API_specification/elementwise_functions.md index ee882e8cb..8372fdf7a 100644 --- a/spec/API_specification/elementwise_functions.md +++ b/spec/API_specification/elementwise_functions.md @@ -927,6 +927,36 @@ For floating-point operands, - an array containing the evaluated base `10` logarithm for each element in `x`. The returned array must have a floating-point data type determined by {ref}`type-promotion`. +(function-logaddexp)= +### logaddexp(x1, x2) + +Calculates the logarithm of the sum of exponentiations of the inputs, `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`. + +#### Special Cases + +For floating-point operands, + +- If `x1_i` or `x2_i` is `NaN`, the result is `NaN`. +- If `x1_i` or `x2_i` is `+infinity`, the result is `+infinity`. + +#### Parameters +- **x1**: _<array>_ + + - first input array. + +- **x2**: _<array>_ + + - second input array. Must be compatible with `x1` (see {ref}`broadcasting`). + +#### Returns + +- **out**: _<array>_ + + - an array containing the element-wise results. The returned array must have a floating-point + data type determined by {ref}`type-promotion`. + (function-logical_and)= ### logical_and(x1, x2, /) @@ -1007,36 +1037,6 @@ Computes the logical XOR for each element `x1_i` of the input array `x1` with th - an array containing the element-wise results. The returned array must have a data type of `bool`. -(function-logsumexp)= -### logsumexp(x1, x2) - -Calculates the logarithm of the sum of exponentiations of the inputs, `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`. - -#### Special Cases - -For floating-point operands, - -- If `x1_i` or `x2_i` is `NaN`, the result is `NaN`. -- If `x1_i` or `x2_i` is `+infinity`, the result is `+infinity`. - -#### Parameters -- **x1**: _<array>_ - - - first input array. - -- **x2**: _<array>_ - - - second input array. Must be compatible with `x1` (see {ref}`broadcasting`). - -#### Returns - -- **out**: _<array>_ - - - an array containing the element-wise results. The returned array must have a floating-point - data type determined by {ref}`type-promotion`. - (function-multiply)= ### multiply(x1, x2, /) From 39385cd3d7210ec1c7330ee00dfa2bf7accc00fb Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 11 Feb 2021 08:39:57 -0800 Subject: [PATCH 3/3] Fix missing line break and update description --- spec/API_specification/elementwise_functions.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/API_specification/elementwise_functions.md b/spec/API_specification/elementwise_functions.md index 8372fdf7a..e145be588 100644 --- a/spec/API_specification/elementwise_functions.md +++ b/spec/API_specification/elementwise_functions.md @@ -930,7 +930,7 @@ For floating-point operands, (function-logaddexp)= ### logaddexp(x1, x2) -Calculates the logarithm of the sum of exponentiations of the inputs, `log(exp(x1) + exp(x2))` for +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`. @@ -942,6 +942,7 @@ For floating-point operands, - If `x1_i` or `x2_i` is `+infinity`, the result is `+infinity`. #### Parameters + - **x1**: _<array>_ - first input array.