Skip to content

Commit c53da6c

Browse files
committed
Stated explicit wrapping behavior of out of bound values of sorter per dpctl spec
1 parent 0b66dce commit c53da6c

File tree

2 files changed

+4
-23
lines changed

2 files changed

+4
-23
lines changed

dpnp/dpnp_iface_searching.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,13 @@ def searchsorted(a, v, side="left", sorter=None):
244244
If ``'left'``, the index of the first suitable location found is given.
245245
If ``'right'``, return the last such index. If there is no suitable
246246
index, return either 0 or N (where N is the length of `a`).
247+
Default is ``'left'``.
247248
sorter : {dpnp.ndarray, usm_ndarray}, optional
248249
Optional 1-D array of integer indices that sort array a into ascending
249250
order. They are typically the result of argsort.
251+
Out of bound index values of `sorter` array are treated using `"wrap"`
252+
mode documented in :py:func:`dpnp.take`.
253+
Default is ``None``.
250254
251255
Returns
252256
-------

tests/test_sort.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -245,29 +245,6 @@ def test_invalid_sorter(self):
245245
sorter=xp.array([1, 2, 3, 4, 5, 6]),
246246
)
247247

248-
# # bounds check
249-
assert_raises(
250-
ValueError,
251-
xp.searchsorted,
252-
a,
253-
4,
254-
sorter=xp.array([0, 1, 2, 3, 5]),
255-
)
256-
assert_raises(
257-
ValueError,
258-
xp.searchsorted,
259-
a,
260-
0,
261-
sorter=xp.array([-1, 0, 1, 2, 3]),
262-
)
263-
assert_raises(
264-
ValueError,
265-
xp.searchsorted,
266-
a,
267-
0,
268-
sorter=xp.array([4, 0, -1, 2, 3]),
269-
)
270-
271248
def test_v_scalar(self):
272249
v = 0
273250
a = numpy.array([-8, -5, -1, 3, 6, 10])

0 commit comments

Comments
 (0)