Skip to content

Commit ec8d389

Browse files
committed
Use \text command in math
1 parent ad46975 commit ec8d389

File tree

1 file changed

+56
-56
lines changed

1 file changed

+56
-56
lines changed

dpnp/dpnp_array.py

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ def __init__(
115115
)
116116

117117
def __abs__(self):
118-
"""Return :math:`|self|`."""
118+
r"""Return :math:`|\text{self}|`."""
119119
return dpnp.abs(self)
120120

121121
def __add__(self, other):
122-
"""Return :math:`self+value`."""
122+
r"""Return :math:`\text{self + value}`."""
123123
return dpnp.add(self, other)
124124

125125
def __and__(self, other):
126-
"""Return :math:`self&value`."""
126+
r"""Return :math:`\text{self & value}`."""
127127
return dpnp.bitwise_and(self, other)
128128

129129
def __array__(self, dtype=None, /, *, copy=None):
@@ -180,7 +180,7 @@ def __array_namespace__(self, /, *, api_version=None):
180180
# '__array_wrap__',
181181

182182
def __bool__(self):
183-
"""``True`` if self else ``False``."""
183+
"""``True`` if `self` else ``False``."""
184184
return self._array_obj.__bool__()
185185

186186
# '__class__',
@@ -290,27 +290,27 @@ def __dlpack_device__(self):
290290
# '__doc__',
291291

292292
def __eq__(self, other):
293-
"""Return :math:`self==value`."""
293+
r"""Return :math:`\text{self == value}`."""
294294
return dpnp.equal(self, other)
295295

296296
def __float__(self):
297297
"""Convert a zero-dimensional array to a Python float object."""
298298
return self._array_obj.__float__()
299299

300300
def __floordiv__(self, other):
301-
"""Return :math:`self//value`."""
301+
r"""Return :math:`\text{self // value}`."""
302302
return dpnp.floor_divide(self, other)
303303

304304
# '__format__',
305305

306306
def __ge__(self, other):
307-
"""Return :math:`self>=value`."""
307+
r"""Return :math:`\text{self >= value}`."""
308308
return dpnp.greater_equal(self, other)
309309

310310
# '__getattribute__',
311311

312312
def __getitem__(self, key):
313-
"""Return :math:`self[key]`."""
313+
r"""Return :math:`\text{self[key]}`."""
314314
key = _get_unwrapped_index_key(key)
315315

316316
item = self._array_obj.__getitem__(key)
@@ -319,33 +319,33 @@ def __getitem__(self, key):
319319
# '__getstate__',
320320

321321
def __gt__(self, other):
322-
"""Return :math:`self>value`."""
322+
r"""Return :math:`\text{self > value}`."""
323323
return dpnp.greater(self, other)
324324

325325
# '__hash__',
326326

327327
def __iadd__(self, other):
328-
"""Return :math:`self+=value`."""
328+
r"""Return :math:`\text{self += value}`."""
329329
dpnp.add(self, other, out=self)
330330
return self
331331

332332
def __iand__(self, other):
333-
"""Return :math:`self&=value`."""
333+
r"""Return :math:`\text{self &= value}`."""
334334
dpnp.bitwise_and(self, other, out=self)
335335
return self
336336

337337
def __ifloordiv__(self, other):
338-
"""Return :math:`self//=value`."""
338+
r"""Return :math:`\text{self //= value}`."""
339339
dpnp.floor_divide(self, other, out=self)
340340
return self
341341

342342
def __ilshift__(self, other):
343-
"""Return :math:`self<<=value`."""
343+
r"""Return :math:`\text{self <<= value}`."""
344344
dpnp.left_shift(self, other, out=self)
345345
return self
346346

347347
def __imatmul__(self, other):
348-
"""Return :math:`self@=value`."""
348+
r"""Return :math:`\text{self @= value}`."""
349349

350350
# Unlike `matmul(a, b, out=a)` we ensure that the result isn't broadcast
351351
# if the result without `out` would have less dimensions than `a`.
@@ -369,12 +369,12 @@ def __imatmul__(self, other):
369369
return self
370370

371371
def __imod__(self, other):
372-
"""Return :math:`self%=value`."""
372+
r"""Return :math:`\text{self %= value}`."""
373373
dpnp.remainder(self, other, out=self)
374374
return self
375375

376376
def __imul__(self, other):
377-
"""Return :math:`self*=value`."""
377+
r"""Return :math:`\text{self *= value}`."""
378378
dpnp.multiply(self, other, out=self)
379379
return self
380380

@@ -390,163 +390,163 @@ def __int__(self):
390390
return self._array_obj.__int__()
391391

392392
def __invert__(self):
393-
"""Return :math:`~self`."""
393+
r"""Return :math:`\text{~self}`."""
394394
return dpnp.invert(self)
395395

396396
def __ior__(self, other):
397-
"""Return :math:`self|=value`."""
397+
r"""Return :math:`\text{self |= value}`."""
398398
dpnp.bitwise_or(self, other, out=self)
399399
return self
400400

401401
def __ipow__(self, other):
402-
"""Return :math:`self**=value`."""
402+
r"""Return :math:`\text{self **= value}`."""
403403
dpnp.power(self, other, out=self)
404404
return self
405405

406406
def __irshift__(self, other):
407-
"""Return :math:`self>>=value`."""
407+
r"""Return :math:`\text{self >>= value}`."""
408408
dpnp.right_shift(self, other, out=self)
409409
return self
410410

411411
def __isub__(self, other):
412-
"""Return :math:`self-=value`."""
412+
r"""Return :math:`\text{self -= value}`."""
413413
dpnp.subtract(self, other, out=self)
414414
return self
415415

416416
def __iter__(self):
417-
"""Return :math:`iter(self)`."""
417+
r"""Return :math:`\text{iter(self)}`."""
418418
if self.ndim == 0:
419419
raise TypeError("iteration over a 0-d array")
420420
return (self[i] for i in range(self.shape[0]))
421421

422422
def __itruediv__(self, other):
423-
"""Return :math:`self/=value`."""
423+
r"""Return :math:`\text{self /= value}`."""
424424
dpnp.true_divide(self, other, out=self)
425425
return self
426426

427427
def __ixor__(self, other):
428-
"""Return :math:`self^=value`."""
428+
r"""Return :math:`\text{self ^= value}`."""
429429
dpnp.bitwise_xor(self, other, out=self)
430430
return self
431431

432432
def __le__(self, other):
433-
"""Return :math:`self<=value`."""
433+
r"""Return :math:`\text{self <= value}`."""
434434
return dpnp.less_equal(self, other)
435435

436436
def __len__(self):
437-
"""Return :math:`len(self)`."""
437+
r"""Return :math:`\text{len(self)}`."""
438438
return self._array_obj.__len__()
439439

440440
def __lshift__(self, other):
441-
"""Return :math:`self<<value`."""
441+
r"""Return :math:`\text{self << value}`."""
442442
return dpnp.left_shift(self, other)
443443

444444
def __lt__(self, other):
445-
"""Return :math:`self<value`."""
445+
r"""Return :math:`\text{self < value}`."""
446446
return dpnp.less(self, other)
447447

448448
def __matmul__(self, other):
449-
"""Return :math:`self@value`."""
449+
r"""Return :math:`\text{self @ value}`."""
450450
return dpnp.matmul(self, other)
451451

452452
def __mod__(self, other):
453-
"""Return :math:`self%value`."""
453+
r"""Return :math:`\text{self % value}`."""
454454
return dpnp.remainder(self, other)
455455

456456
def __mul__(self, other):
457-
"""Return :math:`self*value`."""
457+
r"""Return :math:`\text{self * value}`."""
458458
return dpnp.multiply(self, other)
459459

460460
def __ne__(self, other):
461-
"""Return :math:`self!=value`."""
461+
r"""Return :math:`\text{self != value}`."""
462462
return dpnp.not_equal(self, other)
463463

464464
def __neg__(self):
465-
"""Return :math:`-self`."""
465+
r"""Return :math:`\text{-self}`."""
466466
return dpnp.negative(self)
467467

468468
# '__new__',
469469

470470
def __or__(self, other):
471-
"""Return :math:`self|value`."""
471+
r"""Return :math:`\text{self | value}`."""
472472
return dpnp.bitwise_or(self, other)
473473

474474
def __pos__(self):
475-
"""Return :math:`+self`."""
475+
r"""Return :math:`\text{+self}`."""
476476
return dpnp.positive(self)
477477

478478
def __pow__(self, other):
479-
"""Return :math:`self**value`."""
479+
r"""Return :math:`\text{self ** value}`."""
480480
return dpnp.power(self, other)
481481

482482
def __radd__(self, other):
483-
"""Return :math:`value+self`."""
483+
r"""Return :math:`\text{value + self}`."""
484484
return dpnp.add(other, self)
485485

486486
def __rand__(self, other):
487-
"""Return :math:`value&self`."""
487+
r"""Return :math:`\text{value & self}`."""
488488
return dpnp.bitwise_and(other, self)
489489

490490
# '__rdivmod__',
491491
# '__reduce__',
492492
# '__reduce_ex__',
493493

494494
def __repr__(self):
495-
"""Return :math:`repr(self)`."""
495+
r"""Return :math:`\text{repr(self)}`."""
496496
return dpt.usm_ndarray_repr(self._array_obj, prefix="array")
497497

498498
def __rfloordiv__(self, other):
499-
"""Return :math:`value//self`."""
499+
r"""Return :math:`\text{value // self}`."""
500500
return dpnp.floor_divide(self, other)
501501

502502
def __rlshift__(self, other):
503-
"""Return :math:`value<<self`."""
503+
r"""Return :math:`\text{value << self}`."""
504504
return dpnp.left_shift(other, self)
505505

506506
def __rmatmul__(self, other):
507-
"""Return :math:`value@self`."""
507+
r"""Return :math:`\text{value @ self}`."""
508508
return dpnp.matmul(other, self)
509509

510510
def __rmod__(self, other):
511-
"""Return :math:`value%self`."""
511+
r"""Return :math:`\text{value % self}`."""
512512
return dpnp.remainder(other, self)
513513

514514
def __rmul__(self, other):
515-
"""Return :math:`value*self`."""
515+
r"""Return :math:`\text{value * self}`."""
516516
return dpnp.multiply(other, self)
517517

518518
def __ror__(self, other):
519-
"""Return :math:`value|self`."""
519+
r"""Return :math:`\text{value | self}`."""
520520
return dpnp.bitwise_or(other, self)
521521

522522
def __rpow__(self, other):
523-
"""Return :math:`value**self`."""
523+
r"""Return :math:`\text{value ** self}`."""
524524
return dpnp.power(other, self)
525525

526526
def __rrshift__(self, other):
527-
"""Return :math:`value>>self`."""
527+
r"""Return :math:`\text{value >> self}`."""
528528
return dpnp.right_shift(other, self)
529529

530530
def __rshift__(self, other):
531-
"""Return :math:`self>>value`."""
531+
r"""Return :math:`\text{self >> value}`."""
532532
return dpnp.right_shift(self, other)
533533

534534
def __rsub__(self, other):
535-
"""Return :math:`value-self`."""
535+
r"""Return :math:`\text{value - self}`."""
536536
return dpnp.subtract(other, self)
537537

538538
def __rtruediv__(self, other):
539-
"""Return :math:`value/self`."""
539+
r"""Return :math:`\text{value / self}`."""
540540
return dpnp.true_divide(other, self)
541541

542542
def __rxor__(self, other):
543-
"""Return :math:`value^self`."""
543+
r"""Return :math:`\text{value ^ self}`."""
544544
return dpnp.bitwise_xor(other, self)
545545

546546
# '__setattr__',
547547

548548
def __setitem__(self, key, val):
549-
"""Set :math:`self[key]` to a value."""
549+
r"""Set :math:`\text{self[key]}` to a value."""
550550
key = _get_unwrapped_index_key(key)
551551

552552
if isinstance(val, dpnp_array):
@@ -560,11 +560,11 @@ def __setitem__(self, key, val):
560560
__slots__ = ("_array_obj",)
561561

562562
def __str__(self):
563-
"""Return :math:`str(self)`."""
563+
r"""Return :math:`\text{str(self)}`."""
564564
return self._array_obj.__str__()
565565

566566
def __sub__(self, other):
567-
"""Return :math:`self-value`."""
567+
r"""Return :math:`\text{self - value}`."""
568568
return dpnp.subtract(self, other)
569569

570570
# '__subclasshook__',
@@ -578,7 +578,7 @@ def __sycl_usm_array_interface__(self):
578578
return self._array_obj.__sycl_usm_array_interface__
579579

580580
def __truediv__(self, other):
581-
"""Return :math:`self/value`."""
581+
r"""Return :math:`\text{self / value}`."""
582582
return dpnp.true_divide(self, other)
583583

584584
@property
@@ -601,7 +601,7 @@ def __usm_ndarray__(self):
601601
return self._array_obj
602602

603603
def __xor__(self, other):
604-
"""Return :math:`self^value`."""
604+
r"""Return :math:`\text{self ^ value}`."""
605605
return dpnp.bitwise_xor(self, other)
606606

607607
@staticmethod

0 commit comments

Comments
 (0)