summaryrefslogtreecommitdiff
path: root/numpy
Commit message (Collapse)AuthorAgeFilesLines
...
| | * | | | | | | | MAINT: allow unsized NEP 42 user-defined dtypesNathan Goldbaum2022-12-092-3/+11
| | | |/ / / / / / | | |/| | | | | |
| * | | | | | | | DOC: Add random generator exponential example (#22284)lzha972022-12-102-0/+32
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * DOC: add examples for random generator exponential function (Issue #22270) * DOC: fix doc test for random exponential generator example (Issue #22270) * DOC: fix formatting on np.random.exponential example (Issue: #22270) * DOC: fix test and problem context on np.random.exponential example (Issue: #22270) * DOC: use may vary instead of will vary for exponential example (Issue: #22270)
| * | | | | | | DOC: add numerical integration of x^2 to trapz (#22681)Manuchehr Aminian2022-12-081-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Examples in documentation for trapz goes straight from integrating random arrays to parametric curves. I think it's worth pointing out one can integrate something they'd see in Calculus 1 and get the answer they'd expect. Also add some more guidance text to the existing examples (and style fixes) Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net> Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
| * | | | | | | BUG: Quantile function on complex number now throws an error (#22652) (#22703)Matteo Raso2022-12-084-15/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since percentile is more or less identical to quantile, I also made it throw an error if it receives a complex input. I also made nanquantile and nanpercentile throw errors as well. * Made the changes recommended by seberg * Fixed a test for PR 22703 * Fixed tests for quantile * Shortened some more lines * Fixup more lines Co-authored-by: Sebastian Berg <sebastianb@nvidia.com>
| * | | | | | | BUG: fix unexpected return of np.pad with mode=wrap (#22575)LU2022-12-072-13/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | np.pad with mode="wrap" returns unexpected result that original data is not strictly looped in padding. This may happen in some occassions when padding widths in the same dimension are unbalanced (see added testcase in test_arraypad.py and the related issue). The reason is the function pad makes iterative calls of _set_wrap_both() in the above situation, yet period for padding is not correctly computed in each iteration. The bug is fixed by guaranteeing that period is always a multiple of original data size, and also be the possible maximum for computation efficiency. Closes #22464 Co-authored-by: Lars Grüter <lagru+github@mailbox.org>
| * | | | | | | BUG: Fix deepcopy cleanup on errorSebastian Berg2022-12-071-53/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The deepcopy cleanup on error did not clean up everything in all code paths. Our test do excercise the path, but leak checking is necessry to see the issue. Making a single PR, since it is a bit larger change.
| * | | | | | | Merge pull request #22750 from seiko2plus/issue_22170Sebastian Berg2022-12-072-10/+21
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | BUG, SIMD: Fix rounding large numbers on SSE2
| | * | | | | | | BUG, SIMD: Fix rounding large numbers >= 2^52 on SSE2Sayed Adel2022-12-072-10/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before SSE41, there were no native instructions for rounding operations on double precision. We usually emulate it by assuming that the `MXCR` register is set to rounding, adding a large number `2^52` to `X` and then subtracting it back to eliminate any excess precision as long as `|X|` is less than `2^52` otherwise returns `X.` The current emulated intrinics `npyv_[rint,floor, ceil, trunc]_f64` was not checking whether `|x|` equal or large `2^52` which leads to losing accuracy on large numbers.
| * | | | | | | | DOC: Some updates to the array_api compat document (#22747)Aaron Meurer2022-12-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add reshape differences to the array API compat document * Add an item to the array API compat document about reverse broadcasting * Make some wording easier to read
| * | | | | | | | Merge pull request #22735 from seberg/hide-exceptionsMatti Picus2022-12-065-14/+27
| |\ \ \ \ \ \ \ \ | | |_|/ / / / / / | |/| | | | | | | API: Hide exceptions from the main namespace
| | * | | | | | | DOC: Fix doc `numpy.<exception>` to `numpy.exceptions.<exception>`Sebastian Berg2022-12-063-6/+6
| | | | | | | | |
| | * | | | | | | API: Hide exceptions from the main namespaceSebastian Berg2022-12-063-8/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I wasn't sure if we should already start deprecating the exceptions so opted to follow up with only hiding them from `__dir__()` but still having them in `__all__` and available. This also changes their module to `numpy.exceptions`, which matters because that is how they will be pickled (it would not be possible to unpickle such an exception in an older NumPy version). Due to pickling, we could put off changing the module.
| * | | | | | | | Merge pull request #22736 from melissawm/array-docstring-dtypeSebastian Berg2022-12-061-8/+8
| |\ \ \ \ \ \ \ \ | | |/ / / / / / / | |/| | | | | | | DOC: Improve description of the dtype parameter in np.array docstring
| | * | | | | | | DOC: Improve description of the dtype parameter in np.array docstringmelissawm2022-12-051-8/+8
| | |/ / / / / /
| * | | | | | | Merge pull request #22721 from byrdie/bugfix/median-keepdims-outSebastian Berg2022-12-066-33/+175
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | BUG: `keepdims=True` is ignored if `out` is not `None` in `numpy.median`.
| | * | | | | | | BUG: `keepdims=True` is ignored if `out` is not `None` in `numpy.median()`, ↵Roy Smart2022-12-056-33/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `numpy.percentile()`, and `numpy.quantile()`. Closes #22714, #22544.
| * | | | | | | | Merge pull request #22731 from HaoZeke/maBenchCleanupMatti Picus2022-12-052-131/+0
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | BENCH: Update MaskedArray Benchmarks
| | * | | | | | | | MAINT: Kill old hand-written benchmarksRohit Goswami2022-12-052-131/+0
| | | | | | | | | |
| * | | | | | | | | Merge pull request #22166 from Developer-Ecosystem-Engineering/add_simd_negativeMatti Picus2022-12-058-90/+430
| |\ \ \ \ \ \ \ \ \ | | |_|/ / / / / / / | |/| | | | | | | | ENH: Add SIMD versions of negative
| | * | | | | | | | Add loops_unary.dispatch.c.src to meson.buildDeveloper-Ecosystem-Engineering2022-11-291-0/+1
| | | | | | | | | |
| | * | | | | | | | Remove duplicated contiguous case for 'negative'Developer-Ecosystem-Engineering2022-11-281-9/+1
| | | | | | | | | |
| | * | | | | | | | test big arrays tooDeveloper-Ecosystem-Engineering2022-11-281-1/+5
| | | | | | | | | |
| | * | | | | | | | fix long linesDeveloper-Ecosystem-Engineering2022-11-281-6/+8
| | | | | | | | | |
| | * | | | | | | | add testsDeveloper-Ecosystem-Engineering2022-11-281-0/+23
| | | | | | | | | |
| | * | | | | | | | vnegq_s64 is only on aarch64Developer-Ecosystem-Engineering2022-11-281-1/+1
| | | | | | | | | |
| | * | | | | | | | Add required defines and casts for gcc buildsDeveloper-Ecosystem-Engineering2022-11-281-1/+6
| | | | | | | | | |
| | * | | | | | | | Remove original fileDeveloper-Ecosystem-Engineering2022-11-281-1173/+0
| | | | | | | | | |
| | * | | | | | | | ENH: Add SIMD versions of negativeDeveloper-Ecosystem-Engineering2022-11-287-90/+1576
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NumPy already has SSE2 versions of `negative`. Changes here convert that to universal intrinsics so other architectures can benefit. Previously there was no unroll and SIMD was only used in contiguous cases. We're now unrolling 4x/2x depending on whether destination is contiguous. x86 doesn't perform as well for non-contiguous cases here, so we leave previous implementation / fall back to scalar. Additionally, we've added SIMD versions for ints.
| * | | | | | | | | Merge pull request #22738 from ngoldbaum/dtype-casts-errorSebastian Berg2022-12-051-0/+8
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | MAINT: check if PyArrayDTypeMeta_Spec->casts is set
| | * | | | | | | | | MAINT: check if PyArrayDTypeMeta_Spec->casts is setNathan Goldbaum2022-12-051-0/+8
| | | |_|/ / / / / / | | |/| | | | | | |
| * | | | | | | | | Merge pull request #22707 from seberg/invalid-promotion-excSebastian Berg2022-12-0519-258/+382
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | ENH,DEP: Add DTypePromotionError and finalize the == and != FutureWarning/Deprecation
| | * | | | | | | | | DOC: Tweak comparison code comment to be a bit more clearSebastian Berg2022-12-051-2/+2
| | | | | | | | | | |
| | * | | | | | | | | DOC: try to clarify datetime not using DTypePromotionError commentSebastian Berg2022-12-031-7/+4
| | | | | | | | | | |
| | * | | | | | | | | DOC: Tweak subclass in richcompare comments based on reviewSebastian Berg2022-12-031-6/+5
| | | | | | | | | | |
| | * | | | | | | | | BUG: Add missing error checkSebastian Berg2022-12-021-0/+3
| | | | | | | | | | |
| | * | | | | | | | | DOC: No need to repeat "error" after DTypePromotionError and line breaksSebastian Berg2022-12-021-7/+7
| | | | | | | | | | |
| | * | | | | | | | | MAINT: Rename to DTypePromotionErrorSebastian Berg2022-12-029-24/+25
| | | | | | | | | | |
| | * | | | | | | | | DOC,TST: address review comments and improve test coverageSebastian Berg2022-12-024-21/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Marten van Kerkwijk <mhvk@astro.utoronto.ca>
| | * | | | | | | | | MAINT: Remove pedantic check that exception is an exceptionSebastian Berg2022-12-021-19/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Python does even crash when you get it wrong, so this is unnecessar
| | * | | | | | | | | MAINT: Fix pointer cast subclass check and for exceptionsSebastian Berg2022-12-011-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | just silences a compiler warning.
| | * | | | | | | | | TST: Remove old deprecation test and convert/add new onesSebastian Berg2022-12-012-74/+52
| | | | | | | | | | |
| | * | | | | | | | | API: Always reject equal/not_equal for datetime/timedelta mixSebastian Berg2022-12-014-18/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows correctly cathing the error, also adjust the the NoLoop error is used for the the "binary no loop error". For now, I think I may want to keep the casting error distinct.
| | * | | | | | | | | TST: Add test to cover basic subclass support of new code pathsSebastian Berg2022-12-011-7/+19
| | | | | | | | | | |
| | * | | | | | | | | MAINT: (equality) fixup subclass handling for new array-return pathSebastian Berg2022-12-012-5/+37
| | | | | | | | | | |
| | * | | | | | | | | TST: Adapt test for modification to == and != deprecation/futurewarningSebastian Berg2022-12-013-12/+6
| | | | | | | | | | |
| | * | | | | | | | | DEP: Finalize the comparison FutureWarning/DeprecationWarningSebastian Berg2022-12-014-127/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This finalize the deprecation warning, there are a couple of corner cases that we don't get as nicely as we could. E.g. we (for now?) manually create the all-false or all-true result array with a bit clunky subclass support (subclasses can always override `==` and `!=` though). We also keep some (existing) behavior for 0-D objects where we just return `NotImplemented`, which means the result should end up with Python booleans (which is probably just as well).
| | * | | | | | | | | ENH: Ensure UFuncTypeError is raised when promotion failsSebastian Berg2022-12-011-8/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If promotion fails internally, this effectively means that there is no loop available for the given ufunc, so chain that error. We only do this for `InvalidPromotion` since we assume other errors may well be critical.
| | * | | | | | | | | ENH: Add an InvalidPromotion exceptionSebastian Berg2022-12-0110-15/+112
| | | |_|_|_|_|/ / / | | |/| | | | | | |
| * | | | | | | | | TST: skip floating-point error test on wasmMatti Picus2022-12-051-1/+2
| | |/ / / / / / / | |/| | | | | | |
| * | | | | | | | ENH: Speedup masked array creation when mask=None (#22725)Lefteris Loukas2022-12-052-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR Closes gh-17046. The problem was that when calling mask=None, the array creation took seconds compared to the microseconds needed when calling mask=False. Using `mask=None` is a bit dubious, since it has a different meaning from the default `mask=nomask`, but the speed trap is so hard to find, that it seems pragmatic to support it. OTOH, it also would seem fine to deprecate the whole path (or maybe see if the path can be sped up so that the speed difference isn't forbidding eough to bother).