MCPcopy Create free account
hub / github.com/numpy/numpy / store_pivot

Function store_pivot

numpy/core/src/npysort/selection.cpp:42–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40 */
41
42static inline void
43store_pivot(npy_intp pivot, npy_intp kth, npy_intp *pivots, npy_intp *npiv)
44{
45 if (pivots == NULL) {
46 return;
47 }
48
49 /*
50 * If pivot is the requested kth store it, overwriting other pivots if
51 * required. This must be done so iterative partition can work without
52 * manually shifting lower data offset by kth each time
53 */
54 if (pivot == kth && *npiv == NPY_MAX_PIVOT_STACK) {
55 pivots[*npiv - 1] = pivot;
56 }
57 /*
58 * we only need pivots larger than current kth, larger pivots are not
59 * useful as partitions on smaller kth would reorder the stored pivots
60 */
61 else if (pivot >= kth && *npiv < NPY_MAX_PIVOT_STACK) {
62 pivots[*npiv] = pivot;
63 (*npiv) += 1;
64 }
65}
66
67template <typename type, bool arg>
68struct Sortee {

Callers 1

introselect_Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected