numpy  2.0.0
src/private/npy_binsearch.h.src File Reference
#include "npy_sort.h"
#include <numpy/npy_common.h>
#include <numpy/ndarraytypes.h>

Data Structures

struct  binsearch_map
struct  argbinsearch_map

Defines

#define __NPY_BINSEARCH_H__

Typedefs

typedef void( PyArray_BinSearchFunc )(const char *, const char *, char *, npy_intp, npy_intp, npy_intp, npy_intp, npy_intp, PyArrayObject *)
typedef int( PyArray_ArgBinSearchFunc )(const char *, const char *, const char *, char *, npy_intp, npy_intp, npy_intp, npy_intp, npy_intp, npy_intp, PyArrayObject *)

Functions

NPY_VISIBILITY_HIDDEN void
binsearch_ side
suff (const char *arr, const char *key, char *ret, npy_intp arr_len, npy_intp key_len, npy_intp arr_str, npy_intp key_str, npy_intp ret_str, PyArrayObject *unused)
NPY_VISIBILITY_HIDDEN int
argbinsearch_ side
suff (const char *arr, const char *key, const char *sort, char *ret, npy_intp arr_len, npy_intp key_len, npy_intp arr_str, npy_intp key_str, npy_intp sort_str, npy_intp ret_str, PyArrayObject *unused)
NPY_VISIBILITY_HIDDEN void
npy_binsearch_ 
side (const char *arr, const char *key, char *ret, npy_intp arr_len, npy_intp key_len, npy_intp arr_str, npy_intp key_str, npy_intp ret_str, PyArrayObject *cmp)
NPY_VISIBILITY_HIDDEN int
npy_argbinsearch_ 
side (const char *arr, const char *key, const char *sort, char *ret, npy_intp arr_len, npy_intp key_len, npy_intp arr_str, npy_intp key_str, npy_intp sort_str, npy_intp ret_str, PyArrayObject *cmp)
static NPY_INLINE PyArray_ Arg
BinSearchFunc *get_ arg 
binsearch_func (PyArray_Descr *dtype, NPY_SEARCHSIDE side)

Variables

static struct arg
binsearch_map _ arg 
binsearch_map []

Define Documentation


Typedef Documentation

typedef int( PyArray_ArgBinSearchFunc)(const char *, const char *, const char *, char *, npy_intp, npy_intp, npy_intp, npy_intp, npy_intp, npy_intp, PyArrayObject *)
typedef void( PyArray_BinSearchFunc)(const char *, const char *, char *, npy_intp, npy_intp, npy_intp, npy_intp, npy_intp, PyArrayObject *)

Function Documentation

static NPY_INLINE PyArray_ Arg BinSearchFunc* get_ arg binsearch_func ( PyArray_Descr dtype,
NPY_SEARCHSIDE  side 
) [static]
It seems only fair that a binary search function be searched for using a binary search...

References side().

NPY_VISIBILITY_HIDDEN void npy_binsearch_ side ( const char *  arr,
const char *  key,
char *  ret,
npy_intp  arr_len,
npy_intp  key_len,
npy_intp  arr_str,
npy_intp  key_str,
npy_intp  ret_str,
PyArrayObject cmp 
)
end repeat1*
end repeat1*
end repeat*
begin repeat <blockquote> side = left, right# #CMP = <, <=#</blockquote>
Updating only one of the indices based on the previous key gives the search a big boost when keys are sorted, but slightly slows down things for purely random ones.

Referenced by binsearch_func(), and PyArray_SelectkindConverter().

NPY_VISIBILITY_HIDDEN int npy_argbinsearch_ side ( const char *  arr,
const char *  key,
const char *  sort,
char *  ret,
npy_intp  arr_len,
npy_intp  key_len,
npy_intp  arr_str,
npy_intp  key_str,
npy_intp  sort_str,
npy_intp  ret_str,
PyArrayObject cmp 
)
Updating only one of the indices based on the previous key gives the search a big boost when keys are sorted, but slightly slows down things for purely random ones.
NPY_VISIBILITY_HIDDEN void binsearch_ side _ suff ( const char *  arr,
const char *  key,
char *  ret,
npy_intp  arr_len,
npy_intp  key_len,
npy_intp  arr_str,
npy_intp  key_str,
npy_intp  ret_str,
PyArrayObject NOT_USED 
)
begin repeat <blockquote> side = left, right#</blockquote>
begin repeat1 <blockquote>

suff = bool, byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, half, float, double, longdouble, cfloat, cdouble, clongdouble, datetime, timedelta#

</blockquote>

begin repeat1 <blockquote> side = left, right# #CMP = LT, LTE#</blockquote>
Updating only one of the indices based on the previous key gives the search a big boost when keys are sorted, but slightly slows down things for purely random ones.

References TYPE.

NPY_VISIBILITY_HIDDEN int argbinsearch_ side _ suff ( const char *  arr,
const char *  key,
const char *  sort,
char *  ret,
npy_intp  arr_len,
npy_intp  key_len,
npy_intp  arr_str,
npy_intp  key_str,
npy_intp  sort_str,
npy_intp  ret_str,
PyArrayObject unused 
)
Updating only one of the indices based on the previous key gives the search a big boost when keys are sorted, but slightly slows down things for purely random ones.

References TYPE.


Variable Documentation

static PyArray_ Arg BinSearchFunc *gen arg binsearch_map [static]
Initial value:
 {
    
    
    {NPY_@TYPE@,
        {
            &@arg@binsearch_left_@suff@,
            &@arg@binsearch_right_@suff@,
        },
    },
    
}
end repeat*
begin repeat <blockquote> #arg = , arg# #Arg = , Arg#</blockquote>