NUMPY_API * * This function populates the first ndim elements * of strideperm with sorted descending by their absolute values. * For example, the stride array (4, -2, 12) becomes * [(2, 12), (0, 4), (1, -2)]. */
| 771 | * [(2, 12), (0, 4), (1, -2)]. |
| 772 | */ |
| 773 | NPY_NO_EXPORT void |
| 774 | PyArray_CreateSortedStridePerm(int ndim, npy_intp const *strides, |
| 775 | npy_stride_sort_item *out_strideperm) |
| 776 | { |
| 777 | int i; |
| 778 | |
| 779 | /* Set up the strideperm values */ |
| 780 | for (i = 0; i < ndim; ++i) { |
| 781 | out_strideperm[i].perm = i; |
| 782 | out_strideperm[i].stride = strides[i]; |
| 783 | } |
| 784 | |
| 785 | /* Sort them */ |
| 786 | qsort(out_strideperm, ndim, sizeof(npy_stride_sort_item), |
| 787 | &_npy_stride_sort_item_comparator); |
| 788 | } |
| 789 | |
| 790 | static inline npy_intp |
| 791 | s_intp_abs(npy_intp x) |
no outgoing calls
no test coverage detected