You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Comparison operators should be defined for arrays having any data type.
136
159
137
160
### In-place Operators
138
161
139
-
A conforming implementation of the array API standard must provide and support
140
-
an array object supporting the following in-place Python operators:
141
-
142
-
-`+=`. May be implemented via `__iadd__`.
143
-
-`-=`. May be implemented via `__isub__`.
144
-
-`*=`. May be implemented via `__imul__`.
145
-
-`/=`. May be implemented via `__itruediv__`.
146
-
-`//=`. May be implemented via `__ifloordiv__`.
147
-
-`**=`. May be implemented via `__ipow__`.
148
-
-`@=`. May be implemented via `__imatmul__`.
149
-
-`%=`. May be implemented via `__imod__`.
150
-
-`&=`. May be implemented via `__iand__`.
151
-
-`|=`. May be implemented via `__ior__`.
152
-
-`^=`. May be implemented via `__ixor__`.
153
-
-`<<=`. May be implemented via `__ilshift__`.
154
-
-`>>=`. May be implemented via `__irshift__`.
155
-
156
-
An in-place operation must not change the dtype or shape of the in-place array
157
-
as a result of {ref}`type-promotion` or {ref}`broadcasting`.
158
-
159
-
An in-place operation must have the same behavior (including special cases) as
160
-
its respective binary (i.e., two operand, non-assignment) operation. For example,
161
-
after in-place addition `x1 += x2`, the modified array `x1` must always equal the
162
-
result of the equivalent binary arithmetic operation `x1 = x1 + x2`.
162
+
A conforming implementation of the array API standard must provide and support an array object supporting the following in-place Python operators.
163
163
164
-
```{note}
164
+
An in-place operation must not change the data type or shape of the in-place array as a result of {ref}`type-promotion` or {ref}`broadcasting`.
165
+
166
+
An in-place operation must have the same behavior (including special cases) as its respective binary (i.e., two operand, non-assignment) operation. For example, after in-place addition `x1 += x2`, the modified array `x1` must always equal the result of the equivalent binary arithmetic operation `x1 = x1 + x2`.
165
167
168
+
```{note}
166
169
In-place operators must be supported as discussed in {ref}`copyview-mutability`.
167
170
```
168
171
172
+
#### Arithmetic Operators
173
+
174
+
-`+=`. May be implemented via `__iadd__`.
175
+
-`-=`. May be implemented via `__isub__`.
176
+
-`*=`. May be implemented via `__imul__`.
177
+
-`/=`. May be implemented via `__itruediv__`.
178
+
-`//=`. May be implemented via `__ifloordiv__`.
179
+
-`**=`. May be implemented via `__ipow__`.
180
+
-`%=`. May be implemented via `__imod__`.
181
+
182
+
#### Array Operators
183
+
184
+
-`@=`. May be implemented via `__imatmul__`.
185
+
186
+
#### Bitwise Operators
187
+
188
+
-`&=`. May be implemented via `__iand__`.
189
+
-`|=`. May be implemented via `__ior__`.
190
+
-`^=`. May be implemented via `__ixor__`.
191
+
-`<<=`. May be implemented via `__ilshift__`.
192
+
-`>>=`. May be implemented via `__irshift__`.
193
+
169
194
### Reflected Operators
170
195
171
-
A conforming implementation of the array API standard must provide and support
172
-
an array object supporting the following reflected operators:
173
-
174
-
-`__radd__`
175
-
-`__rsub__`
176
-
-`__rmul__`
177
-
-`__rtruediv__`
178
-
-`__rfloordiv__`
179
-
-`__rpow__`
180
-
-`__rmatmul__`
181
-
-`__rmod__`
182
-
-`__rand__`
183
-
-`__ror__`
184
-
-`__rxor__`
185
-
-`__rlshift__`
186
-
-`__rrshift__`
196
+
A conforming implementation of the array API standard must provide and support an array object supporting the following reflected operators.
187
197
188
198
The results of applying reflected operators must match their non-reflected equivalents.
189
199
190
200
```{note}
191
201
All operators for which `array <op> scalar` is implemented must have an equivalent reflected operator implementation.
0 commit comments