|
104 | 104 | "mod",
|
105 | 105 | "modf",
|
106 | 106 | "multiply",
|
107 |
| - "nancumprod", |
108 |
| - "nancumsum", |
109 |
| - "nanprod", |
110 |
| - "nansum", |
111 | 107 | "negative",
|
112 | 108 | "positive",
|
113 | 109 | "power",
|
@@ -1660,174 +1656,6 @@ def multiply(
|
1660 | 1656 | )
|
1661 | 1657 |
|
1662 | 1658 |
|
1663 |
| -def nancumprod(x1, **kwargs): |
1664 |
| - """ |
1665 |
| - Return the cumulative product of array elements over a given axis treating Not a Numbers (NaNs) as one. |
1666 |
| -
|
1667 |
| - For full documentation refer to :obj:`numpy.nancumprod`. |
1668 |
| -
|
1669 |
| - Limitations |
1670 |
| - ----------- |
1671 |
| - Parameter `x` is supported as :class:`dpnp.ndarray`. |
1672 |
| - Keyword argument `kwargs` is currently unsupported. |
1673 |
| - Otherwise the function will be executed sequentially on CPU. |
1674 |
| - Input array data types are limited by supported DPNP :ref:`Data types`. |
1675 |
| -
|
1676 |
| - .. seealso:: :obj:`dpnp.cumprod` : Return the cumulative product of elements along a given axis. |
1677 |
| -
|
1678 |
| - Examples |
1679 |
| - -------- |
1680 |
| - >>> import dpnp as np |
1681 |
| - >>> a = np.array([1., np.nan]) |
1682 |
| - >>> result = np.nancumprod(a) |
1683 |
| - >>> [x for x in result] |
1684 |
| - [1.0, 1.0] |
1685 |
| - >>> b = np.array([[1., 2., np.nan], [4., np.nan, 6.]]) |
1686 |
| - >>> result = np.nancumprod(b) |
1687 |
| - >>> [x for x in result] |
1688 |
| - [1.0, 2.0, 2.0, 8.0, 8.0, 48.0] |
1689 |
| -
|
1690 |
| -
|
1691 |
| - """ |
1692 |
| - |
1693 |
| - x1_desc = dpnp.get_dpnp_descriptor(x1, copy_when_nondefault_queue=False) |
1694 |
| - if x1_desc and not kwargs: |
1695 |
| - return dpnp_nancumprod(x1_desc).get_pyobj() |
1696 |
| - |
1697 |
| - return call_origin(numpy.nancumprod, x1, **kwargs) |
1698 |
| - |
1699 |
| - |
1700 |
| -def nancumsum(x1, **kwargs): |
1701 |
| - """ |
1702 |
| - Return the cumulative sum of the elements along a given axis. |
1703 |
| -
|
1704 |
| - For full documentation refer to :obj:`numpy.nancumsum`. |
1705 |
| -
|
1706 |
| - Limitations |
1707 |
| - ----------- |
1708 |
| - Parameter `x` is supported as :class:`dpnp.ndarray`. |
1709 |
| - Keyword argument `kwargs` is currently unsupported. |
1710 |
| - Otherwise the function will be executed sequentially on CPU. |
1711 |
| - Input array data types are limited by supported DPNP :ref:`Data types`. |
1712 |
| -
|
1713 |
| - See Also |
1714 |
| - -------- |
1715 |
| - :obj:`dpnp.cumsum` : Return the cumulative sum of the elements along a given axis. |
1716 |
| -
|
1717 |
| - Examples |
1718 |
| - -------- |
1719 |
| - >>> import dpnp as np |
1720 |
| - >>> a = np.array([1., np.nan]) |
1721 |
| - >>> result = np.nancumsum(a) |
1722 |
| - >>> [x for x in result] |
1723 |
| - [1.0, 1.0] |
1724 |
| - >>> b = np.array([[1., 2., np.nan], [4., np.nan, 6.]]) |
1725 |
| - >>> result = np.nancumprod(b) |
1726 |
| - >>> [x for x in result] |
1727 |
| - [1.0, 3.0, 3.0, 7.0, 7.0, 13.0] |
1728 |
| -
|
1729 |
| - """ |
1730 |
| - |
1731 |
| - x1_desc = dpnp.get_dpnp_descriptor(x1, copy_when_nondefault_queue=False) |
1732 |
| - if x1_desc and not kwargs: |
1733 |
| - return dpnp_nancumsum(x1_desc).get_pyobj() |
1734 |
| - |
1735 |
| - return call_origin(numpy.nancumsum, x1, **kwargs) |
1736 |
| - |
1737 |
| - |
1738 |
| -def nanprod( |
1739 |
| - a, |
1740 |
| - axis=None, |
1741 |
| - dtype=None, |
1742 |
| - out=None, |
1743 |
| - keepdims=False, |
1744 |
| - initial=None, |
1745 |
| - where=True, |
1746 |
| -): |
1747 |
| - """ |
1748 |
| - Return the product of array elements over a given axis treating Not a Numbers (NaNs) as ones. |
1749 |
| -
|
1750 |
| - For full documentation refer to :obj:`numpy.nanprod`. |
1751 |
| -
|
1752 |
| - Returns |
1753 |
| - ------- |
1754 |
| - out : dpnp.ndarray |
1755 |
| - A new array holding the result is returned unless `out` is specified, in which case it is returned. |
1756 |
| -
|
1757 |
| - See Also |
1758 |
| - -------- |
1759 |
| - :obj:`dpnp.prod` : Returns product across array propagating NaNs. |
1760 |
| - :obj:`dpnp.isnan` : Test element-wise for NaN and return result as a boolean array. |
1761 |
| -
|
1762 |
| - Limitations |
1763 |
| - ----------- |
1764 |
| - Input array is only supported as either :class:`dpnp.ndarray` or :class:`dpctl.tensor.usm_ndarray`. |
1765 |
| - Parameters `initial`, and `where` are only supported with their default values. |
1766 |
| - Otherwise the function will be executed sequentially on CPU. |
1767 |
| - Input array data types are limited by supported DPNP :ref:`Data types`. |
1768 |
| -
|
1769 |
| - Examples |
1770 |
| - -------- |
1771 |
| - >>> import dpnp as np |
1772 |
| - >>> np.nanprod(np.array(1)) |
1773 |
| - array(1) |
1774 |
| - >>> np.nanprod(np.array([1])) |
1775 |
| - array(1) |
1776 |
| - >>> np.nanprod(np.array([1, np.nan])) |
1777 |
| - array(1.0) |
1778 |
| - >>> a = np.array([[1, 2], [3, np.nan]]) |
1779 |
| - >>> np.nanprod(a) |
1780 |
| - array(6.0) |
1781 |
| - >>> np.nanprod(a, axis=0) |
1782 |
| - array([3., 2.]) |
1783 |
| -
|
1784 |
| - """ |
1785 |
| - |
1786 |
| - a, mask = dpnp._replace_nan(a, 1) |
1787 |
| - |
1788 |
| - return dpnp.prod( |
1789 |
| - a, |
1790 |
| - axis=axis, |
1791 |
| - dtype=dtype, |
1792 |
| - out=out, |
1793 |
| - keepdims=keepdims, |
1794 |
| - initial=initial, |
1795 |
| - where=where, |
1796 |
| - ) |
1797 |
| - |
1798 |
| - |
1799 |
| -def nansum(x1, **kwargs): |
1800 |
| - """ |
1801 |
| - Calculate sum() function treating 'Not a Numbers' (NaN) as zero. |
1802 |
| -
|
1803 |
| - For full documentation refer to :obj:`numpy.nansum`. |
1804 |
| -
|
1805 |
| - Limitations |
1806 |
| - ----------- |
1807 |
| - Parameter `x1` is supported as :class:`dpnp.ndarray`. |
1808 |
| - Keyword argument `kwargs` is currently unsupported. |
1809 |
| - Otherwise the function will be executed sequentially on CPU. |
1810 |
| - Input array data types are limited by supported DPNP :ref:`Data types`. |
1811 |
| -
|
1812 |
| - Examples |
1813 |
| - -------- |
1814 |
| - >>> import dpnp as np |
1815 |
| - >>> np.nansum(np.array([1, 2])) |
1816 |
| - 3 |
1817 |
| - >>> np.nansum(np.array([[1, 2], [3, 4]])) |
1818 |
| - 10 |
1819 |
| -
|
1820 |
| - """ |
1821 |
| - |
1822 |
| - x1_desc = dpnp.get_dpnp_descriptor(x1, copy_when_nondefault_queue=False) |
1823 |
| - if x1_desc and not kwargs: |
1824 |
| - result_obj = dpnp_nansum(x1_desc).get_pyobj() |
1825 |
| - result = dpnp.convert_single_elem_array_to_scalar(result_obj) |
1826 |
| - return result |
1827 |
| - |
1828 |
| - return call_origin(numpy.nansum, x1, **kwargs) |
1829 |
| - |
1830 |
| - |
1831 | 1659 | def negative(
|
1832 | 1660 | x,
|
1833 | 1661 | /,
|
|
0 commit comments