"Fossies" - the Fresh Open Source Software Archive

Member "numpy-1.16.4/numpy/core/src/common/npy_sort.h.src" (27 May 2019, 2609 Bytes) of package /linux/misc/numpy-1.16.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #ifndef __NPY_SORT_H__
    2 #define __NPY_SORT_H__
    3 
    4 /* Python include is for future object sorts */
    5 #include <Python.h>
    6 #include <numpy/npy_common.h>
    7 #include <numpy/ndarraytypes.h>
    8 
    9 #define NPY_ENOMEM 1
   10 #define NPY_ECOMP 2
   11 
   12 static NPY_INLINE int npy_get_msb(npy_uintp unum)
   13 {
   14     int depth_limit = 0;
   15     while (unum >>= 1)  {
   16         depth_limit++;
   17     }
   18     return depth_limit;
   19 }
   20 
   21 
   22 /*
   23  *****************************************************************************
   24  **                            NUMERIC SORTS                                **
   25  *****************************************************************************
   26  */
   27 
   28 
   29 /**begin repeat
   30  *
   31  * #suff = bool, byte, ubyte, short, ushort, int, uint, long, ulong,
   32  *         longlong, ulonglong, half, float, double, longdouble,
   33  *         cfloat, cdouble, clongdouble, datetime, timedelta#
   34  */
   35 
   36 int quicksort_@suff@(void *vec, npy_intp cnt, void *null);
   37 int heapsort_@suff@(void *vec, npy_intp cnt, void *null);
   38 int mergesort_@suff@(void *vec, npy_intp cnt, void *null);
   39 int aquicksort_@suff@(void *vec, npy_intp *ind, npy_intp cnt, void *null);
   40 int aheapsort_@suff@(void *vec, npy_intp *ind, npy_intp cnt, void *null);
   41 int amergesort_@suff@(void *vec, npy_intp *ind, npy_intp cnt, void *null);
   42 
   43 /**end repeat**/
   44 
   45 
   46 
   47 /*
   48  *****************************************************************************
   49  **                             STRING SORTS                                **
   50  *****************************************************************************
   51  */
   52 
   53 
   54 /**begin repeat
   55  *
   56  * #suff = string, unicode#
   57  */
   58 
   59 int quicksort_@suff@(void *vec, npy_intp cnt, void *arr);
   60 int heapsort_@suff@(void *vec, npy_intp cnt, void *arr);
   61 int mergesort_@suff@(void *vec, npy_intp cnt, void *arr);
   62 int aquicksort_@suff@(void *vec, npy_intp *ind, npy_intp cnt, void *arr);
   63 int aheapsort_@suff@(void *vec, npy_intp *ind, npy_intp cnt, void *arr);
   64 int amergesort_@suff@(void *vec, npy_intp *ind, npy_intp cnt, void *arr);
   65 
   66 /**end repeat**/
   67 
   68 
   69 /*
   70  *****************************************************************************
   71  **                             GENERIC SORT                                **
   72  *****************************************************************************
   73  */
   74 
   75 
   76 int npy_quicksort(void *vec, npy_intp cnt, void *arr);
   77 int npy_heapsort(void *vec, npy_intp cnt, void *arr);
   78 int npy_mergesort(void *vec, npy_intp cnt, void *arr);
   79 int npy_aquicksort(void *vec, npy_intp *ind, npy_intp cnt, void *arr);
   80 int npy_aheapsort(void *vec, npy_intp *ind, npy_intp cnt, void *arr);
   81 int npy_amergesort(void *vec, npy_intp *ind, npy_intp cnt, void *arr);
   82 
   83 #endif