ENH, API: New sorting slots for DType API by MaanasArora · Pull Request #29737 · numpy/numpy · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
f4627e7
ENH, API: New sorting slots for DType API
MaanasArora Sep 10, 2025
01c6545
DOC: Add sorting context structures and functions to DType API docume…
MaanasArora Sep 11, 2025
c613e37
DOC: Fix type signature syntax
MaanasArora Sep 11, 2025
7035208
DOC: Update data pointer type in sorting function signatures
MaanasArora Sep 11, 2025
a0393aa
DOC: Fix incorrect argsort function name
MaanasArora Sep 11, 2025
8996d3d
DOC: Fix formatting of function signature for PyArray_SortFuncWithCon…
MaanasArora Sep 11, 2025
50d3604
ENH: Initialize moving to an arraymethod table for user dtype sorts
MaanasArora Sep 22, 2025
9a421f3
ENH: Initialize PyArrayMethod_Context to zero in sorting functions
MaanasArora Sep 22, 2025
7d55810
ENH: Add stable sort option to context in user sorts
MaanasArora Sep 22, 2025
32191f2
DOC: Remove deprecated references from DType API sorting documentation
MaanasArora Sep 22, 2025
1d7cea9
ENH: Refactor sorting parameters to use NPY_SORTKIND in PyArrayMethod…
MaanasArora Sep 22, 2025
d549d81
ENH: Remove unnecessary blank line in NPY_DType_Slots structure
MaanasArora Sep 22, 2025
e8e258e
ENH: Simplify axis check in PyArray_ArgSort
MaanasArora Sep 22, 2025
9a2b9ee
REF: Simplify PyArray_(Arg)Sort loop discovery logic
MaanasArora Sep 22, 2025
ff29e9a
BUG: Add missing breaks in loop discovery in sorts
MaanasArora Sep 22, 2025
7dd98d5
BUG: Simplify context initialization in PyArray_Sort and PyArray_ArgSort
MaanasArora Sep 22, 2025
bb46a1c
BUG: Fix dangling pointer to context in PyArray_(Arg)Sort
MaanasArora Sep 22, 2025
3988f08
BUG: Fix dangling context pointer in PyArray_(Arg)Sort
MaanasArora Sep 22, 2025
c20c4bb
REF: Update sorting implementation to use new generalized array metho…
MaanasArora Sep 23, 2025
43965c4
ENH: Use dtype slots for sort and argsort arraymethods
MaanasArora Sep 23, 2025
b22d4c4
STYLE: Add back blank line in methods.h
MaanasArora Sep 23, 2025
86adfd6
REF: Simplify conditional logic in PyArray_Sort and PyArray_ArgSort
MaanasArora Sep 23, 2025
5d888d8
BUG: Add error handling for strided loop retrieval in PyArray_(Arg)Sort
MaanasArora Sep 23, 2025
c8c9845
ENH: Fill out context and strides in sort strided loop calls
MaanasArora Sep 23, 2025
566ddf1
ENH: Add correct number of descriptors and strides in sorting loops
MaanasArora Sep 23, 2025
36c59b7
BUG: Correct descriptors and strides in argsort implementation
MaanasArora Sep 23, 2025
5265524
ENH: If-case parameters field in PyArrayMethod_Context
MaanasArora Sep 24, 2025
4ad0b14
REF: Initialize PyArrayMethod_Context structure directly for sorting …
MaanasArora Sep 24, 2025
adb8292
ENH: Pass auxdata to dtype sorts
MaanasArora Sep 24, 2025
3a0c3c9
ENH: Update stride calculation for sorting to use item size
MaanasArora Sep 24, 2025
9eba6dc
ENH: Refactor context initialization and descriptor resolution in sor…
MaanasArora Sep 24, 2025
18e5a3d
ENH: Implement sorting and argsorting methods for scaled float dtype
MaanasArora Sep 24, 2025
433d203
DOC: Add comment to clarify that we ignore `view_offset`
MaanasArora Sep 24, 2025
9b4f202
ENH: Free auxdata and decref descriptors in sorting functions
MaanasArora Sep 24, 2025
9da1a1c
DOC: Add comments to clarify that method flags are ignored in sorting…
MaanasArora Sep 24, 2025
1d4699d
ENH: Add scaled float tests for sorting and argsorting with scaled an…
MaanasArora Sep 24, 2025
eab3bac
TST: Update scaled float argsort test to stride array
MaanasArora Sep 24, 2025
9f1ae16
STYLE: Fix formatting in sfloat test_sort
MaanasArora Sep 24, 2025
2cb4e5f
BUG: Update sorting functions to check for sort method in cleanup ins…
MaanasArora Sep 24, 2025
f67f5b3
REF: Fix scope for sort contexts
MaanasArora Sep 24, 2025
52ff04b
REF: Initialize sorting context only if taken
MaanasArora Sep 24, 2025
255fe0f
DOC: Add parameters member to PyArrayMethod_Context for loop paramete…
MaanasArora Sep 24, 2025
2153628
BUG: Move declaration of loop_descrs array in PyArray_ArgSort
MaanasArora Sep 25, 2025
4a0f769
DOC: Add comment clarifying arraymethod context parameters
MaanasArora Sep 25, 2025
6954cf9
DOC: Clarify description of parameters member in PyArrayMethod_Context
MaanasArora Sep 25, 2025
a2dfdef
REF: Use existing variable to simplify NPY_DTYPE macro
MaanasArora Sep 25, 2025
ce793cc
BUG: Add missing output decref in PyArray_ArgSort
MaanasArora Sep 25, 2025
7e767e5
BUG: Add assertions to validate parameters in sorting functions of sc…
MaanasArora Sep 25, 2025
f3c1e04
REF: Simplify argument passing by removing unnecessary dimensions and…
MaanasArora Sep 25, 2025
e0f923d
BUG: Fix castinfo changes
MaanasArora Sep 25, 2025
1eee5a4
TST: assert exact stride values in sfloat sorts
MaanasArora Sep 25, 2025
5a66e6e
TST: assert exact stride values in sfloat sorts
MaanasArora Sep 25, 2025
7f11d40
DOC: move versionchanged in ArrayMethod_Context
MaanasArora Sep 25, 2025
01a9515
BUG: Fix stride initialization in _new_sortlike and ensure proper dec…
MaanasArora Sep 25, 2025
912fdbd
BUG: Correct dimension and stride initializations in sorting
MaanasArora Sep 25, 2025
a87a0c2
BUG: Fix strides initialization in sorting
MaanasArora Sep 25, 2025
56bf123
DOC: clarify function level in parameters for PyArrayMethod_Context
MaanasArora Sep 25, 2025
c94e02f
REF: initialize slots in-line for sfloat sorts
MaanasArora Sep 25, 2025
3a2cbcc
BUG: Remove incorrect dimension assertions in sorting loops
MaanasArora Sep 25, 2025
ee17e43
BUG: Correct size to sizeof
MaanasArora Sep 25, 2025
477c705
STYLE: revert newline deletion
MaanasArora Sep 25, 2025
7b9a2bc
STYLE: remove trailing whitespace
MaanasArora Sep 25, 2025
2ea19e7
STYLE: revert delete newline
MaanasArora Sep 25, 2025
e3a8bba
BUG: Fix incorrect stride assignment in _new_sortlike function
MaanasArora Sep 25, 2025
2b5c383
STYLE: Remove unnecessary whitespace
MaanasArora Sep 25, 2025
d23025f
DOC: Improve comment
MaanasArora Sep 25, 2025
179c617
REF: Remove first branch in resolve_descriptors for sfloat sorts
MaanasArora Sep 26, 2025
abf4358
TST: Add reverse sorting test for non-aligned arrays in sfloat sort t…
MaanasArora Sep 26, 2025
d8f8b51
DOC: Add TODO comments for future registration method in sfloat_init_…
MaanasArora Sep 26, 2025
64ca9e2
ENH: Perform descriptor handling in sorting array method for byte order
MaanasArora Sep 26, 2025
c93e39b
DOC: Remove redundant versionchanged note in types-and-structures.rst
MaanasArora Sep 26, 2025
1fe943d
TST: Add stable and unstable sorting tests for sfloat arrays
MaanasArora Sep 26, 2025
7be1c22
ENH: Update stride assertions in sfloat_default_sort_loop for improve…
MaanasArora Sep 26, 2025
cb285e9
ENH: Add stride assertions in sfloat_default_argsort_loop for improve…
MaanasArora Sep 26, 2025
adb0fc8
ENH: Change descriptor handling in sfloat_sort_resolve_descriptors an…
MaanasArora Sep 27, 2025
8fe7207
ENH: Manage reference counting for argsort method in sfloat_init_sort…
MaanasArora Sep 27, 2025
f0ad94c
ENH: Add assertion in sfloat_sort_resolve_descriptors to validate des…
MaanasArora Sep 27, 2025
98e13cd
ENH: Add assertion in sfloat_argsort_resolve_descriptors to validate …
MaanasArora Sep 27, 2025
93abb18
ENH: Move error handling to sfloat_sort_get_loop and sfloat_argsort_g…
MaanasArora Sep 27, 2025
dd4e914
ENH: Manage reference counting for sort method in sfloat_init_sort to…
MaanasArora Sep 27, 2025
b6e3085
REF: Clarify stride calculation in PyArray_Sort and PyArray_ArgSort
MaanasArora Sep 27, 2025
5c6a76a
ENH: Add method flag handling in sorting methods to check for GIL
MaanasArora Sep 30, 2025
b222adf
REF: Simplify descr element size retrieval in PyArray_Sort and PyArra…
MaanasArora Sep 30, 2025
6c59c73
BUG: Replace NULL return with goto fail in PyArray_ArgSort for error …
MaanasArora Sep 30, 2025
a8e95e6
REF: Assert instead of handling non-native byteorder in sfloat sorts
MaanasArora Sep 30, 2025
e8e9abf
BUG: Initialize return value to NULL in PyArray_ArgSort for error han…
MaanasArora Sep 30, 2025
f7029b3
REF: Remove descr-specific thread release in favor of pyapi flag in s…
MaanasArora Sep 30, 2025
1a78671
BUG: Fix needcopy logic in _new_sortlike and _new_argsortlike functions
MaanasArora Oct 1, 2025
9671d42
BUG: Remove unnecessary NULL check for odescr in PyArray_ArgSort
MaanasArora Oct 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/source/reference/c-api/types-and-structures.rst
11 changes: 11 additions & 0 deletions numpy/_core/include/numpy/dtype_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ typedef struct PyArrayMethod_Context_tag {
* NPY_ARRAYMETHOD_CONTEXT_FLAGS
*/
uint64_t flags;

Comment thread
mhvk marked this conversation as resolved.
/*
* Optional run-time parameters to pass to the loop (currently used in sorting).
* Fixed parameters are expected to be passed via auxdata.
*/
void *parameters;

/* Structure may grow (this is harmless for DType authors) */
#endif
} PyArrayMethod_Context;
Expand Down Expand Up @@ -489,4 +496,8 @@ typedef PyArray_Descr *(PyArrayDTypeMeta_FinalizeDescriptor)(PyArray_Descr *dtyp
typedef int(PyArrayDTypeMeta_SetItem)(PyArray_Descr *, PyObject *, char *);
typedef PyObject *(PyArrayDTypeMeta_GetItem)(PyArray_Descr *, char *);

typedef struct {
Comment thread
mhvk marked this conversation as resolved.
NPY_SORTKIND flags;
} PyArrayMethod_SortParameters;

#endif /* NUMPY_CORE_INCLUDE_NUMPY___DTYPE_API_H_ */
6 changes: 6 additions & 0 deletions numpy/_core/src/multiarray/dtypemeta.h
Loading
Loading