diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2013-10-14 21:54:17 +0200 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2013-10-14 22:14:52 +0200 |
commit | 10ce5b29cf1fd507f1ba8d072724388089774ac4 (patch) | |
tree | 835d604133337bb3364aa4a152780e1dc8edf02c /numpy/core | |
parent | 681025d3f601dd2ac4ec3b24f728b4e319218c8d (diff) | |
download | numpy-10ce5b29cf1fd507f1ba8d072724388089774ac4.tar.gz |
MAINT: add src/private in build_dir to include search paths
allows generating headers like npy_partition.h with the code generator
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/bento.info | 1 | ||||
-rw-r--r-- | numpy/core/setup.py | 19 | ||||
-rw-r--r-- | numpy/core/src/private/npy_partition.h | 558 |
3 files changed, 16 insertions, 562 deletions
diff --git a/numpy/core/bento.info b/numpy/core/bento.info index cad7ffe8c..caef8a2b1 100644 --- a/numpy/core/bento.info +++ b/numpy/core/bento.info @@ -10,6 +10,7 @@ Library: src/npymath/halffloat.c CompiledLibrary: npysort Sources: + src/private/npy_partition.h.src src/npysort/quicksort.c.src, src/npysort/mergesort.c.src, src/npysort/heapsort.c.src, diff --git a/numpy/core/setup.py b/numpy/core/setup.py index 8c6c287a1..c3f79a3c7 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -529,6 +529,10 @@ def configuration(parent_package='',top_path=None): def generate_numpyconfig_h(ext, build_dir): """Depends on config.h: generate_config_h has to be called before !""" + # put private include directory in build_dir on search path + # allows using code generation in headers headers + config.add_include_dirs(join(build_dir, "src", "private")) + target = join(build_dir, header_dir, '_numpyconfig.h') d = os.path.dirname(target) if not os.path.exists(d): @@ -697,10 +701,17 @@ def configuration(parent_package='',top_path=None): # This library is created for the build but it is not installed config.add_library('npysort', - sources = [join('src', 'npysort', 'quicksort.c.src'), - join('src', 'npysort', 'mergesort.c.src'), - join('src', 'npysort', 'heapsort.c.src'), - join('src', 'npysort', 'selection.c.src')]) + sources=[join('src', 'npysort', 'quicksort.c.src'), + join('src', 'npysort', 'mergesort.c.src'), + join('src', 'npysort', 'heapsort.c.src'), + join('src','private', 'npy_partition.h.src'), + join('src', 'npysort', 'selection.c.src')], + deps=[join('src', 'npysort', 'quicksort.c'), + join('src', 'npysort', 'mergesort.c'), + join('src', 'npysort', 'heapsort.c'), + join('src', 'private', 'npy_partition.h'), + join('src', 'npysort', 'selection.c')], + include_dirs=[]) ####################################################################### diff --git a/numpy/core/src/private/npy_partition.h b/numpy/core/src/private/npy_partition.h deleted file mode 100644 index f2b684d3a..000000000 --- a/numpy/core/src/private/npy_partition.h +++ /dev/null @@ -1,558 +0,0 @@ - -/* - ***************************************************************************** - ** This file was autogenerated from a template DO NOT EDIT!!!! ** - ** Changes should be made to the original source (.src) file ** - ***************************************************************************** - */ - -#line 1 -/* - ***************************************************************************** - ** IMPORTANT NOTE for npy_partition.h.src -> npy_partition.h ** - ***************************************************************************** - * The template file loops.h.src is not automatically converted into - * loops.h by the build system. If you edit this file, you must manually - * do the conversion using numpy/distutils/conv_template.py from the - * command line as follows: - * - * $ cd <NumPy source root directory> - * $ python numpy/distutils/conv_template.py numpy/core/src/private/npy_partition.h.src - * $ - */ - - -#ifndef __NPY_PARTITION_H__ -#define __NPY_PARTITION_H__ - - -#include "npy_sort.h" - -/* Python include is for future object sorts */ -#include <Python.h> -#include <numpy/npy_common.h> -#include <numpy/ndarraytypes.h> - -#define NPY_MAX_PIVOT_STACK 50 - - -#line 43 - -int introselect_bool(npy_bool *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_bool(npy_bool *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_byte(npy_byte *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_byte(npy_byte *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_ubyte(npy_ubyte *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_ubyte(npy_ubyte *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_short(npy_short *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_short(npy_short *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_ushort(npy_ushort *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_ushort(npy_ushort *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_int(npy_int *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_int(npy_int *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_uint(npy_uint *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_uint(npy_uint *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_long(npy_long *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_long(npy_long *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_ulong(npy_ulong *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_ulong(npy_ulong *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_longlong(npy_longlong *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_longlong(npy_longlong *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_ulonglong(npy_ulonglong *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_ulonglong(npy_ulonglong *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_half(npy_ushort *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_half(npy_ushort *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_float(npy_float *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_float(npy_float *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_double(npy_double *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_double(npy_double *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_longdouble(npy_longdouble *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_longdouble(npy_longdouble *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_cfloat(npy_cfloat *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_cfloat(npy_cfloat *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_cdouble(npy_cdouble *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_cdouble(npy_cdouble *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - -#line 43 - -int introselect_clongdouble(npy_clongdouble *v, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); -int aintroselect_clongdouble(npy_clongdouble *v, npy_intp* tosort, npy_intp num, - npy_intp kth, - npy_intp * pivots, - npy_intp * npiv, - void *NOT_USED); - - - - -int introselect_string(npy_char *vec, npy_intp cnt, npy_intp kth, PyArrayObject *arr); -int aintroselect_string(npy_char *vec, npy_intp *ind, npy_intp cnt, npy_intp kth, void *null); - - -int introselect_unicode(npy_ucs4 *vec, npy_intp cnt, npy_intp kth, PyArrayObject *arr); -int aintroselect_unicode(npy_ucs4 *vec, npy_intp *ind, npy_intp cnt, npy_intp kth, void *null); - -int npy_introselect(void *base, size_t num, size_t size, size_t kth, npy_comparator cmp); - -typedef struct { - enum NPY_TYPES typenum; - PyArray_PartitionFunc * part[NPY_NSELECTS]; - PyArray_ArgPartitionFunc * argpart[NPY_NSELECTS]; -} part_map; - -static part_map _part_map[] = { -#line 87 - { - NPY_BOOL, - { - (PyArray_PartitionFunc *)&introselect_bool, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_bool, - } - }, - -#line 87 - { - NPY_BYTE, - { - (PyArray_PartitionFunc *)&introselect_byte, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_byte, - } - }, - -#line 87 - { - NPY_UBYTE, - { - (PyArray_PartitionFunc *)&introselect_ubyte, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_ubyte, - } - }, - -#line 87 - { - NPY_SHORT, - { - (PyArray_PartitionFunc *)&introselect_short, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_short, - } - }, - -#line 87 - { - NPY_USHORT, - { - (PyArray_PartitionFunc *)&introselect_ushort, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_ushort, - } - }, - -#line 87 - { - NPY_INT, - { - (PyArray_PartitionFunc *)&introselect_int, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_int, - } - }, - -#line 87 - { - NPY_UINT, - { - (PyArray_PartitionFunc *)&introselect_uint, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_uint, - } - }, - -#line 87 - { - NPY_LONG, - { - (PyArray_PartitionFunc *)&introselect_long, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_long, - } - }, - -#line 87 - { - NPY_ULONG, - { - (PyArray_PartitionFunc *)&introselect_ulong, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_ulong, - } - }, - -#line 87 - { - NPY_LONGLONG, - { - (PyArray_PartitionFunc *)&introselect_longlong, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_longlong, - } - }, - -#line 87 - { - NPY_ULONGLONG, - { - (PyArray_PartitionFunc *)&introselect_ulonglong, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_ulonglong, - } - }, - -#line 87 - { - NPY_HALF, - { - (PyArray_PartitionFunc *)&introselect_half, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_half, - } - }, - -#line 87 - { - NPY_FLOAT, - { - (PyArray_PartitionFunc *)&introselect_float, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_float, - } - }, - -#line 87 - { - NPY_DOUBLE, - { - (PyArray_PartitionFunc *)&introselect_double, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_double, - } - }, - -#line 87 - { - NPY_LONGDOUBLE, - { - (PyArray_PartitionFunc *)&introselect_longdouble, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_longdouble, - } - }, - -#line 87 - { - NPY_CFLOAT, - { - (PyArray_PartitionFunc *)&introselect_cfloat, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_cfloat, - } - }, - -#line 87 - { - NPY_CDOUBLE, - { - (PyArray_PartitionFunc *)&introselect_cdouble, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_cdouble, - } - }, - -#line 87 - { - NPY_CLONGDOUBLE, - { - (PyArray_PartitionFunc *)&introselect_clongdouble, - }, - { - (PyArray_ArgPartitionFunc *)&aintroselect_clongdouble, - } - }, - -}; - - -static NPY_INLINE PyArray_PartitionFunc * -get_partition_func(int type, NPY_SELECTKIND which) -{ - npy_intp i; - if (which >= NPY_NSELECTS) { - return NULL; - } - for (i = 0; i < sizeof(_part_map)/sizeof(_part_map[0]); i++) { - if (type == _part_map[i].typenum) { - return _part_map[i].part[which]; - } - } - return NULL; -} - - -static NPY_INLINE PyArray_ArgPartitionFunc * -get_argpartition_func(int type, NPY_SELECTKIND which) -{ - npy_intp i; - if (which >= NPY_NSELECTS) { - return NULL; - } - for (i = 0; i < sizeof(_part_map)/sizeof(_part_map[0]); i++) { - if (type == _part_map[i].typenum) { - return _part_map[i].argpart[which]; - } - } - return NULL; -} - -#endif |