summaryrefslogtreecommitdiff
path: root/numpy
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | | | DOC: mention changes to `max_rows` behaviour in `np.loadtxt` (#21854)Pranab Das2022-06-271-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * DOC: mention changes to `max_rows` behaviour * Clarify how line counting works in max_rows
* | | | | | | | Merge pull request #21848 from postmalloc/float16_nanCharles Harris2022-06-272-15/+28
|\ \ \ \ \ \ \ \ | |_|_|_|/ / / / |/| | | | | | | BUG: Handle NaNs correctly for float16 during sorting
| * | | | | | | remove unusued importpostmalloc2022-06-261-1/+0
| | | | | | | |
| * | | | | | | parameterize and split testspostmalloc2022-06-261-39/+20
| | | | | | | |
| * | | | | | | Handle NaNs correctly for half-precision floatsSrimukh Sripada2022-06-242-5/+38
| | | | | | | |
* | | | | | | | DOC: Replace the mathematical notation N(...) with text.warren2022-06-264-13/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The meaning of the second argument in the mathematical notation N(mu, b) for the normal distribution is not consistent. In some references it is the variance while in others it is the standard deviation. Let's avoid the ambiguity by not using the notation. Fixes #21296
* | | | | | | | BUG: Use `keepdims` during normalization in `np.average` and `np.ma.average` ↵Srimukh Sripada2022-06-264-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#21851) The keepdims flag needs to be applied during the calculation of the sum of the weights in np.average and np.ma.average. Not passing it causes weights to broadcast incorrectly. Fixes #21850
* | | | | | | | Merge pull request #21626 from seberg/weak-scalarsCharles Harris2022-06-2628-219/+800
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | API: Introduce optional (and partial) NEP 50 weak scalar logic
| * | | | | | | | DOC,TST: Add `uint8(100) + 200)` example and fixup float overflow testSebastian Berg2022-06-151-1/+14
| | | | | | | | |
| * | | | | | | | MAINT: Fixup bad rebaseSebastian Berg2022-06-151-4/+1
| | | | | | | | |
| * | | | | | | | STY: Minor tweaks/rewordingSebastian Berg2022-06-153-6/+5
| | | | | | | | |
| * | | | | | | | REV: Revert some minor style changes that smuggled their way inSebastian Berg2022-06-151-2/+2
| | | | | | | | |
| * | | | | | | | MAINT: Put array tagging into a static inline functionSebastian Berg2022-06-153-41/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this also effectively fixes some corner cases in np.result_type
| * | | | | | | | REV: Revert casting part of the old changesSebastian Berg2022-06-152-5/+6
| | | | | | | | |
| * | | | | | | | BUG: Fix broken weak promotion (including legacy ones) and make it more robustSebastian Berg2022-06-152-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems that the (weird and probably non-existing in practice) case of uint8 vs. int8 promotion when the input is a single integer was broken at some point and this fixes it again. This is only really relevant for rational, which defines only a very selective number of integer promotions. This fixes up the previous chunk that relaxes promotion fallbacks a lot for legacy dtypes.
| * | | | | | | | ENH: Try to be more forgiving in abstract dtype promotionSebastian Berg2022-06-151-3/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This follows the tests (and actually goes hand in hand with them). There are still some apparent issues here though, I suspect (but am not sure), the that the legacy promotion may need to kick in more agressively when errors occur. Also, surprisingly this fixes things that maybe should fail in legacy promotion, and I am not yet sure why...
| * | | | | | | | TST: Improve testing setup by introducing a new `weak_promotion` fixtureSebastian Berg2022-06-154-26/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, this shows that the rational tests are still broken a bit.
| * | | | | | | | TST: Add very basic tests based on the NEP 50 change tableSebastian Berg2022-06-151-0/+59
| | | | | | | | |
| * | | | | | | | BUG: Accepting float subclasses, means we have to reject float64 onesSebastian Berg2022-06-151-1/+2
| | | | | | | | |
| * | | | | | | | API: Add leading underscore to `no_nep50_warning` and `get/set_promotion_state`Sebastian Berg2022-06-1517-43/+44
| | | | | | | | |
| * | | | | | | | TYP: Add types for new symbolsSebastian Berg2022-06-152-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Bas van Beek <b.f.van.beek@vu.nl>
| * | | | | | | | BUG: Need to keep the skipping-if-legacy logic for now at leastSebastian Berg2022-06-151-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If all are scalars, then legacy promotion is not forced but we would use weak promotion internally suddenly (which we must not!).
| * | | | | | | | TODO: Add a todo note ;)Sebastian Berg2022-06-151-0/+1
| | | | | | | | |
| * | | | | | | | MAINT: Ignore warning rather than forcing output dtypeSebastian Berg2022-06-151-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Forcing the output dtype does not work here, since it actually can be integral (not that this is usually a good idea). In practice, the change we are doing here is forcing 64bit (or 32bit depending on platform) of precision for the calculation. This means that the change will only ever increase precision mildly compared to the current situation.
| * | | | | | | | MAINT: Add stricter subclass checkSebastian Berg2022-06-151-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The issue is that bools are subclasses of ints, which triggers the more general problem that we cannot use the `int` abstract dtype if the input has a concrete dtype associated (e.g. bools, but also general user defined DTypes in principle)
| * | | | | | | | API: Fix legacy promotion option and expose as env variableSebastian Berg2022-06-155-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also make the warning message sane :)
| * | | | | | | | TST: Promotion test (and warning filter) fixupSebastian Berg2022-06-151-1/+2
| | | | | | | | |
| * | | | | | | | TST: Ignore promotion warning in linalg test calculating atolSebastian Berg2022-06-151-3/+3
| | | | | | | | |
| * | | | | | | | MAINT: Remove incorrect check from concat and improve warningSebastian Berg2022-06-151-6/+4
| | | | | | | | |
| * | | | | | | | FIXUP set_promotion_stateSebastian Berg2022-06-151-3/+3
| | | | | | | | |
| * | | | | | | | MAINT: Ensure sanity check in `__init__` does not trigger NEP 50 warningSebastian Berg2022-06-151-1/+1
| | | | | | | | |
| * | | | | | | | API: Enforce float64 precision for `assert_almost_equal`Sebastian Berg2022-06-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures that the precision is not downcast, which could make a small value zero (for float16 mostly). This lets tests pass that check whether `np.float16(0)` is almost equal to 0, which otherwise fail (because `float16(0.00000001)` will evaluate to 0 exactly.
| * | | | | | | | TST: More promotion change adaptions and warning filteringSebastian Berg2022-06-153-4/+10
| | | | | | | | |
| * | | | | | | | TST: Adapt percentile test to changed promotionSebastian Berg2022-06-151-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Promotion in percentile will now more aggressively preserve the input dtype for floating point types (rather than upgrading the type to at least float64).
| * | | | | | | | TST: Make test compatible with new promotion or mark for no-warningsSebastian Berg2022-06-154-24/+37
| | | | | | | | |
| * | | | | | | | API: Expose `get_promotion_state` and `set_promotion_state`Sebastian Berg2022-06-155-3/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to be able to query the state for testing, probably should be renamed before the end, but need to have something for now.
| * | | | | | | | MAINT: Fortify methods (in-place division) against promotion changesSebastian Berg2022-06-151-3/+5
| | | | | | | | |
| * | | | | | | | MAINT: Allow subclasses of pyscalars and do not warn if out castingSebastian Berg2022-06-152-3/+18
| | | | | | | | |
| * | | | | | | | WIP: Add warning context manager and fix min_scalar for new promotionSebastian Berg2022-06-156-8/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Even the new promotion has to use the min-scalar logic to avoid picking up a float16 loop for `np.int8(3) * 3.`.
| * | | | | | | | WIP: Restore dual behaviourSebastian Berg2022-06-156-42/+246
| | | | | | | | |
| * | | | | | | | WIP: Implement weak scalar logicSebastian Berg2022-06-157-189/+171
| | | | | | | | |
* | | | | | | | | Merge pull request #21815 from seberg/fixup-error-valgrindCharles Harris2022-06-262-2/+5
|\ \ \ \ \ \ \ \ \ | |_|/ / / / / / / |/| | | | | | | | BUG: Fix discovered MachAr (still used within valgrind)
| * | | | | | | | BUG: Fix discovered MachAr (still used within valgrind)Sebastian Berg2022-06-212-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the missing attributes. I tested the warning and fix on valgrind itself. These attributes were added in gh-18536 but the fallback path was not checked there. Replaces gh-21813, although something more like it may make sense if it allows us to just delete MachAr completely.
* | | | | | | | | ENH: Add strict parameter to assert_array_equal. (#21595)Jon Morris2022-06-243-6/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #9542 Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com>
* | | | | | | | | BUG: Fix in1d for empty integer array as input (#21842)Miles Cranmer2022-06-242-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * TST: Tests empty input to in1d of various types * MAINT: Skip table method on empty input array * MAINT: Check array size before call to min * MAINT: Return early for kind="table" and empty ar2 * TST: Test other dtypes of empty arrays
* | | | | | | | | Merge pull request #21812 from seberg/ma-compsCharles Harris2022-06-232-1/+65
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | BUG: Define `<`, `<=`, `>`, `>=` for masked arrays
| * | | | | | | | | API: Define `<`, `<=`, `>`, `>=` for masked arraysSebastian Berg2022-06-212-1/+65
| |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This defines the comparison operators (other than `==` and `!=`) explicitly for masked arrays. The mask is ignored for the resuling `res._data` (unlike `==` and `!=` which take the mask into account. Closes gh-21770, although the way that masked arrays propagate the fill-value seems generally broken and error prone.
* | | | | | | | | Merge pull request #21817 from seberg/always-fillCharles Harris2022-06-236-7/+56
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | ENH: Always fill object fields with None rather than NULL
| * | | | | | | | | TST: Add NULL checks to generic object ufunc loops and getitemSebastian Berg2022-06-212-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an attempt to ensure that we will guarantee non-NULL objects in the future. We do not do so for freshly initialized buffers (they are NULLed for simplicity).
| * | | | | | | | | ENH: Always fill object fields with None rather than NULLSebastian Berg2022-06-214-7/+38
| |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The intention here is to transition (or achieve?) a future where NumPy always fills object fields with None rather than NULL. Filling with NULL is nice (infinitely fast in some cases and easy), but it also adds the trap of expecting NULLs everywhere. Most importantly, cython fails to do so (currently) so this is a bug magnet. At this point, ideally any fully created array is guaranteed to be initialized with proper Python objects. Downstream may break that, so we should not allow it, but this does also add an assert to many ufuncs to flush out further potential issues. NULL initialization is (as of now) still relevant for new buffers. That means that core functionality like `setitem`, or coping into a buffer should still expect a NULL initialized value.