Skip to content

Commit 1e8c02e

Browse files
antonwolfyvtavana
andauthored
Reslve formatting issue in documentation of dpnp.ravel_multi_index and dpnp.unravel_index (#2053)
Co-authored-by: vtavana <[email protected]>
1 parent 8cab1af commit 1e8c02e

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

dpnp/dpnp_iface_indexing.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,15 +1471,17 @@ def ravel_multi_index(multi_index, dims, mode="raise", order="C"):
14711471
multi_index : tuple of {dpnp.ndarray, usm_ndarray}
14721472
A tuple of integer arrays, one array for each dimension.
14731473
dims : tuple or list of ints
1474-
The shape of array into which the indices from ``multi_index`` apply.
1474+
The shape of array into which the indices from `multi_index` apply.
14751475
mode : {"raise", "wrap" or "clip'}, optional
14761476
Specifies how out-of-bounds indices are handled. Can specify either
14771477
one mode or a tuple of modes, one mode per index:
1478-
- "raise" -- raise an error
1479-
- "wrap" -- wrap around
1480-
- "clip" -- clip to the range
1481-
In "clip" mode, a negative index which would normally wrap will
1482-
clip to 0 instead.
1478+
1479+
- "raise" -- raise an error
1480+
- "wrap" -- wrap around
1481+
- "clip" -- clip to the range
1482+
1483+
In ``"clip"`` mode, a negative index which would normally wrap will
1484+
clip to 0 instead.
14831485
Default: ``"raise"``.
14841486
order : {None, "C", "F"}, optional
14851487
Determines whether the multi-index should be viewed as indexing in
@@ -1490,7 +1492,7 @@ def ravel_multi_index(multi_index, dims, mode="raise", order="C"):
14901492
-------
14911493
raveled_indices : dpnp.ndarray
14921494
An array of indices into the flattened version of an array of
1493-
dimensions ``dims``.
1495+
dimensions `dims`.
14941496
14951497
See Also
14961498
--------
@@ -1509,6 +1511,7 @@ def ravel_multi_index(multi_index, dims, mode="raise", order="C"):
15091511
array([22, 23, 19])
15101512
>>> np.ravel_multi_index(arr, (4, 4), mode=("clip", "wrap"))
15111513
array([12, 13, 13])
1514+
15121515
>>> arr = np.array([3, 1, 4, 1])
15131516
>>> np.ravel_multi_index(arr, (6, 7, 8, 9))
15141517
array(1621)
@@ -2316,17 +2319,18 @@ def triu_indices_from(arr, k=0):
23162319

23172320

23182321
def unravel_index(indices, shape, order="C"):
2319-
"""Converts array of flat indices into a tuple of coordinate arrays.
2322+
"""
2323+
Converts array of flat indices into a tuple of coordinate arrays.
23202324
23212325
For full documentation refer to :obj:`numpy.unravel_index`.
23222326
23232327
Parameters
23242328
----------
23252329
indices : {dpnp.ndarray, usm_ndarray}
23262330
An integer array whose elements are indices into the flattened version
2327-
of an array of dimensions ``shape``.
2331+
of an array of dimensions `shape`.
23282332
shape : tuple or list of ints
2329-
The shape of the array to use for unraveling ``indices``.
2333+
The shape of the array to use for unraveling `indices`.
23302334
order : {None, "C", "F"}, optional
23312335
Determines whether the indices should be viewed as indexing in
23322336
row-major (C-style) or column-major (Fortran-style) order.
@@ -2342,10 +2346,9 @@ def unravel_index(indices, shape, order="C"):
23422346
:obj:`dpnp.ravel_multi_index` : Converts a tuple of index arrays into an
23432347
array of flat indices.
23442348
2345-
23462349
Examples
23472350
--------
2348-
import dpnp as np
2351+
>>> import dpnp as np
23492352
>>> np.unravel_index(np.array([22, 41, 37]), (7, 6))
23502353
(array([3, 6, 6]), array([4, 5, 1]))
23512354
>>> np.unravel_index(np.array([31, 41, 13]), (7, 6), order="F")

0 commit comments

Comments
 (0)