Skip to content

Commit 014cef6

Browse files
steff456kgryte
andauthored
PR: Add logaddexp (data-apis#124)
* Add logsumexp to the spec * rename back to logaddexp * Fix missing line break and update description Co-authored-by: Athan <kgryte@gmail.com>
1 parent 56fb2fb commit 014cef6

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

spec/API_specification/elementwise_functions.md

+31
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,37 @@ For floating-point operands,
927927

928928
- 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`.
929929

930+
(function-logaddexp)=
931+
### logaddexp(x1, x2)
932+
933+
Calculates the logarithm of the sum of exponentiations `log(exp(x1) + exp(x2))` for
934+
each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array
935+
`x2`.
936+
937+
#### Special Cases
938+
939+
For floating-point operands,
940+
941+
- If `x1_i` or `x2_i` is `NaN`, the result is `NaN`.
942+
- If `x1_i` or `x2_i` is `+infinity`, the result is `+infinity`.
943+
944+
#### Parameters
945+
946+
- **x1**: _&lt;array&gt;_
947+
948+
- first input array.
949+
950+
- **x2**: _&lt;array&gt;_
951+
952+
- second input array. Must be compatible with `x1` (see {ref}`broadcasting`).
953+
954+
#### Returns
955+
956+
- **out**: _&lt;array&gt;_
957+
958+
- an array containing the element-wise results. The returned array must have a floating-point
959+
data type determined by {ref}`type-promotion`.
960+
930961
(function-logical_and)=
931962
### logical_and(x1, x2, /)
932963

0 commit comments

Comments
 (0)