|
35 | 35 | _acceptance_fn_divide, |
36 | 36 | _acceptance_fn_negative, |
37 | 37 | _acceptance_fn_reciprocal, |
| 38 | + _acceptance_fn_subtract, |
38 | 39 | _resolve_weak_types_all_py_ints, |
39 | 40 | ) |
40 | 41 |
|
|
1660 | 1661 | ) |
1661 | 1662 | del _real_docstring |
1662 | 1663 |
|
| 1664 | +# B22: ==== REMAINDER (x1, x2) |
| 1665 | +_remainder_docstring_ = r""" |
| 1666 | +remainder(x1, x2, /, \*, out=None, order='K') |
| 1667 | +
|
| 1668 | +Calculates the remainder of division for each element `x1_i` of the input array |
| 1669 | +`x1` with the respective element `x2_i` of the input array `x2`. |
| 1670 | +
|
| 1671 | +This function is equivalent to the Python modulus operator. |
| 1672 | +
|
| 1673 | +Args: |
| 1674 | + x1 (usm_ndarray): |
| 1675 | + First input array, expected to have a real-valued data type. |
| 1676 | + x2 (usm_ndarray): |
| 1677 | + Second input array, also expected to have a real-valued data type. |
| 1678 | + out (Union[usm_ndarray, None], optional): |
| 1679 | + Output array to populate. |
| 1680 | + Array must have the correct shape and the expected data type. |
| 1681 | + order ("C","F","A","K", optional): |
| 1682 | + Memory layout of the new output array, if parameter |
| 1683 | + `out` is ``None``. |
| 1684 | + Default: "K". |
| 1685 | +
|
| 1686 | +Returns: |
| 1687 | + usm_ndarray: |
| 1688 | + An array containing the element-wise remainders. Each remainder has the |
| 1689 | + same sign as respective element `x2_i`. The data type of the returned |
| 1690 | + array is determined by the Type Promotion Rules. |
| 1691 | +""" |
| 1692 | +remainder = BinaryElementwiseFunc( |
| 1693 | + "remainder", |
| 1694 | + ti._remainder_result_type, |
| 1695 | + ti._remainder, |
| 1696 | + _remainder_docstring_, |
| 1697 | + binary_inplace_fn=ti._remainder_inplace, |
| 1698 | +) |
| 1699 | +del _remainder_docstring_ |
| 1700 | + |
1663 | 1701 | # U28: ==== ROUND (x) |
1664 | 1702 | _round_docstring = r""" |
1665 | 1703 | round(x, /, \*, out=None, order='K') |
|
1835 | 1873 | ) |
1836 | 1874 | del _sqrt_docstring_ |
1837 | 1875 |
|
| 1876 | +# B23: ==== SUBTRACT (x1, x2) |
| 1877 | +_subtract_docstring_ = r""" |
| 1878 | +subtract(x1, x2, /, \*, out=None, order='K') |
| 1879 | +
|
| 1880 | +Calculates the difference between each element `x1_i` of the input |
| 1881 | +array `x1` and the respective element `x2_i` of the input array `x2`. |
| 1882 | +
|
| 1883 | +Args: |
| 1884 | + x1 (usm_ndarray): |
| 1885 | + First input array, expected to have a numeric data type. |
| 1886 | + x2 (usm_ndarray): |
| 1887 | + Second input array, also expected to have a numeric data type. |
| 1888 | + out (Union[usm_ndarray, None], optional): |
| 1889 | + Output array to populate. |
| 1890 | + Array must have the correct shape and the expected data type. |
| 1891 | + order ("C","F","A","K", optional): |
| 1892 | + Memory layout of the new output array, if parameter |
| 1893 | + `out` is ``None``. |
| 1894 | + Default: "K". |
| 1895 | +
|
| 1896 | +Returns: |
| 1897 | + usm_ndarray: |
| 1898 | + An array containing the element-wise differences. The data type |
| 1899 | + of the returned array is determined by the Type Promotion Rules. |
| 1900 | +""" |
| 1901 | +subtract = BinaryElementwiseFunc( |
| 1902 | + "subtract", |
| 1903 | + ti._subtract_result_type, |
| 1904 | + ti._subtract, |
| 1905 | + _subtract_docstring_, |
| 1906 | + binary_inplace_fn=ti._subtract_inplace, |
| 1907 | + acceptance_fn=_acceptance_fn_subtract, |
| 1908 | +) |
| 1909 | +del _subtract_docstring_ |
| 1910 | + |
1838 | 1911 | # U34: ==== TAN (x) |
1839 | 1912 | _tan_docstring = r""" |
1840 | 1913 | tan(x, /, \*, out=None, order='K') |
|
2011 | 2084 | ) |
2012 | 2085 | del _exp2_docstring_ |
2013 | 2086 |
|
| 2087 | +# B25: ==== COPYSIGN (x1, x2) |
| 2088 | +_copysign_docstring_ = r""" |
| 2089 | +copysign(x1, x2, /, \*, out=None, order='K') |
| 2090 | +
|
| 2091 | +Composes a floating-point value with the magnitude of `x1_i` and the sign of |
| 2092 | +`x2_i` for each element of input arrays `x1` and `x2`. |
| 2093 | +
|
| 2094 | +Args: |
| 2095 | + x1 (usm_ndarray): |
| 2096 | + First input array, expected to have a real-valued floating-point data |
| 2097 | + type. |
| 2098 | + x2 (usm_ndarray): |
| 2099 | + Second input array, also expected to have a real-valued floating-point |
| 2100 | + data type. |
| 2101 | + out (Union[usm_ndarray, None], optional): |
| 2102 | + Output array to populate. |
| 2103 | + Array have the correct shape and the expected data type. |
| 2104 | + order ("C","F","A","K", optional): |
| 2105 | + Memory layout of the new output array, if parameter |
| 2106 | + `out` is ``None``. |
| 2107 | + Default: "K". |
| 2108 | +
|
| 2109 | +Returns: |
| 2110 | + usm_ndarray: |
| 2111 | + An array containing the element-wise results. The data type |
| 2112 | + of the returned array is determined by the Type Promotion Rules. |
| 2113 | +""" |
| 2114 | +copysign = BinaryElementwiseFunc( |
| 2115 | + "copysign", |
| 2116 | + ti._copysign_result_type, |
| 2117 | + ti._copysign, |
| 2118 | + _copysign_docstring_, |
| 2119 | +) |
| 2120 | +del _copysign_docstring_ |
| 2121 | + |
2014 | 2122 | # U39: ==== RSQRT (x) |
2015 | 2123 | _rsqrt_docstring_ = r""" |
2016 | 2124 | rsqrt(x, /, \*, out=None, order='K') |
|
0 commit comments