summaryrefslogtreecommitdiff
path: root/numpy
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #3360 from juliantaylor/selection-algoCharles Harris2013-08-1216-37/+2328
|\ | | | | add quickselect algorithm and expose it via partition
| * ENH: implement median in terms of partitionJulian Taylor2013-08-122-12/+79
| | | | | | | | | | | | Partitioning is sufficient to obtain the median and is much faster. In the case of overwrite_input=True the resulting array will not be fully sorted anymore.
| * ENH: add quickselect algorithm and expose it via partitionJulian Taylor2013-08-1214-25/+2249
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A partition sorts the kth element into its sorted order and moves all smaller elements before the kth element and all equal or greater elements behind it. The ordering of all elements in the partitions is undefined. It is implemented via the introselection algorithm which has worst case linear complexity compared to a full sort that has linearithmic complexity. The introselect algorithm uses a quickselect with median of three pivot and falls back to a quickselect with median of median of five pivot if no sufficient progress is made. The pivots used during the search for the wanted kth element can optionally be stored and reused for further partitionings of the array. This is used by the python interface if an array of kth is provided to the partitions function. This improves the performance of median and which need to select two elements if the size of the array is even. A percentile function interpolating between values also profits from this. String selection is implemented in terms of quicksort which has the same properties as a selection for now.
* | BUG: Fix variable declaration after statement.Charles Harris2013-08-113-71/+72
|/ | | | | | | | Some declarations that are not at the beginning of a block have slipped into the code. This breaks compilation on Python3.4a1. The Numpy coding standard also disallows that construct. Closes #3598.
* Merge pull request #3599 from charris/fix-operand-flags-testCharles Harris2013-08-111-4/+5
|\ | | | | BUG: Fix test_operand_flags test.
| * BUG: Fix test_operand_flags test.Charles Harris2013-08-111-4/+5
| | | | | | | | | | | | | | | | The test tests an inner loop in operand_flag_tests.c.src that expects a long type, but it is tested using 'i8'. This fails when long is not 'i8'. Closes #3363.
* | DOC: fix some minor issues with histogram2d docstring formatting.Ralf Gommers2013-08-111-9/+19
| |
* | DOC: update example of histogram2d to doctest format.Frank Breitling2013-08-111-31/+30
| |
* | Merge pull request #3594 from juliantaylor/is_aligned_maintCharles Harris2013-08-115-24/+56
|\ \ | | | | | | MAINT: move npy_is_aligned to common.h
| * | ENH: add NPY_LIKELY and NPY_UNLIKELY macros for branching hintsJulian Taylor2013-08-093-3/+28
| | | | | | | | | | | | | | | | | | Use it for npy_is_aligned expecting alignments of the power of two. Cuts down the time spent in _IsAligned by the testsuite relative to the rest of multiarray.so from 0.6% to 0.4%
| * | MAINT: move npy_is_aligned to common.hJulian Taylor2013-08-093-24/+31
| | | | | | | | | | | | | | | | | | also make it and some other alignment operators a bit faster by using unsigned integers and bitwise and if possible. Make use of npy_is_aligned in _IsAligned too.
* | | TST: Add regression test to check numpy.int_ inheritance on Py2/Py3Yury V. Zaytsev2013-08-102-0/+45
| | | | | | | | | | | | Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
* | | BUG: Fix PyType_FastSubclass() check for numpy.int_Yury V. Zaytsev2013-08-101-9/+24
| |/ |/| | | | | Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
* | Merge pull request #3517 from juliantaylor/memchr-all-anyCharles Harris2013-08-103-3/+57
|\ \ | | | | | | ENH: use memchr for unit stride all/any
| * | ENH: improve numpy.all()/any()Julian Taylor2013-08-093-3/+57
| |/ | | | | | | | | | | | | | | | | | | | | | | Unroll the loop once and use pminub/pmaxub to save a slow pmovmskb instruction. Improves performance by 50% on some AMD chips. Also add a pure libc path using memcmp and memchr for non amd64 systems. The libc path can be faster with a very modern cpu and libc version, e.g. an i7 with glibc 2.17 is about 20% faster than our code but many other tested platforms are much slower (2.12 xeon, core2duo) or same speed (2.17 phenom). The numpy code can be removed in future when faster libc versions and cpus are more commonly available.
* | MAINT: remove unused and broken parts of numpy.testingRalf Gommers2013-08-106-47/+21
|/ | | | Deprecate np.testing.importall - it's pointless and partially broken.
* Merge pull request #3513 from seberg/0d-linalgCharles Harris2013-08-052-16/+82
|\ | | | | ENH: inv/solve work with empty inner and others empty outer array
| * ENH: inv/solve work with empty inner and others empty outer arraySebastian Berg2013-08-042-16/+82
| | | | | | | | | | | | | | This makes the inverse of a 0x0 array simply be 0x0 again. It also modifies the no-empty array check in favor of a no-empty *inner* array, since the gufuncs seem to handle the other case fine.
* | Merge pull request #3565 from charris/documentation-fixesCharles Harris2013-08-051-3/+3
|\ \ | | | | | | Documentation fixes for `basics.io.genfromtxt.rst` and `creation.py`
| * | DOC: Fixes for doc/source/user/basics.io.genfromtxt.rst.Jesús Gómez2013-08-011-3/+3
| | | | | | | | | | | | | | | Add missing part of usecols negative index explanation and other minor redaction fixes.
* | | Merge pull request #3521 from arinkverma/gsoc_performanceCharles Harris2013-08-052-2/+4
|\ \ \ | | | | | | | | ENH: Avoiding NPY_BEGIN_THREADS for small arrays can speed-up trivial_three_operand_loop by 5%
| * | | ENH: For smaller array, added macro NPY_BEGIN_THREADS_THRESHOLDED in ↵Arink Verma2013-08-052-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ndarraytypes.h Avoiding NPY_BEGIN_THREADS for small arrays, can speed-up trivial_three_operand_loop by 5%. As releases of GIL, then quickly restoring just after small operation doesn't benefit.
* | | | Merge pull request #3575 from seberg/issue-3458Charles Harris2013-08-052-8/+19
|\ \ \ \ | | | | | | | | | | BUG: Boolean assignment allowed writing to 0-sized array
| * | | | BUG: Boolean assignment allowed writing to 0-sized arraySebastian Berg2013-08-052-8/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was because of the assumption that broadcasting works if the dimension is not > 1, but correct is != 1. Adepted from a patch provided by prossahl. Closes gh-3458.
* | | | | Fix doc typoMartin Spacek2013-08-041-1/+1
|/ / / /
* | | | BUG: Make np.insert check for out of bounds axis arguments.Félix Hartmann2013-08-022-1/+10
| | | | | | | | | | | | | | | | Also add test for IndexError exception when axis is out of bounds.
* | | | TST: add test for negative axis values in np.insert.Félix Hartmann2013-08-021-0/+7
| | | |
* | | | BUG: Fix bug in np.insert when axis=-1Félix Hartmann2013-08-021-1/+1
| | | |
* | | | Merge pull request #3527 from dmuellner/masterCharles Harris2013-08-013-17/+41
|\ \ \ \ | |_|/ / |/| | | Fix for the NumPy C-API deprecation mechanism.
| * | | More tiny changes according to Charles Harris' comments.dmuellner2013-08-011-5/+10
| | | |
| * | | Reflect file name change in setup.py.dmuellner2013-07-291-1/+1
| | | |
| * | | Fixed typo.dmuellner2013-07-291-2/+2
| | | |
| * | | Changes according to Charles Harris' comments.dmuellner2013-07-292-45/+35
| | | |
| * | | Changes according to Charles Harris' comments.dmuellner2013-07-291-0/+0
| | | |
| * | | Fix for the NumPy C-API deprecation mechanism.Daniel2013-07-171-4/+33
| | | |
* | | | DOC: np.char.startswith checks a prefix, not a suffixLars Buitinck2013-08-011-1/+1
| | | |
* | | | Merge pull request #2941 from raulcota/avoid_create-kill_npscalarsCharles Harris2013-07-291-4/+61
|\ \ \ \ | | | | | | | | | | Avoid conversion to NumPy Scalar
| * | | | Fix indentationRaul Cota2013-01-221-4/+4
| | | | |
| * | | | Avoid conversion to NumPy ScalarRaul Cota2013-01-221-4/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After profiling I noticed that a bottleneck for NumPy scalar operations occurs when trying to extract the underlying C value from a Python float because it first converts the Python scalar into its matching NumPy scalar (e.g. PyFloat -> float64) and then it extracts the C value from the NumPy scalar. For some types, it is a lot faster to just extract the value directly from the Python scalar. I only did for PyFloat in this modified code but the code is laid out such that it can be easily extended to other types such as Integers. I did not do them because I was unsure if there was a special scenario to handle across OS and/or between 32 and 64 bit platforms. The ratio of speed to do different operations are listed below (Old time / New time with modifications). In other words, the bigger the number, the bigger the speed up we get. Tested in Python 2.6 Windows RATIO TEST 1.1 Array * Array 1.1 PyFloat * Array 1.1 Float64 * Array 1.0 PyFloat + Array 1.3 Float64 + Array 1.1 PyFloat * PyFloat 1.0 Float64 * Float64 4.0 PyFloat * Float64 2.9 PyFloat * vector1[1] 3.9 PyFloat + Float64 9.8 PyFloat < Float64 9.9 PyFloat < Float64 1.0 Create array from list 1.0 Assign PyFloat to all 1.0 Assign Float64 to all 4.2 Float64 * pyFloat * pyFloat * pyFloat * pyFloat 1.0 pyFloat * pyFloat * pyFloat * pyFloat * pyFloat 1.0 Float64 * Float64 * Float64 * Float64 * Float64 1.0 Float64 ** 2 1.0 pyFloat ** 2
* | | | | Merge pull request #3559 from hklemm/patch-1Charles Harris2013-07-291-4/+3
|\ \ \ \ \ | | | | | | | | | | | | Update structured_arrays.py
| * | | | | Update structured_arrays.pyhklemm2013-07-281-4/+3
| | | | | | | | | | | | | | | | | | The behaviour documented did not match the actual behaviour of numpy. Explanation changed and the code example updated.
* | | | | | MAINT: Remove extraneous remark.Charles Harris2013-07-291-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In numpy/core/src/npymath/npy_math_private.h the /* my machine */ comment is not informative.
* | | | | | ENH: Add support for Motorola extended float formatAndreas Schwab2013-07-296-1/+49
| | | | | |
* | | | | | STY: Break long lines in numpy/distutils/log.py.Charles Harris2013-07-291-5/+16
| | | | | |
* | | | | | MAINT: typo fix in logging messageTomas Tomecek2013-07-291-2/+2
|/ / / / / | | | | | | | | | | | | | | | | | | | | The logging message in numpy.distutils.log.set_threshold mispelled threshold.
* | | | | Merge pull request #3541 from jeromekelleher/patch-1njsmith2013-07-241-1/+1
|\ \ \ \ \ | | | | | | | | | | | | BUG: make preprocessor tests consistent in halffloat.c
| * | | | | Update halffloat.cjeromekelleher2013-07-211-1/+1
| | |_|_|/ | |/| | | | | | | | Corrected preprocessor form.
* | | | | Link cumsum and diff to one another as theyre roughly the inverse of each otherNils Werner2013-07-242-1/+3
| | | | |
* | | | | Merge pull request #3538 from michaelaye/patch-1Ralf Gommers2013-07-231-1/+2
|\ \ \ \ \ | |/ / / / |/| | | | Docstring: point to correct equivalent function (one word change)
| * | | | Repaired my misunderstanding and added np.extractK.-Michael Aye2013-07-231-1/+2
| | | | | | | | | | | | | | | I overlooked that np.compress and ndarray.compress are different things and wrongly assumed that it was a typo. I corrected that and added np.extract for equivalency for 1-D arrays.