Skip to content

Commit 0d295f8

Browse files
committed
Use \text command in math
1 parent c5624b7 commit 0d295f8

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__',
@@ -288,27 +288,27 @@ def __dlpack_device__(self):
288288
# '__doc__',
289289

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

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

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

302302
# '__format__',
303303

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

308308
# '__getattribute__',
309309

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

314314
item = self._array_obj.__getitem__(key)
@@ -317,33 +317,33 @@ def __getitem__(self, key):
317317
# '__getstate__',
318318

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

323323
# '__hash__',
324324

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

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

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

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

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

348348
# Unlike `matmul(a, b, out=a)` we ensure that the result isn't broadcast
349349
# if the result without `out` would have less dimensions than `a`.
@@ -367,12 +367,12 @@ def __imatmul__(self, other):
367367
return self
368368

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

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

@@ -388,163 +388,163 @@ def __int__(self):
388388
return self._array_obj.__int__()
389389

390390
def __invert__(self):
391-
"""Return :math:`~self`."""
391+
r"""Return :math:`\text{~self}`."""
392392
return dpnp.invert(self)
393393

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

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

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

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

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

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

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

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

434434
def __len__(self):
435-
"""Return :math:`len(self)`."""
435+
r"""Return :math:`\text{len(self)}`."""
436436
return self._array_obj.__len__()
437437

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

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

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

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

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

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

462462
def __neg__(self):
463-
"""Return :math:`-self`."""
463+
r"""Return :math:`\text{-self}`."""
464464
return dpnp.negative(self)
465465

466466
# '__new__',
467467

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

472472
def __pos__(self):
473-
"""Return :math:`+self`."""
473+
r"""Return :math:`\text{+self}`."""
474474
return dpnp.positive(self)
475475

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

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

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

488488
# '__rdivmod__',
489489
# '__reduce__',
490490
# '__reduce_ex__',
491491

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

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

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

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

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

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

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

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

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

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

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

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

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

544544
# '__setattr__',
545545

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

550550
if isinstance(val, dpnp_array):
@@ -558,11 +558,11 @@ def __setitem__(self, key, val):
558558
__slots__ = ("_array_obj",)
559559

560560
def __str__(self):
561-
"""Return :math:`str(self)`."""
561+
r"""Return :math:`\text{str(self)}`."""
562562
return self._array_obj.__str__()
563563

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

568568
# '__subclasshook__',
@@ -576,7 +576,7 @@ def __sycl_usm_array_interface__(self):
576576
return self._array_obj.__sycl_usm_array_interface__
577577

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

582582
@property
@@ -599,7 +599,7 @@ def __usm_ndarray__(self):
599599
return self._array_obj
600600

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

605605
@staticmethod

0 commit comments

Comments
 (0)