@@ -878,7 +878,8 @@ def cumlogsumexp(
878878 Parameters
879879 ----------
880880 x : {dpnp.ndarray, usm_ndarray}
881- Input array, expected to have a boolean or real-valued data type.
881+ Input array, expected to have a boolean or real-valued floating-point
882+ data type.
882883 axis : {None, int}, optional
883884 Axis or axes along which values must be computed. If a tuple of unique
884885 integers, values are computed over multiple axes. If ``None``, the
@@ -1667,13 +1668,10 @@ def cumlogsumexp(
16671668)
16681669
16691670
1670- _LOGADDEXP_DOCSTRING = """
1671- Calculates the natural logarithm of the sum of exponents for each element `x1_i`
1672- of the input array `x1` with the respective element `x2_i` of the input
1673- array `x2`.
1674-
1675- This function calculates `log(exp(x1) + exp(x2))` more accurately for small
1676- values of `x`.
1671+ _LOGADDEXP_DOCSTRING = r"""
1672+ Calculates the natural logarithm of the sum of exponentiations
1673+ :math:`\log(e^x1 + e^x2)` for each element :math:`x1_i` of the input array `x1`
1674+ with the respective element :math:`x2_i` of the input array `x2`.
16771675
16781676For full documentation refer to :obj:`numpy.logaddexp`.
16791677
@@ -1682,13 +1680,9 @@ def cumlogsumexp(
16821680x1 : {dpnp.ndarray, usm_ndarray, scalar}
16831681 First input array, expected to have a real-valued floating-point
16841682 data type.
1685- Both inputs `x1` and `x2` can not be scalars at the same time.
16861683x2 : {dpnp.ndarray, usm_ndarray, scalar}
1687- Second input array, also expected to have a real-valued
1688- floating-point data type.
1689- Both inputs `x1` and `x2` can not be scalars at the same time.
1690- If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1691- (which becomes the shape of the output).
1684+ Second input array, also expected to have a real-valued floating-point data
1685+ type.
16921686out : {None, dpnp.ndarray, usm_ndarray}, optional
16931687 Output array to populate.
16941688 Array must have the correct shape and the expected data type.
@@ -1702,8 +1696,8 @@ def cumlogsumexp(
17021696Returns
17031697-------
17041698out : dpnp.ndarray
1705- An array containing the element-wise results. The data type
1706- of the returned array is determined by the Type Promotion Rules.
1699+ An array containing the element-wise results. The data type of the returned
1700+ array is determined by the Type Promotion Rules.
17071701
17081702Limitations
17091703-----------
@@ -1713,12 +1707,24 @@ def cumlogsumexp(
17131707
17141708See Also
17151709--------
1716- :obj:`dpnp.log` : Natural logarithm, element-wise.
1717- :obj:`dpnp.exp` : Exponential, element-wise.
1718- :obj:`dpnp.logaddexp2`: Logarithm of the sum of exponentiation of inputs in
1719- base-2, element-wise.
1720- :obj:`dpnp.logsumexp` : Logarithm of the sum of exponents of elements in the
1721- input array.
1710+ :obj:`dpnp.log` : Calculate :math:`\log(x)`, element-wise.
1711+ :obj:`dpnp.exp` : Calculate :math:`e^x`, element-wise.
1712+ :obj:`dpnp.logaddexp2`: Calculate :math:`\log_2(2^x1 + 2^x2)`, element-wise.
1713+ :obj:`dpnp.logsumexp` : Logarithm of the sum of exponentials of elements in the
1714+ input array.
1715+
1716+ Notes
1717+ -----
1718+ At least one of `x1` or `x2` must be an array.
1719+
1720+ If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1721+ (which becomes the shape of the output).
1722+ This function is equivalent to :math:`\sqrt{x1^2 + x2^2}`, element-wise.
1723+
1724+ This function is useful in statistics where the calculated probabilities of
1725+ events may be so small as to exceed the range of normal floating-point numbers.
1726+ In such cases the natural logarithm of the calculated probability is stored.
1727+ This function allows adding probabilities stored in such a fashion.
17221728
17231729Examples
17241730--------
@@ -1741,16 +1747,10 @@ def cumlogsumexp(
17411747)
17421748
17431749
1744- _LOGADDEXP2_DOCSTRING = """
1745- Calculates the logarithm of the sum of exponents in base-2 for each element
1746- `x1_i` of the input array `x1` with the respective element `x2_i` of the input
1747- array `x2`.
1748-
1749- This function calculates `log2(2**x1 + 2**x2)`. It is useful in machine
1750- learning when the calculated probabilities of events may be so small as
1751- to exceed the range of normal floating point numbers. In such cases the base-2
1752- logarithm of the calculated probability can be used instead. This function
1753- allows adding probabilities stored in such a fashion.
1750+ _LOGADDEXP2_DOCSTRING = r"""
1751+ Calculates the base-2 logarithm of the sum of exponentiations
1752+ :math:`\log_2(e^x1 + e^x2)` for each element :math:`x1_i` of the input array
1753+ `x1` with the respective element :math:`x2_i` of the input array `x2`.
17541754
17551755For full documentation refer to :obj:`numpy.logaddexp2`.
17561756
@@ -1759,13 +1759,9 @@ def cumlogsumexp(
17591759x1 : {dpnp.ndarray, usm_ndarray, scalar}
17601760 First input array, expected to have a real-valued floating-point
17611761 data type.
1762- Both inputs `x1` and `x2` can not be scalars at the same time.
17631762x2 : {dpnp.ndarray, usm_ndarray, scalar}
1764- Second input array, also expected to have a real-valued
1765- floating-point data type.
1766- Both inputs `x1` and `x2` can not be scalars at the same time.
1767- If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1768- (which becomes the shape of the output).
1763+ Second input array, also expected to have a real-valued floating-point data
1764+ type.
17691765out : {None, dpnp.ndarray, usm_ndarray}, optional
17701766 Output array to populate.
17711767 Array must have the correct shape and the expected data type.
@@ -1790,9 +1786,23 @@ def cumlogsumexp(
17901786
17911787See Also
17921788--------
1793- :obj:`dpnp.logaddexp`: Natural logarithm of the sum of exponentiation of
1794- inputs, element-wise.
1795- :obj:`dpnp.logsumexp` : Logarithm of the sum of exponentiation of the inputs.
1789+ :obj:`dpnp.logaddexp`: Calculate :math:`\log(2^x1 + 2^x2)`, element-wise.
1790+ :obj:`dpnp.logsumexp` : Logarithm of the sum of exponentials of elements in the
1791+ input array.
1792+
1793+ Notes
1794+ -----
1795+ At least one of `x1` or `x2` must be an array.
1796+
1797+ If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1798+ (which becomes the shape of the output).
1799+ This function is equivalent to :math:`\sqrt{x1^2 + x2^2}`, element-wise.
1800+
1801+ This function is useful in machine learning when the calculated probabilities
1802+ of events may be so small as to exceed the range of normal floating-point
1803+ numbers. In such cases the base-2 logarithm of the calculated probability can
1804+ be used instead. This function allows adding probabilities stored in such a
1805+ fashion.
17961806
17971807Examples
17981808--------
@@ -1816,14 +1826,15 @@ def cumlogsumexp(
18161826
18171827
18181828def logsumexp (x , / , * , axis = None , dtype = None , keepdims = False , out = None ):
1819- """
1820- Calculates the logarithm of the sum of exponents of elements in
1829+ r """
1830+ Calculates the natural logarithm of the sum of exponentials of elements in
18211831 the input array.
18221832
18231833 Parameters
18241834 ----------
18251835 x : {dpnp.ndarray, usm_ndarray}
1826- Input array, expected to have a real-valued floating-point data type.
1836+ Input array, expected to have a boolean or real-valued floating-point
1837+ data type.
18271838 axis : {None, int or tuple of ints}, optional
18281839 Axis or axes along which values must be computed. If a tuple of unique
18291840 integers, values are computed over multiple axes. If ``None``, the
@@ -1874,12 +1885,12 @@ def logsumexp(x, /, *, axis=None, dtype=None, keepdims=False, out=None):
18741885
18751886 See Also
18761887 --------
1877- :obj:`dpnp.log` : Natural logarithm , element-wise.
1878- :obj:`dpnp.exp` : Exponential , element-wise.
1879- :obj:`dpnp.logaddexp` : Logarithm of the sum of exponents of
1880- the inputs , element-wise.
1881- :obj:`dpnp.logaddexp2 ` : Logarithm of the sum of exponents of
1882- the inputs in base-2, element-wise .
1888+ :obj:`dpnp.log` : Calculate :math:`\log(x)` , element-wise.
1889+ :obj:`dpnp.exp` : Calculate :math:`e^x` , element-wise.
1890+ :obj:`dpnp.logaddexp`: Calculate :math:`\log(2^x1 + 2^x2)`, element-wise.
1891+ :obj:`dpnp.logaddexp2`: Calculate :math:`\log_2(2^x1 + 2^x2)` , element-wise.
1892+ :obj:`dpnp.cumlogsumexp ` : Cumulative the natural logarithm of the sum of
1893+ elements in the input array .
18831894
18841895 Examples
18851896 --------
0 commit comments