numpy  2.0.0
src/npysort/binsearch.c.src File Reference
#include "npy_sort.h"
#include "npysort_common.h"
#include "npy_binsearch.h"

Defines

#define NPY_NO_DEPRECATED_API   NPY_API_VERSION
#define NOT_USED   NPY_UNUSED(unused)
#define TYPE   @_LTE(a, b) (!@TYPE@_LT((b), (a)))

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 *NOT_USED)
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 *NOT_USED)
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)

Define Documentation

#define NOT_USED   NPY_UNUSED(unused)
#define NPY_NO_DEPRECATED_API   NPY_API_VERSION
#define TYPE   @_LTE(a, b) (!@TYPE@_LT((b), (a)))

* NUMERIC SEARCHES **

begin repeat <blockquote>

TYPE = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA#
suff = bool, byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, half, float, double, longdouble, cfloat, cdouble, clongdouble, datetime, timedelta#
#type = npy_bool, npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int,
npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_ushort, npy_float, npy_double, npy_longdouble, npy_cfloat, npy_cdouble, npy_clongdouble, npy_datetime, npy_timedelta#

</blockquote>

Referenced by _ctype_negative(), _ldexp_long(), suff(), and TIMEDELTA_mq_m_multiply().


Function Documentation

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 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 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 NOT_USED 
)
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.