Skip to content

Commit bc555af

Browse files
committed
Add rendering documentation for reflected and inplace operations
1 parent 75c9b9a commit bc555af

File tree

2 files changed

+40
-5
lines changed

2 files changed

+40
-5
lines changed

doc/reference/ndarray.rst

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ Comparison operators:
249249
dpnp.ndarray.__eq__
250250
dpnp.ndarray.__ne__
251251

252-
Truth value of an array (:func:`bool()`):
252+
Truth value of an array (:class:`bool() <bool>`):
253253

254254
.. autosummary::
255255
:toctree: generated/
@@ -260,11 +260,11 @@ Truth value of an array (:func:`bool()`):
260260

261261
Truth-value testing of an array invokes
262262
:meth:`dpnp.ndarray.__bool__`, which raises an error if the number of
263-
elements in the array is larger than 1, because the truth value
263+
elements in the array is not 1, because the truth value
264264
of such arrays is ambiguous. Use :meth:`.any() <dpnp.ndarray.any>` and
265265
:meth:`.all() <dpnp.ndarray.all>` instead to be clear about what is meant
266-
in such cases. (If the number of elements is 0, the array evaluates
267-
to ``False``.)
266+
in such cases. (If you wish to check for whether an array is empty,
267+
use for example ``.size > 0``.)
268268

269269

270270
Unary operations:
@@ -300,6 +300,26 @@ Arithmetic:
300300
dpnp.ndarray.__xor__
301301

302302

303+
Arithmetic, reflected:
304+
305+
.. autosummary::
306+
:toctree: generated/
307+
:nosignatures:
308+
309+
dpnp.ndarray.__radd__
310+
dpnp.ndarray.__rsub__
311+
dpnp.ndarray.__rmul__
312+
dpnp.ndarray.__rtruediv__
313+
dpnp.ndarray.__rfloordiv__
314+
dpnp.ndarray.__rmod__
315+
dpnp.ndarray.__rpow__
316+
dpnp.ndarray.__rlshift__
317+
dpnp.ndarray.__rrshift__
318+
dpnp.ndarray.__rand__
319+
dpnp.ndarray.__ror__
320+
dpnp.ndarray.__rxor__
321+
322+
303323
Arithmetic, in-place:
304324

305325
.. autosummary::
@@ -326,6 +346,8 @@ Matrix Multiplication:
326346
:toctree: generated/
327347

328348
dpnp.ndarray.__matmul__
349+
dpnp.ndarray.__rmatmul__
350+
dpnp.ndarray.__imatmul__
329351

330352

331353
Special methods
@@ -339,7 +361,7 @@ For standard library functions:
339361

340362
dpnp.ndarray.__copy__
341363
dpnp.ndarray.__deepcopy__
342-
.. dpnp.ndarray.__reduce__
364+
dpnp.ndarray.__reduce__
343365
dpnp.ndarray.__setstate__
344366

345367
Basic customization:

dpnp/dpnp_array.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,11 @@ def __pow__(self, other):
488488
return dpnp.power(self, other)
489489

490490
def __radd__(self, other):
491+
"""Return ``value+self``."""
491492
return dpnp.add(other, self)
492493

493494
def __rand__(self, other):
495+
"""Return ``value&self``."""
494496
return dpnp.bitwise_and(other, self)
495497

496498
# '__rdivmod__',
@@ -502,40 +504,51 @@ def __repr__(self):
502504
return dpt.usm_ndarray_repr(self._array_obj, prefix="array")
503505

504506
def __rfloordiv__(self, other):
507+
"""Return ``value//self``."""
505508
return dpnp.floor_divide(self, other)
506509

507510
def __rlshift__(self, other):
511+
"""Return ``value<<self``."""
508512
return dpnp.left_shift(other, self)
509513

510514
def __rmatmul__(self, other):
515+
"""Return ``value@self``."""
511516
return dpnp.matmul(other, self)
512517

513518
def __rmod__(self, other):
519+
"""Return ``value%self``."""
514520
return dpnp.remainder(other, self)
515521

516522
def __rmul__(self, other):
523+
"""Return ``value*self``."""
517524
return dpnp.multiply(other, self)
518525

519526
def __ror__(self, other):
527+
"""Return ``value|self``."""
520528
return dpnp.bitwise_or(other, self)
521529

522530
def __rpow__(self, other):
531+
"""Return ``value**self``."""
523532
return dpnp.power(other, self)
524533

525534
def __rrshift__(self, other):
535+
"""Return ``value>>self``."""
526536
return dpnp.right_shift(other, self)
527537

528538
def __rshift__(self, other):
529539
"""Return ``self>>value``."""
530540
return dpnp.right_shift(self, other)
531541

532542
def __rsub__(self, other):
543+
"""Return ``value-self``."""
533544
return dpnp.subtract(other, self)
534545

535546
def __rtruediv__(self, other):
547+
"""Return ``value/self``."""
536548
return dpnp.true_divide(other, self)
537549

538550
def __rxor__(self, other):
551+
"""Return ``value^self``."""
539552
return dpnp.bitwise_xor(other, self)
540553

541554
# '__setattr__',

0 commit comments

Comments
 (0)