summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/SConscript12
-rw-r--r--numpy/core/__init__.py1
-rw-r--r--numpy/core/setup.py38
-rw-r--r--numpy/core/src/npysort/npysort_common.h (renamed from numpy/core/src/npysort/npy_sort_common.h)0
-rw-r--r--numpy/core/src/npysort/sort.c.src2
-rw-r--r--numpy/core/src/npysort/sortmodule.c.src103
6 files changed, 3 insertions, 153 deletions
diff --git a/numpy/core/SConscript b/numpy/core/SConscript
index 5532ced7e..e059a1353 100644
--- a/numpy/core/SConscript
+++ b/numpy/core/SConscript
@@ -384,7 +384,7 @@ nditer_src = env.GenerateFromTemplate(
lowlevel_strided_loops_src = env.GenerateFromTemplate(
pjoin('src', 'multiarray', 'lowlevel_strided_loops.c.src'))
einsum_src = env.GenerateFromTemplate(pjoin('src', 'multiarray', 'einsum.c.src'))
-sortmodule_src = env.GenerateFromTemplate(pjoin('src', 'npysort','sortmodule.c.src'))
+#sortmodule_src = env.GenerateFromTemplate(pjoin('src', 'npysort','sortmodule.c.src'))
umathmodule_src = env.GenerateFromTemplate(pjoin('src', 'umath',
'umathmodule.c.src'))
umath_tests_src = env.GenerateFromTemplate(pjoin('src', 'umath',
@@ -441,11 +441,6 @@ subst_dict = {'@prefix@': '$distutils_install_prefix',
'@pkgname@': 'numpy.core', '@sep@': os.path.sep}
npysort_ini = env.SubstInFile(pjoin('lib', 'npy-pkg-config', 'npysort.ini'),
'npysort.ini.in', SUBST_DICT=subst_dict)
-
-#subst_dict = {'@posix_mathlib@': " ".join(['-l%s' % l for l in mlib]),
-# '@msvc_mathlib@': " ".join(['%s.mlib' % l for l in mlib])}
-#mlib_ini = env.SubstInFile(pjoin('lib', 'npy-pkg-config', 'mlib.ini'),
-# 'mlib.ini.in', SUBST_DICT=subst_dict)
env.Install('$distutils_installdir/lib/npy-pkg-config', npysort_ini)
#-----------------
@@ -494,11 +489,6 @@ else:
multiarray = env.DistutilsPythonExtension('multiarray', source = multiarray_src)
env.DistutilsPythonExtension('multiarray_tests', source=multiarray_tests_src)
-#------------------
-# Build sort module
-#------------------
-sort = env.DistutilsPythonExtension('_sort', source = sortmodule_src)
-
#-------------------
# Build umath module
#-------------------
diff --git a/numpy/core/__init__.py b/numpy/core/__init__.py
index dc6f86c20..fa7df13d8 100644
--- a/numpy/core/__init__.py
+++ b/numpy/core/__init__.py
@@ -7,7 +7,6 @@ import umath
import _internal # for freeze programs
import numerictypes as nt
multiarray.set_typeDict(nt.sctypeDict)
-#import _sort
from numeric import *
from fromnumeric import *
import defchararray as char
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
index c5667bea9..1a596b5e9 100644
--- a/numpy/core/setup.py
+++ b/numpy/core/setup.py
@@ -666,7 +666,7 @@ def configuration(parent_package='',top_path=None):
subst_dict)
#######################################################################
- # sort library #
+ # npysort library #
#######################################################################
#subst_dict = dict([("sep", os.path.sep), ("pkgname", "numpy.core")])
@@ -677,42 +677,6 @@ def configuration(parent_package='',top_path=None):
subst_dict)
#######################################################################
- # sort module #
- #######################################################################
-
- # _sort version: this function is needed to build foo.c from foo.c.src
- # when foo.c is included in another file and as such not in the src
- # argument of build_ext command
- def generate_sort_templated_sources(ext, build_dir):
- from numpy.distutils.misc_util import get_cmd
-
- subpath = join('src', 'npysort')
- sources = [join(local_dir, subpath, 'sortmodule.c.src')]
-
- # numpy.distutils generate .c from .c.src in weird directories, we have
- # to add them there as they depend on the build_dir
- config.add_include_dirs(join(build_dir, subpath))
- cmd = get_cmd('build_src')
- cmd.ensure_finalized()
- cmd.template_sources(sources, ext)
-
- sort_deps = [
- join('src', 'npysort', 'npy_sort_common.h'),
- join('src', 'npysort', 'sort.c.src')]
-
- sort_src = [
- join('src', 'npysort', 'sortmodule.c.src'),
- generate_sort_templated_sources,
- generate_config_h,
- generate_numpyconfig_h,
- generate_numpy_api]
-
- config.add_extension('_sort',
- sources = sort_src,
- depends = deps + sort_deps,
- libraries = ['npysort'])
-
- #######################################################################
# multiarray module #
#######################################################################
diff --git a/numpy/core/src/npysort/npy_sort_common.h b/numpy/core/src/npysort/npysort_common.h
index c785b5e71..c785b5e71 100644
--- a/numpy/core/src/npysort/npy_sort_common.h
+++ b/numpy/core/src/npysort/npysort_common.h
diff --git a/numpy/core/src/npysort/sort.c.src b/numpy/core/src/npysort/sort.c.src
index bb276b826..212002c77 100644
--- a/numpy/core/src/npysort/sort.c.src
+++ b/numpy/core/src/npysort/sort.c.src
@@ -28,7 +28,7 @@
#include <stdlib.h>
#include <numpy/npy_sort.h>
-#include "npy_sort_common.h"
+#include "npysort_common.h"
#define NOT_USED NPY_UNUSED(unused)
#define PYA_QS_STACK 100
diff --git a/numpy/core/src/npysort/sortmodule.c.src b/numpy/core/src/npysort/sortmodule.c.src
deleted file mode 100644
index def51fe10..000000000
--- a/numpy/core/src/npysort/sortmodule.c.src
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- c -*- */
-
-/*
- * The purpose of this module is to add faster sort functions
- * that are type-specific. This is done by altering the
- * function table for the builtin descriptors.
- *
- * These sorting functions are copied almost directly from numarray
- * with a few modifications (complex comparisons compare the imaginary
- * part if the real parts are equal, for example), and the names
- * are changed.
- *
- * The original sorting code is due to Charles R. Harris who wrote
- * it for numarray.
- */
-
-/*
- * Quick sort is usually the fastest, but the worst case scenario can
- * be slower than the merge and heap sorts. The merge sort requires
- * extra memory and so for large arrays may not be useful.
- *
- * The merge sort is *stable*, meaning that equal components
- * are unmoved from their entry versions, so it can be used to
- * implement lexigraphic sorting on multiple keys.
- *
- * The heap sort is included for completeness.
- */
-
-#include <numpy/npy_sort.h>
-#include <numpy/npy_3kcompat.h>
-#include <numpy/ndarrayobject.h>
-
-static void
-add_sortfuncs(void)
-{
- PyArray_Descr *descr;
-
- /**begin repeat
- *
- * #TYPE = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
- * LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE,
- * CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE#
- * #suff = bool, byte, ubyte, short, ushort, int, uint, long, ulong,
- * longlong, ulonglong, half, float, double, longdouble,
- * cfloat, cdouble, clongdouble, string, unicode#
- */
- descr = PyArray_DescrFromType(PyArray_@TYPE@);
- descr->f->sort[PyArray_QUICKSORT] =
- (PyArray_SortFunc *)quicksort_@suff@;
- descr->f->sort[PyArray_HEAPSORT] =
- (PyArray_SortFunc *)heapsort_@suff@;
- descr->f->sort[PyArray_MERGESORT] =
- (PyArray_SortFunc *)mergesort_@suff@;
- descr->f->argsort[PyArray_QUICKSORT] =
- (PyArray_ArgSortFunc *)aquicksort_@suff@;
- descr->f->argsort[PyArray_HEAPSORT] =
- (PyArray_ArgSortFunc *)aheapsort_@suff@;
- descr->f->argsort[PyArray_MERGESORT] =
- (PyArray_ArgSortFunc *)amergesort_@suff@;
- /**end repeat**/
-
-}
-
-static struct PyMethodDef methods[] = {
- {NULL, NULL, 0, NULL}
-};
-
-
-#if defined(NPY_PY3K)
-static struct PyModuleDef moduledef = {
- PyModuleDef_HEAD_INIT,
- "_sort",
- NULL,
- -1,
- methods,
- NULL,
- NULL,
- NULL,
- NULL
-};
-#endif
-
-/* Initialization function for the module */
-#if defined(NPY_PY3K)
-PyObject *PyInit__sort(void) {
- PyObject *m;
- m = PyModule_Create(&moduledef);
- if (!m) {
- return NULL;
- }
- import_array();
- add_sortfuncs();
- return m;
-}
-#else
-PyMODINIT_FUNC
-init_sort(void) {
- Py_InitModule("_sort", methods);
-
- import_array();
- add_sortfuncs();
-}
-#endif