|
2 | 2 |
|
3 | 3 | from ._elementwise_common import BinaryElementwiseFunc, UnaryElementwiseFunc
|
4 | 4 |
|
5 |
| -# ABS |
| 5 | +# U01: ==== ABS (x) |
6 | 6 | _abs_docstring_ = """
|
7 | 7 | Calculate the absolute value element-wise.
|
8 | 8 | """
|
9 | 9 |
|
10 | 10 | abs = UnaryElementwiseFunc("abs", ti._abs_result_type, ti._abs, _abs_docstring_)
|
11 | 11 |
|
12 |
| -# ADD |
| 12 | +# U02: ==== ACOS (x) |
| 13 | +# FIXME: implement U02 |
| 14 | + |
| 15 | +# U03: ===== ACOSH (x) |
| 16 | +# FIXME: implement U03 |
| 17 | + |
| 18 | +# B01: ===== ADD (x1, x2) |
13 | 19 |
|
14 | 20 | _add_docstring_ = """
|
15 | 21 | add(x1, x2, order='K')
|
|
31 | 37 | "add", ti._add_result_type, ti._add, _add_docstring_
|
32 | 38 | )
|
33 | 39 |
|
34 |
| -# DIVIDE |
| 40 | +# U04: ===== ASIN (x) |
| 41 | +# FIXME: implement U04 |
| 42 | + |
| 43 | +# U05: ===== ASINH (x) |
| 44 | +# FIXME: implement U05 |
| 45 | + |
| 46 | +# U06: ===== ATAN (x) |
| 47 | +# FIXME: implement U06 |
| 48 | + |
| 49 | +# B02: ===== ATAN2 (x1, x2) |
| 50 | +# FIXME: implemetn B02 |
| 51 | + |
| 52 | +# U07: ===== ATANH (x) |
| 53 | +# FIXME: implemetn U07 |
| 54 | + |
| 55 | +# B03: ===== BITWISE_AND (x1, x2) |
| 56 | +# FIXME: implemetn B03 |
| 57 | + |
| 58 | +# B04: ===== BITWISE_LEFT_SHIFT (x1, x2) |
| 59 | +# FIXME: implement B04 |
| 60 | + |
| 61 | +# U08: ===== BITWISE_INVERT (x) |
| 62 | +# FIXME: implement U08 |
| 63 | + |
| 64 | +# B05: ===== BITWISE_OR (x1, x2) |
| 65 | +# FIXME: implement B05 |
| 66 | + |
| 67 | +# B06: ===== BITWISE_RIGHT_SHIFT (x1, x2) |
| 68 | +# FIXME: implement B06 |
| 69 | + |
| 70 | +# B07: ===== BITWISE_XOR (x1, x2) |
| 71 | +# FIXME: implement B07 |
| 72 | + |
| 73 | +# U09: ==== CEIL (x) |
| 74 | +# FIXME: implement U09 |
| 75 | + |
| 76 | +# U10: ==== CONJ (x) |
| 77 | +# FIXME: implement U10 |
| 78 | + |
| 79 | +# U11: ==== COS (x) |
| 80 | +_cos_docstring = """ |
| 81 | +cos(x, order='K') |
| 82 | +
|
| 83 | +Computes cosine for each element `x_i` for input array `x`. |
| 84 | +""" |
| 85 | + |
| 86 | +cos = UnaryElementwiseFunc("cos", ti._cos_result_type, ti._cos, _cos_docstring) |
| 87 | + |
| 88 | +# U12: ==== COSH (x) |
| 89 | +# FIXME: implement U12 |
35 | 90 |
|
| 91 | +# B08: ==== DIVIDE (x1, x2) |
36 | 92 | _divide_docstring_ = """
|
37 | 93 | divide(x1, x2, order='K')
|
38 | 94 |
|
|
49 | 105 | an array containing the result of element-wise division. The data type
|
50 | 106 | of the returned array is determined by the Type Promotion Rules.
|
51 | 107 | """
|
| 108 | + |
52 | 109 | divide = BinaryElementwiseFunc(
|
53 | 110 | "divide", ti._divide_result_type, ti._divide, _divide_docstring_
|
54 | 111 | )
|
55 | 112 |
|
| 113 | +# B09: ==== EQUAL (x1, x2) |
| 114 | +_equal_docstring_ = """ |
| 115 | +equal(x1, x2, order='K') |
56 | 116 |
|
57 |
| -# COS |
58 |
| - |
59 |
| -_cos_docstring = """ |
60 |
| -cos(x, order='K') |
| 117 | +Calculates equality test results for each element `x1_i` of the input array `x1` |
| 118 | +with the respective element `x2_i` of the input array `x2`. |
61 | 119 |
|
62 |
| -Computes cosine for each element `x_i` for input array `x`. |
| 120 | +Args: |
| 121 | + x1 (usm_ndarray): |
| 122 | + First input array, expected to have numeric data type. |
| 123 | + x2 (usm_ndarray): |
| 124 | + Second input array, also expected to have numeric data type. |
| 125 | +Returns: |
| 126 | + usm_narray: |
| 127 | + an array containing the result of element-wise equality comparison. |
| 128 | + The data type of the returned array is determined by the |
| 129 | + Type Promotion Rules. |
63 | 130 | """
|
64 | 131 |
|
65 |
| -cos = UnaryElementwiseFunc("cos", ti._cos_result_type, ti._cos, _cos_docstring) |
| 132 | +equal = BinaryElementwiseFunc( |
| 133 | + "equal", ti._equal_result_type, ti._equal, _equal_docstring_ |
| 134 | +) |
| 135 | + |
| 136 | +# U13: ==== EXP (x) |
| 137 | +# FIXME: implement U13 |
| 138 | + |
| 139 | +# U14: ==== EXPM1 (x) |
| 140 | +# FIXME: implement U14 |
| 141 | + |
| 142 | +# U15: ==== FLOOR (x) |
| 143 | +# FIXME: implement U15 |
66 | 144 |
|
67 |
| -# ISFINITE |
| 145 | +# B10: ==== FLOOR_DIVIDE (x1, x2) |
| 146 | +# FIXME: implement B10 |
68 | 147 |
|
| 148 | +# B11: ==== GREATER (x1, x2) |
| 149 | +# FIXME: implement B11 |
| 150 | + |
| 151 | +# B12: ==== GREATER_EQUAL (x1, x2) |
| 152 | +# FIXME: implement B12 |
| 153 | + |
| 154 | +# U16: ==== IMAG (x) |
| 155 | +# FIXME: implement U16 |
| 156 | + |
| 157 | +# U17: ==== ISFINITE (x) |
69 | 158 | _isfinite_docstring_ = """
|
70 | 159 | Computes if every element of input array is a finite number.
|
71 | 160 | """
|
|
74 | 163 | "isfinite", ti._isfinite_result_type, ti._isfinite, _isfinite_docstring_
|
75 | 164 | )
|
76 | 165 |
|
77 |
| -# ISNAN |
| 166 | +# U18: ==== ISINF (x) |
| 167 | +_isinf_docstring_ = """ |
| 168 | +Computes if every element of input array is an infinity. |
| 169 | +""" |
| 170 | + |
| 171 | +isinf = UnaryElementwiseFunc( |
| 172 | + "isinf", ti._isinf_result_type, ti._isinf, _isinf_docstring_ |
| 173 | +) |
78 | 174 |
|
| 175 | +# U19: ==== ISNAN (x) |
79 | 176 | _isnan_docstring_ = """
|
80 | 177 | Computes if every element of input array is a NaN.
|
81 | 178 | """
|
|
84 | 181 | "isnan", ti._isnan_result_type, ti._isnan, _isnan_docstring_
|
85 | 182 | )
|
86 | 183 |
|
87 |
| -# ISINF |
| 184 | +# B13: ==== LESS (x1, x2) |
| 185 | +# FIXME: implement B13 |
88 | 186 |
|
89 |
| -_isinf_docstring_ = """ |
90 |
| -Computes if every element of input array is an infinity. |
91 |
| -""" |
| 187 | +# B14: ==== LESS_EQUAL (x1, x2) |
| 188 | +# FIXME: implement B14 |
92 | 189 |
|
93 |
| -isinf = UnaryElementwiseFunc( |
94 |
| - "isinf", ti._isinf_result_type, ti._isinf, _isinf_docstring_ |
95 |
| -) |
| 190 | +# U20: ==== LOG (x) |
| 191 | +# FIXME: implement U20 |
| 192 | + |
| 193 | +# U21: ==== LOG1P (x) |
| 194 | +# FIXME: implement U21 |
| 195 | + |
| 196 | +# U22: ==== LOG2 (x) |
| 197 | +# FIXME: implement U22 |
| 198 | + |
| 199 | +# U23: ==== LOG10 (x) |
| 200 | +# FIXME: implement U23 |
| 201 | + |
| 202 | +# B15: ==== LOGADDEXP (x1, x2) |
| 203 | +# FIXME: implement B15 |
96 | 204 |
|
97 |
| -# SQRT |
| 205 | +# B16: ==== LOGICAL_AND (x1, x2) |
| 206 | +# FIXME: implement B16 |
98 | 207 |
|
| 208 | +# U24: ==== LOGICAL_NOT (x) |
| 209 | +# FIXME: implement U24 |
| 210 | + |
| 211 | +# B17: ==== LOGICAL_OR (x1, x2) |
| 212 | +# FIXME: implement B17 |
| 213 | + |
| 214 | +# B18: ==== LOGICAL_XOR (x1, x2) |
| 215 | +# FIXME: implement B18 |
| 216 | + |
| 217 | +# B19: ==== MULTIPLY (x1, x2) |
| 218 | +# FIXME: implement B19 |
| 219 | + |
| 220 | +# U25: ==== NEGATIVE (x) |
| 221 | +# FIXME: implement U25 |
| 222 | + |
| 223 | +# B20: ==== NOT_EQUAL (x1, x2) |
| 224 | +# FIXME: implement B20 |
| 225 | + |
| 226 | +# U26: ==== POSITIVE (x) |
| 227 | +# FIXME: implement U26 |
| 228 | + |
| 229 | +# B21: ==== POW (x1, x2) |
| 230 | +# FIXME: implement B21 |
| 231 | + |
| 232 | +# U27: ==== REAL (x) |
| 233 | +# FIXME: implement U27 |
| 234 | + |
| 235 | +# B22: ==== REMAINDER (x1, x2) |
| 236 | +# FIXME: implement B22 |
| 237 | + |
| 238 | +# U28: ==== ROUND (x) |
| 239 | +# FIXME: implement U28 |
| 240 | + |
| 241 | +# U29: ==== SIGN (x) |
| 242 | +# FIXME: implement U29 |
| 243 | + |
| 244 | +# U30: ==== SIN (x) |
| 245 | +# FIXME: implement U30 |
| 246 | + |
| 247 | +# U31: ==== SINH (x) |
| 248 | +# FIXME: implement U31 |
| 249 | + |
| 250 | +# U32: ==== SQUARE (x) |
| 251 | +# FIXME: implement U32 |
| 252 | + |
| 253 | +# U33: ==== SQRT (x) |
99 | 254 | _sqrt_docstring_ = """
|
100 | 255 | Computes sqrt for each element `x_i` for input array `x`.
|
101 | 256 | """
|
102 | 257 |
|
103 | 258 | sqrt = UnaryElementwiseFunc(
|
104 | 259 | "sqrt", ti._sqrt_result_type, ti._sqrt, _sqrt_docstring_
|
105 | 260 | )
|
| 261 | + |
| 262 | +# B23: ==== SUBTRACT (x1, x2) |
| 263 | +# FIXME: implement B23 |
| 264 | + |
| 265 | +# U34: ==== TAN (x) |
| 266 | +# FIXME: implement U34 |
| 267 | + |
| 268 | +# U35: ==== TANH (x) |
| 269 | +# FIXME: implement U35 |
| 270 | + |
| 271 | +# U36: ==== TRUNC (x) |
| 272 | +# FIXME: implement U36 |
0 commit comments