@@ -1061,54 +1061,71 @@ def mask_indices(
10611061
10621062
10631063# pylint: disable=invalid-name
1064- ndindex = numpy .ndindex
1065- ndindex .__doc__ = """
1066- An N-dimensional iterator object to index arrays.
1067-
1068- Given the shape of an array, an `ndindex` instance iterates over the
1069- N-dimensional index of the array. At each iteration a tuple of indices is
1070- returned, the last dimension is iterated over first.
1071-
1072- For full documentation refer to :obj:`numpy.ndindex`.
1073-
1074- Parameters
1075- ----------
1076- shape : ints, or a single tuple of ints
1077- The size of each dimension of the array can be passed as individual
1078- parameters or as the elements of a tuple.
1079-
1080- See Also
1081- --------
1082- :obj:`dpnp.ndenumerate` : Multidimensional index iterator.
1083- :obj:`dpnp.flatiter` : Flat iterator object to iterate over arrays.
1084-
1085- Examples
1086- --------
1087- >>> import dpnp as np
1088-
1089- Dimensions as individual arguments
1090-
1091- >>> for index in np.ndindex(3, 2, 1):
1092- ... print(index)
1093- (0, 0, 0)
1094- (0, 1, 0)
1095- (1, 0, 0)
1096- (1, 1, 0)
1097- (2, 0, 0)
1098- (2, 1, 0)
1099-
1100- Same dimensions - but in a tuple ``(3, 2, 1)``
1101-
1102- >>> for index in np.ndindex((3, 2, 1)):
1103- ... print(index)
1104- (0, 0, 0)
1105- (0, 1, 0)
1106- (1, 0, 0)
1107- (1, 1, 0)
1108- (2, 0, 0)
1109- (2, 1, 0)
1064+ class ndindex (numpy .ndindex ):
1065+ """
1066+ An N-dimensional iterator object to index arrays.
11101067
1111- """
1068+ Given the shape of an array, an :obj:`dpnp.ndindex` instance iterates over
1069+ the N-dimensional index of the array. At each iteration a tuple of indices
1070+ is returned, the last dimension is iterated over first.
1071+
1072+ For full documentation refer to :obj:`numpy.ndindex`.
1073+
1074+ Parameters
1075+ ----------
1076+ shape : ints, or a single tuple of ints
1077+ The size of each dimension of the array can be passed as individual
1078+ parameters or as the elements of a tuple.
1079+
1080+ See Also
1081+ --------
1082+ :obj:`dpnp.ndenumerate` : Multidimensional index iterator.
1083+ :obj:`dpnp.flatiter` : Flat iterator object to iterate over arrays.
1084+
1085+ Examples
1086+ --------
1087+ >>> import dpnp as np
1088+
1089+ Dimensions as individual arguments
1090+
1091+ >>> for index in np.ndindex(3, 2, 1):
1092+ ... print(index)
1093+ (0, 0, 0)
1094+ (0, 1, 0)
1095+ (1, 0, 0)
1096+ (1, 1, 0)
1097+ (2, 0, 0)
1098+ (2, 1, 0)
1099+
1100+ Same dimensions - but in a tuple ``(3, 2, 1)``
1101+
1102+ >>> for index in np.ndindex((3, 2, 1)):
1103+ ... print(index)
1104+ (0, 0, 0)
1105+ (0, 1, 0)
1106+ (1, 0, 0)
1107+ (1, 1, 0)
1108+ (2, 0, 0)
1109+ (2, 1, 0)
1110+
1111+ """
1112+
1113+ def __init__ (self , * shape ):
1114+ super ().__init__ (shape )
1115+
1116+ def __next__ (self ):
1117+ """
1118+ Standard iterator method, updates the index and returns the index tuple.
1119+
1120+ Returns
1121+ -------
1122+ val : tuple of ints
1123+ Returns a tuple containing the indices of the current iteration.
1124+
1125+ """
1126+
1127+ # pylint: disable=useless-parent-delegation
1128+ return super ().__next__ ()
11121129
11131130
11141131def nonzero (a ):
0 commit comments