summaryrefslogtreecommitdiff
path: root/numpy
Commit message (Collapse)AuthorAgeFilesLines
* MAINT: Rename function to prevent name-shadowingEric Wieser2017-03-231-3/+4
| | | | | This file had two functions called flatten_dtype, which did similar but different things.
* DOC: There's a name for {False, True}, and it's "bool"Eric Wieser2017-03-231-2/+3
|
* DOC: Include np. prefix in meshgrid examplesEgor Klenin2017-03-211-5/+5
| | | | Add "np." prefix to meshgrid calls for consistency
* BUG: fix regex of determineexprtype_re_3 in numpy/f2py/crackfortran.pyZZhaoTireless2017-03-191-2/+2
|
* DOC: fix minor docstring typosCJ Carey2017-03-171-2/+2
|
* Merge pull request #8762 from eric-wieser/poly1d-fixesCharles Harris2017-03-142-29/+54
|\ | | | | BUG: Prevent crash in poly1d.__eq__
| * DEP: Deprecate copying random properties in __init__Eric Wieser2017-03-091-2/+9
| |
| * MAINT: Remove weird __setattr__ logic emulating propertiesEric Wieser2017-03-091-27/+32
| | | | | | | | | | Presumably written long before @property existed. This means we don't need __dict__ everywhere
| * BUG: Prevent crash in poly1d.__eq__Eric Wieser2017-03-092-0/+13
| | | | | | | | Fixes #8760
* | Revert gh-8570.Charles Harris2017-03-132-42/+1
| | | | | | | | | | | | | | | | BUG: fix issue #8250 where np.random.permutation fail. This reverts commit 7a73bad2d9c04e4f16e87dbed9d7b627327fe814. Closes #8776.
* | Merge pull request #8570 from evanlimanto/random-permutation-shuffle-fixEric Wieser2017-03-122-1/+42
|\ \ | | | | | | BUG: fix issue #8250 when np.array gets called on an invalid sequence
| * | BUG: fix issue #8250 where np.random.permutation fails when np.array gets ↵Evan Limanto2017-03-102-1/+42
| | | | | | | | | | | | called on an invalid sequence.
* | | Merge pull request #7862 from pitrou/rewrite_exec_commandJulian Taylor2017-03-111-255/+53
|\ \ \ | | | | | | | | BLD: rewrite np.distutils.exec_command.exec_command()
| * | | BLD: rewrite np.distutils.exec_command.exec_command()Antoine Pitrou2016-07-251-255/+53
| | | | | | | | | | | | | | | | | | | | | | | | exec_command() is currently a mess of several implementations using outdated Python APIs and various hacks. This rewrites it to use the standard subprocess module. See PR #7614 for previous discussion.
* | | | Merge pull request #8754 from ↵Julian Taylor2017-03-106-166/+201
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | AndresGuzman-Ballen/automatic-compiler-vectorization ENH: Allows building npy_math with static inlining
| * | | | ENH: Allows building npy_math with static inliningAndres Guzman-Ballen2017-03-106-166/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Code Overview: Numpy currently decouples the math function definitions in `npy_math.c.src` from the function declarations found in `npy_math.h`. This patch allows definitions to be included along with the inclusion of the `npy_math.h` header. Keeping the declarations and definitions separate is usually the right approach, but mathematical code like this might be better off as an exception to this common practice. Because the definitions are in the source file instead of the header, the compiler does not have any clue what lies underneath these math functions. This means the compiler can't make important optimizations like inlining and vectorization. Extensions that utilize these functions could greatly benefit from this, specifically `loops.c.src` from the umath extension. Implementation Details: + Renames `npy_math.c.src` to `npy_math_internal.h.src` + Generates `npy_math_internal.h` from template by adding to `npymath_sources` list and adding `npymath` directory to include paths in `generate_numpyconfig_h` function of `numpy/core/setup.py` + Numpy's core distutils defines `#NPY_INTERNAL_BUILD` macro to make sure `npy_math_internal.h` is not included when other modules try to include public header `npy_math.h` - Currently do not know how to ship headers generated from template files + Adds `npy_math.c`, a file that includes the `npy_math_internal.h.src` file (but does not add NPY_INLINE static) - This is to keep the same static npy_math library as it exists now + Appends `numpy/npy_math.h` with `npy_math_internal.h` under condition that it's not being included in npy_math.c.src - The conditional macros mean `loops.c.src` will have definitions included, and the compiler will vectorize accordingly + Adds `NPY_INLINE` static to function declarations and definitions when necessary + Replaces `sqrtf` with `npy_sqrtf` in `numpy/core/src/umath/umath_tests.c` to make function portable - `_sqrtf` was not found on certain Windows environments compiling with Py2
* | | | | MAINT: better warning message when running build_src from sdistRalf Gommers2017-03-091-3/+11
| | | | | | | | | | | | | | | | | | | | Addresses comment of @stefanv on gh-7131.
* | | | | Merge pull request #8750 from warut-vijit/masterEric Wieser2017-03-082-1/+8
|\ \ \ \ \ | |_|_|_|/ |/| | | | BUG: Fix np.average for object arrays
| * | | | BUG: Fix np.average with object array weightsDuke Vijitbenjaronk2017-03-072-1/+8
| | | | | | | | | | | | | | | | | | | | Fixes #8696
* | | | | MAINT: tidy up sort output stage, avoiding meshgrid and flatEric Wieser2017-03-071-7/+4
| | | | |
* | | | | MAINT: Remove duplicated code between sort and argsortEric Wieser2017-03-071-13/+2
| | | | |
* | | | | MAINT: Reduce indentation, and remove erroneous return valueEric Wieser2017-03-071-26/+27
| | | | |
* | | | | BUG: Make MaskedArray.argsort and MaskedArray.sort consistentEric Wieser2017-03-073-16/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, these had different rules for unmasking values, and even different arguments to decide how to do so. Fixes #8664
* | | | | MAINT: Combine ma.argsort and MaskedArray.argsortEric Wieser2017-03-071-10/+9
| | | | |
* | | | | MAINT: Combine ma.sort and MaskedArray.sortEric Wieser2017-03-071-21/+6
| | | | |
* | | | | BUG: Don't signal FP exceptions in np.absoluteJames Cowgill2017-03-072-16/+15
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #8686 This PR centers around this piece of code in `numpy/core/src/umath/loops.c.src`: ```c UNARY_LOOP { const @type@ in1 = *(@type@ *)ip1; const @type@ tmp = in1 > 0 ? in1 : -in1; /* add 0 to clear -0.0 */ *((@type@ *)op1) = tmp + 0; } ``` If in1 is `NaN`, the C99 standard requires that the comparison `in1 > 0` signals `FE_INVALID`, but the usual semantics for the absolute function are that no FP exceptions should be generated (eg compare to C `fabs` and Python `abs`). This was probably never noticed due to a bug in GCC x86 where all floating point comparisons do not signal exceptions, however Clang on x86 and GCC on other architectures (including ARM and MIPS) do signal an FP exception here. Fix by clearing the floating point exceptions after the loop has finished. The alternative of rewriting the loop to use `npy_fabs` instead would also work but has performance issues because that function is not inlined. The `test_abs_neg_blocked` is adjusted not to ignore `FE_INVALID` errors because now both absolute and negate should never produce an FP exceptions.
* | | | Merge pull request #8667 from eric-wieser/reuse-ma-dtypeahaldane2017-03-062-20/+60
|\ \ \ \ | |/ / / |/| | | BUG: Preserve identity of dtypes in make_mask_descr
| * | | MAINT: Don't call internal recursion helpers elsewhereEric Wieser2017-03-031-21/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cleans up make_mask_descr, and adds a private _replace_dtype_fields, which we need elsewhere to replace all dtypes with `object` instead of `bool`. This new version also removes repeated calls to `np.dtype`, doing the conversion only once.
| * | | BUG: Preserve identity of dtypes in make_mask_descrEric Wieser2017-03-032-7/+30
| | | | | | | | | | | | | | | | Partially addresses #8666
* | | | MAINT: Remove files and constants only needed for Bento. (#8744)Alexander Shadchin2017-03-052-61/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * BLD: Remove unused _numpyconfig.h.in That file was needed for the bento build, for which support was removed in numpy 1.11.0 * BLD: Remove unused PYTHON_HAS_UNICODE_WIDE The need for variable also went away for Bento.
* | | | ENH: Implement most linalg operations for 0x0 matricesEric Wieser2017-03-042-29/+34
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #8212 det: return ones of the right shape slogdet: return sign=ones, log=zeros of the right shape pinv, eigvals(h?), eig(h?): return empty array(s?) of the right shape svd & qr: not implemented, due to complex return value rules
* | | BUG: Apply fix for unknown bug in dlamch to slamch tooEric Wieser2017-03-022-1/+10
| | | | | | | | | | | | | | | | | | This bug is mentioned, fixed, but not described, in cadbb5f2ec84cb774023bbe8cbe6f39a93e837d7 To be safe, we patch it for the equivalent float32 function.
* | | MAINT: Prefer to load functions from lapack/install if possibleEric Wieser2017-03-028-2047/+2126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the dlamch function was a manually-edited file, precluding autogeneration. We fix this by putting the manual edits in a patch file, and then generating f2c_config.c from install/*.f, which includes dlamch. While these functions exist in more than once place in lapack 3.0.0, they only exist in lapack/install in newer versions. A side effect of this is that some functions have been pulled out of `f2c_blas.c` and `f2c_s_lapack.c` into this new file. The edits in the patch were introduced in cadbb5f2ec84cb774023bbe8cbe6f39a93e837d7, for a reason that is lost to time.
* | | MAINT: Split up the lapack_lite files more sensiblyEric Wieser2017-03-0211-96084/+96198
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also uses this splitting as an excuse to ditch the _lite suffix, in favor of a f2c_ prefix for all generated files. Before: * `zlapack_lite.c` - Functions for the `complex128` type. * `dlapack_lite.c` - Every other lapack function After: * `f2c_z_lapack.c` - Functions for the `complex128` type. * `f2c_c_lapack.c` - Functions for the `complex64` type. * `f2c_d_lapack.c` - Functions for the `float64` type. * `f2c_s_lapack.c` - Functions for the `float32` type. * `f2c_lapack.c` - Every other lapack function
* | | MAINT: Improve handing of files and subprocessesEric Wieser2017-03-021-47/+59
| | | | | | | | | | | | | | | Since we can use 2.7+ features now, we can have the with statement and subprocess.check_call
* | | Merge pull request #8716 from juliantaylor/test-reduceCharles Harris2017-03-012-2/+8
|\ \ \ | | | | | | | | MAINT: Mark some tests with slow decorator
| * | | TST: mark some tests with slow decoratorJulian Taylor2017-02-282-2/+8
| | | | | | | | | | | | | | | | | | | | They all are in released versions so running them all the time should not be required anymore.
* | | | Merge pull request #8718 from MareinK/random_choice_test_assertsEric Wieser2017-03-011-5/+5
|\ \ \ \ | | | | | | | | | | BUG: Fix assert statements in random.choice tests
| * | | | BUG: Fix assert statements in random.choice testsMarein Könings2017-02-281-5/+5
| | | | | | | | | | | | | | | | | | | | Unless I am very much mistaken these 'assert_(x,y)' calls should really be 'assert_equal(x,y)'.
* | | | | BUG: Fix creating a np.matrix from string syntax involving booleans (#8497)Zè Vinícius2017-03-012-41/+12
|/ / / / | | | | | | | | | | | | | | | | | | | | Fixes #8459 * DOC: add release note [ci skip]
* | | | MAINT: Warn users when calling np.ma.MaskedArray.(arg-)partition function.Michael Seifert2017-02-281-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using the np.median function on MaskedArrays uses the not-overriden partition method of a plain np.ndarray without error or warning. (#7330) This PR overrides the partition method on MaskedArrays but simply to throw a Warning. This will make users aware that something ignores the mask without breaking backwards-compatibility. This also applies to the argpartition method (even if it's not called by np.median).
* | | | Merge pull request #8709 from mortada/docstring_typosEric Wieser2017-02-281-10/+10
|\ \ \ \ | | | | | | | | | | DOC: Fixed minor typos in temp_elide.c
| * | | | DOC: Fixed minor typos in temp_elide.cMortada Mehyar2017-02-271-10/+10
| |/ / / | | | | | | | | | | | | [ci skip]
* | | | Merge pull request #8590 from mhvk/ma/eq_ne_axis_bugEric Wieser2017-02-282-90/+172
|\ \ \ \ | |/ / / |/| | | BUG MaskedArray __eq__ wrong for masked scalar, multi-d recarray
| * | | BUG: ensure masked array comparison with regular void works.Marten van Kerkwijk2017-02-272-25/+25
| | | |
| * | | BUG: MaskedArray __eq__ wrong for masked scalar, multi-d recarrayMarten van Kerkwijk2017-02-272-73/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the process of trying to fix the "questionable behaviour in `MaskedArray.__eq__`" (gh-8589), it became clear that the code was buggy. E.g., `ma == ma[0]` failed if `ma` held a structured dtype; multi-d structured dtypes failed generally; and, more worryingly, a masked scalar comparison could be wrong: `np.ma.MaskedArray(1, mask=True) == 0` yields True. This commit solves these problems, adding tests to prevent regression. In the process, it also ensures that the results for structured arrays always equals what one would get by logically combining the results over individual parts of the structure.
* | | | Merge pull request #8705 from juliantaylor/ma-median-emptyEric Wieser2017-02-272-3/+10
|\ \ \ \ | | | | | | | | | | BUG: fix ma.median for empty ndarrays
| * | | | BUG: fix ma.median for empty ndarraysJulian Taylor2017-02-272-3/+10
| |/ / / | | | | | | | | | | | | | | | | return nan as it did in 1.11 and same as normal median. closes gh-8703
* | | | Merge pull request #8704 from charris/fix-zerosize-deep-copyseberg2017-02-272-28/+36
|\ \ \ \ | |/ / / |/| | | BUG: Fix deepcopy regression for empty arrays.
| * | | BUG: Fix deepcopy regression for empty arrays.Charles Harris2017-02-272-28/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Deepcopy of empty arrays was failing because the nditer was constructed without the NPY_ITER_ZEROSIZE_OK flag. Closes #8536.