@@ -76,15 +76,18 @@ def argmax(a, axis=None, out=None, *, keepdims=False):
76
76
axis : {None, int}, optional
77
77
By default, the index is into the flattened array, otherwise along
78
78
the specified axis.
79
+
79
80
Default: ``None``.
80
81
out : {None, dpnp.ndarray, usm_ndarray}, optional
81
82
If provided, the result will be inserted into this array. It should be
82
83
of the appropriate shape and dtype.
84
+
83
85
Default: ``None``.
84
86
keepdims : {None, bool}, optional
85
87
If this is set to ``True``, the axes which are reduced are left in the
86
88
result as dimensions with size one. With this option, the result will
87
89
broadcast correctly against the array.
90
+
88
91
Default: ``False``.
89
92
90
93
Returns
@@ -165,15 +168,18 @@ def argmin(a, axis=None, out=None, *, keepdims=False):
165
168
axis : {None, int}, optional
166
169
By default, the index is into the flattened array, otherwise along
167
170
the specified axis.
171
+
168
172
Default: ``None``.
169
173
out : {None, dpnp.ndarray, usm_ndarray}, optional
170
174
If provided, the result will be inserted into this array. It should be
171
175
of the appropriate shape and dtype.
176
+
172
177
Default: ``None``.
173
178
keepdims : {None, bool}, optional
174
179
If this is set to ``True``, the axes which are reduced are left in the
175
180
result as dimensions with size one. With this option, the result will
176
181
broadcast correctly against the array.
182
+
177
183
Default: ``False``.
178
184
179
185
Returns
@@ -315,13 +321,15 @@ def searchsorted(a, v, side="left", sorter=None):
315
321
side : {"left", "right"}, optional
316
322
If ``"left"``, the index of the first suitable location found is given.
317
323
If ``"right"``, return the last such index. If there is no suitable
318
- index, return either 0 or N (where N is the length of `a`).
324
+ index, return either ``0`` or ``N`` (where ``N`` is the length of `a`).
325
+
319
326
Default: ``"left"``.
320
- sorter : {dpnp.ndarray, usm_ndarray}, optional
321
- Optional 1-D array of integer indices that sort array a into ascending
322
- order. They are typically the result of :obj :`dpnp.argsort`.
327
+ sorter : {None, dpnp.ndarray, usm_ndarray}, optional
328
+ Optional 1-D array of integer indices that sort array `a` into ascending
329
+ order. They are typically the result of :py:func :`dpnp.argsort`.
323
330
Out of bound index values of `sorter` array are treated using
324
331
``"wrap"`` mode documented in :py:func:`dpnp.take`.
332
+
325
333
Default: ``None``.
326
334
327
335
Returns
@@ -338,7 +346,7 @@ def searchsorted(a, v, side="left", sorter=None):
338
346
Examples
339
347
--------
340
348
>>> import dpnp as np
341
- >>> a = np.array([11,12,13,14,15])
349
+ >>> a = np.array([11, 12, 13, 14, 15])
342
350
>>> np.searchsorted(a, 13)
343
351
array(2)
344
352
>>> np.searchsorted(a, 13, side='right')
@@ -347,6 +355,19 @@ def searchsorted(a, v, side="left", sorter=None):
347
355
>>> np.searchsorted(a, v)
348
356
array([0, 5, 1, 2])
349
357
358
+ When `sorter` is used, the returned indices refer to the sorted
359
+ array of `a` and not `a` itself:
360
+
361
+ >>> a = np.array([40, 10, 20, 30])
362
+ >>> sorter = np.argsort(a)
363
+ >>> sorter
364
+ array([1, 2, 3, 0]) # Indices that would sort the array 'a'
365
+ >>> result = np.searchsorted(a, 25, sorter=sorter)
366
+ >>> result
367
+ array(2)
368
+ >>> a[sorter[result]]
369
+ array(30) # The element at index 2 of the sorted array is 30
370
+
350
371
"""
351
372
352
373
usm_a = dpnp .get_usm_ndarray (a )
@@ -374,16 +395,20 @@ def where(condition, x=None, y=None, /, *, order="K", out=None):
374
395
----------
375
396
condition : {dpnp.ndarray, usm_ndarray}
376
397
When ``True``, yield `x`, otherwise yield `y`.
377
- x, y : {dpnp.ndarray, usm_ndarray, scalar}, optional
398
+ x, y : {None, dpnp.ndarray, usm_ndarray, scalar}, optional
378
399
Values from which to choose. `x`, `y` and `condition` need to be
379
400
broadcastable to some shape.
401
+
402
+ Default: ``None``.
380
403
order : {"K", "C", "F", "A"}, optional
381
404
Memory layout of the new output array, if keyword `out` is ``None``.
405
+
382
406
Default: ``"K"``.
383
407
out : {None, dpnp.ndarray, usm_ndarray}, optional
384
408
The array into which the result is written. The data type of `out` must
385
409
match the expected shape and the expected data type of the result.
386
410
If ``None`` then a new array is returned.
411
+
387
412
Default: ``None``.
388
413
389
414
Returns
0 commit comments