Skip to content

Fix argselect const-correct#230

Merged
r-devulap merged 1 commit intonumpy:mainfrom
AnkitAhlawat7742:fix/argselect-const
Feb 23, 2026
Merged

Fix argselect const-correct#230
r-devulap merged 1 commit intonumpy:mainfrom
AnkitAhlawat7742:fix/argselect-const

Conversation

@AnkitAhlawat7742
Copy link
Contributor

@AnkitAhlawat7742 AnkitAhlawat7742 commented Feb 18, 2026

Fix: Make argselect const-correct

Summary

Similar to argsort, argselect only reads from the input array—it computes index order based on element values without modifying the array itself. Updating argselect to accept a const T* improves API clarity and prevents accidental modification of input data.

For more details about argsort we can refer issue :- #223

Changes

Updated argselect function signatures to accept const T* instead of T*.

CC @r-devulap

@AnkitAhlawat7742
Copy link
Contributor Author

@r-devulap ,Please trigger the CI CD pipeline

@AnkitAhlawat7742
Copy link
Contributor Author

Hi @r-devulap ,
Following up on the CI/CD trigger for this PR. Could you please run the pipeline so we can proceed with validation?
Thanks...!!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes the argselect function const-correct by accepting const T* for the input array parameter, similar to the earlier fix for argsort (issue #223). Since argselect only reads from the input array to compute index ordering without modifying it, this change improves API clarity and type safety.

Changes:

  • Updated all argselect function signatures to accept const T* instead of T* for the input array parameter
  • Applied the established const_cast pattern in wrapper functions with explanatory comments
  • Updated documentation in both README files to reflect the new const-correct signatures

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/xss-common-argsort.h Added const_cast with safety comments in avx512_argselect and avx2_argselect wrapper functions
src/x86simdsort-static-incl.h Updated both argselect API signatures to accept const T*
lib/x86simdsort.h Updated public API signature to const T*
lib/x86simdsort.cpp Updated internal function pointer and template instantiation signatures
lib/x86simdsort-skx.cpp Updated AVX512 specialization signature
lib/x86simdsort-avx2.cpp Updated AVX2 specialization signature
lib/x86simdsort-scalar.h Updated scalar fallback implementation signature
lib/x86simdsort-internal.h Updated internal API declaration
README.md Updated documentation example with const-correct signature
src/README.md Updated API documentation with const-correct signature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@r-devulap r-devulap left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @AnkitAhlawat7742

@r-devulap r-devulap merged commit f4a87c8 into numpy:main Feb 23, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants