10000 Add `searchsorted` to the specification by kgryte · Pull Request #699 · data-apis/array-api · GitHub
[go: up one dir, main page]

Skip to content

Add searchsorted to the specification #699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 11, 2024
Prev Previous commit
Next Next commit
fix: correct the required sorter shape and clarify edge cases
  • Loading branch information
kgryte committed Nov 6, 2023
commit 7a217c81485078346b037414cc356c0a896f74e4
4 changes: 2 additions & 2 deletions src/array_api_stubs/_draft/searching_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ def searchsorted(
x2: array
array containing search values.
side: Literal['left', 'right']
if ``'left'``, then each returned index ``i`` must satisfy ``x1[i-1] < v[j] <= x1[i]``; otherwise, if ``'right'``, the each returned index ``i`` must satisfy ``x1[i-1] <= v[j] < x1[i]``. Default: ``'left'``.
if ``'left'``, then each returned index ``i`` must satisfy ``x1[i-1] < x2[j] <= x1[i]``, and, if, for an element ``x2[j]``, no index satisfies the index condition, then the returned index for that element must be ``0``. Otherwise, if ``'right'``, then each returned index ``i`` must satisfy ``x1[i-1] <= x2[j] < x1[i]``, and, if, for an element ``x2[j]``, no index satisfies the index condition, then the returned index for that element must be ``N``, where ``N`` is the number of elements in ``x1``. Default: ``'left'``.
sorter: Optional[array]
array of indices that sort ``x1`` in ascending order. The array must be one-dimensional and have an integer data type. Default: ``None``.
array of indices that sort ``x1`` in ascending order. The array must have the same shape as ``x1`` and have an integer data type. Default: ``None``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we only require this to be the default array index type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would that be necessary?


Returns
-------
Expand Down
0