summaryrefslogtreecommitdiff
path: root/numpy/lib
Commit message (Collapse)AuthorAgeFilesLines
* DOC: fix extra space in error messageBerke Kocaoğlu2023-03-161-1/+1
|
* MAINT: remove `NUMPY_EXPERIMENTAL_ARRAY_FUNCTION` env varRalf Gommers2023-03-123-34/+18
| | | | | | | | As discussed in https://mail.python.org/archives/list/numpy-discussion@python.org/thread/UKZJACAP5FUG7KP2AQDPE4P5ADNWLOHZ/ This flag was always meant to be temporary, and cleaning it up is long overdue.
* DEP: expire deprecation for "y as out" in fix/isposinf/isneginfRalf Gommers2023-03-122-65/+1
|
* DOC: Add 'may vary' markup in info() docstring.warren2023-03-071-1/+1
| | | | [skip actions] [skip travis] [skip cirrus]
* DOC: Edit top line of info() docstring to mention array.warren2023-03-071-1/+1
| | | | [skip actions] [skip travis] [skip azp] [skip cirrus]
* DOC: Document that info() handles array instances.warren2023-03-071-4/+21
| | | | [skip actions] [skip travis] [skip azp] [skip cirrus]
* TYP: Remove some stray type-check-only imports of `msort`BvB932023-03-051-1/+0
|
* DEP: deprecate `product`, `cumproduct`, `sometrue`, `alltrue`Ralf Gommers2023-03-023-15/+14
| | | | [skip cirrus]
* DOC: Fixed meshgrid docstring return type (#23310)Miki Watanabe2023-03-011-2/+2
| | | | | Meshgrid returns a list of ndarrays. Co-authored-by: 渡邉 美希 <miki.watanabe@watanabenoMacBook-Pro.local>
* TYP,MAINT: Add a missing explicit Any parameterFrancesc Elies2023-02-211-1/+1
|
* DOC: Fix matpltolib error in documentation (#23212)Sebastian Berg2023-02-141-1/+1
| | | | | | | | As noted by Kyle Sunden, this was deprecated and has been removed, using the method is the correct way of doing it in newer matplotlib. Closes gh-23209 Co-authored-by: Kyle Sunden <ksunden@users.noreply.github.com>
* Merge pull request #23089 from seberg/numpy2-flagMatti Picus2023-02-122-0/+9
|\ | | | | API: Add environment variable for behavior planned in a 2.0
| * MAINT: Use `np._using_numpy2_behavior()` and initialize it in CSebastian Berg2023-02-102-2/+2
| |
| * API: Modify `gradient` to return a tuple rather than a listSebastian Berg2023-02-102-0/+9
| | | | | | | | | | This change is staged for NumPy 2.0, I assume we could get away with it otherwise, but it is a nice example and probably not pressing.
* | Fix typos found by copdespellDimitri Papadopoulos2023-02-111-1/+1
| |
* | MAINT, DOC: string_ → bytes_ and unicode_ → str_Dimitri Papadopoulos2023-02-103-15/+15
|/
* Merge pull request #23113 from hmaarrfk/slots_for_mixinsSebastian Berg2023-01-271-0/+1
|\ | | | | ENH: Add slots to NDArrayOperatorsMixin allowing them in subclasses
| * ENH: Add slots to NDArrayOperatorsMixin to make subclsasing smootherMark Harfouche2023-01-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I use the mixings in a few different file backed arrays. However, the lack of slots make it difficult for me to use slots. I mostly use slots to ensure that performance optimized code doesn't create unecessary references to large chunks of memory. If all parent classes do not have `__slots__` defined, I think that Python (3.9) just ignores `__slots__` alltogether. Thank you for considering.
* | API: Raise EOFError when trying to load past the end of a `.npy` file (#23105)Noé Rubinstein2023-01-272-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the following code: ``` import numpy as np with open('foo.npy', 'wb') as f: for i in range(np.random.randint(10)): np.save(f, 1) with open('foo.npy', 'rb') as f: while True: np.load(f) ``` Will raise: ``` ValueError: Cannot load file containing pickled data when allow_pickle=False ``` While there is no pickled data in the file.
* | Merge branch 'main' into document_diag_indices_fromRoss Barnowski2023-01-2526-229/+595
|\ \
| * | DOC, ENH: Improve docstring of real_if_close (#23087)Pieter Eendebak2023-01-251-6/+6
| | | | | | | | | | | | | | | * fix docstring of real_if_close * factor out dtype
| * | ENH: Convert methods to vectorcall conversions (#23018)Pieter Eendebak2023-01-231-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert several methods to the vectorcall convention. The conversions give a performance improvement, see #20790 (comment) Some notes: * For vdot the METH_KEYWORDS was removed, as the C vdot method was positional only. * The add_docstring is converted with an additional check. It was parsed as if (!PyArg_ParseTuple(args, "OO!:add_docstring", &obj, &PyUnicode_Type, &str)), but there is no support for the ! in the npy_parse_arguments * CI was complaining about coverage of _get_ndarray_c_version. A test was added, but only to provide coverage * In function_base.py a redundant check in def place was removed Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
| * | API: Allow SciPy to get away with assuming `trapz` is a Python functionSebastian Berg2023-01-201-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | This wraps `trapz` into a proper python function and then copies all attributes expected on a Python function over from the "fake" version to the real one. This allows SciPy to pretend `trapz` is a Python function to create their own version.
| * | Merge pull request #23019 from seberg/finalize-non-sequence-stackCharles Harris2023-01-172-6/+6
| |\ \ | | | | | | | | DEP: Finalize the non-sequence stacking deprecation
| | * | DEP: Finalize the non-sequence stacking deprecationSebastian Berg2023-01-172-6/+6
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | The `__array_function__` API currently will exhaust iterators so we cannot accept sequences reasonably. Checking for `__getitem__` is presumably enough to reject that (and was what the deprecation used). Future changes could allow this again, although it is not a useful API anyway, since we have to materialize the iterable in any case.
| * | MAINT: Fix stacklevels for the new C dispatcher not adding oneSebastian Berg2023-01-173-13/+13
| | |
| * | ENH: Improve array function overhead by using vectorcallSebastian Berg2023-01-172-44/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves dispatching for `__array_function__` into a C-wrapper. This helps speed for multiple reasons: * Avoids one additional dispatching function call to C * Avoids the use of `*args, **kwargs` which is slower. * For simple NumPy calls we can stay in the faster "vectorcall" world This speeds up things generally a little, but can speed things up a lot when keyword arguments are used on lightweight functions, for example:: np.can_cast(arr, dtype, casting="same_kind") is more than twice as fast with this. There is one alternative in principle to get best speed: We could inline the "relevant argument"/dispatcher extraction. That changes behavior in an acceptable but larger way (passes default arguments). Unless the C-entry point seems unwanted, this should be a decent step in the right direction even if we want to do that eventually, though. Closes gh-20790 Closes gh-18547 (although not quite sure why)
| * | DOC: #22266 Add examples for tril_indices_from(), triu_indices_from() (#22562)Richie Cotton2023-01-161-2/+69
| |/ | | | | | | | | | | | | | | | | | | | | * DOC: #22266 Add examples for tri[lu]_indices_from() * DOC: see also for tri[lu]_indices_from() * DOC: Fix triu_indices_from example and minor updates. * incides -> indices * Update wording surrounding . Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
| * ENH: Faster numpy.load (try/except _filter_header) (#22916)Michael2023-01-132-5/+20
| | | | | | | | | | | | | | This pull requests speeds up numpy.load. Since _filter_header is quite a bottleneck, we only run it if we must. Users will get a warning if they have a legacy Numpy file so that they can save it again for faster loading. Main discussion and benchmarks see #22898 Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
| * ENH: Improve loadtxt error with dtype and non-matchinig column number (#22996)Sebastian Berg2023-01-111-1/+10
| | | | | | | | The number "changed" is weird if the user fixed it, so give a different message in that case.
| * BUG: np.loadtxt cannot load text file with quoted fields separated by ↵dmbelov2023-01-012-0/+22
| | | | | | | | | | | | | | whitespace (#22906) Fix issue with `delimiter=None` and quote character not working properly (not using whitespace delimiter mode). Closes gh-22899
| * DOC: Add blurb about rotation direction to rot90 docstring (#22880)Matthew Muresan2022-12-291-0/+2
| | | | | | | | | | | | | | * DOC: Add a note to the documentation of the rot90 The note added indicates that rotation is counter clockwise with the default argumemnts. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
| * BUG: Fix integer overflow in in1d for mixed integer dtypes #22877 (#22878)Miles Cranmer2022-12-252-4/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * TST: Mixed integer types for in1d * BUG: Fix mixed dtype overflows for in1d (#22877) * BUG: Type conversion for integer overflow check * MAINT: Fix linting issues in in1d * MAINT: ar1 overflow check only for non-empty array * MAINT: Expand bounds of overflow check * TST: Fix integer overflow in mixed boolean test * TST: Include test for overflow on mixed dtypes * MAINT: Less conservative overflow checks
| * Merge pull request #22869 from seberg/issue-22835Charles Harris2022-12-221-0/+2
| |\ | | | | | | TST: Ignore nan-warnings in randomized nanfunction `out=` tests
| | * TST: Ignore nan-warnings in randomized out testsSebastian Berg2022-12-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | The tests randomize the nan pattern and thus can run into these (additional) warnings, so ignore them. (Could also fix the random seed, but this should do) Closes gh-22835
| * | MAINT: expand show_rutime, add it to issue template [skip ci]mattip2022-12-211-31/+9
| |/
| * BUG: Ensure correct behavior for rows ending in delimiter in loadtxt (#22836)Sebastian Berg2022-12-191-0/+12
| | | | | | | | | | | | | | If a row ends in a delimiter, `add_fields` can be called twice without any field actually being parsed. This causes issues with the field buffer setup. closes gh-22833
| * Merge pull request #22784 from eerovaher/percentile-plot-legendSebastian Berg2022-12-151-1/+2
| |\ | | | | | | DOC: Fix legend placement in `numpy.percentile()` docs
| | * DOC: Fix legend placement in `percentile` docsEero Vaher2022-12-121-1/+2
| | | | | | | | | | | | | | | | | | | | | A plot is meant to demonstrate the different methods of estimating the percentile that `numpy.percentile()` supports, but previously the legend covered a large fraction of it. Now the legend is drawn next to the plot.
| * | TST: Remove outdated xfail from quantile testsSebastian Berg2022-12-141-1/+0
| |/ | | | | | | There should be more tests for this, but this now passes.
| * 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: `keepdims=True` is ignored if `out` is not `None` in `numpy.median()`, ↵Roy Smart2022-12-054-28/+145
| | | | | | | | | | | | `numpy.percentile()`, and `numpy.quantile()`. Closes #22714, #22544.
| * Merge pull request #22619 from seberg/move-set_moduleMatti Picus2022-11-296-8/+9
| |\ | | | | | | MAINT: Move set_module from numpy.core to numpy._utils
| | * MAINT: Move set_module to numpy.core to use without C importSebastian Berg2022-11-246-8/+9
| | |
| * | MAINT: lib: A bit of flake8-driven clean up in shape_base.pywarren2022-11-241-4/+4
| | |
| * | DOC: lib: Use keepdims in a couple docstrings.warren2022-11-241-7/+9
| |/
| * BUG: Histogramdd breaks on big arrays in Windows (#22561)Navpreet Singh2022-11-182-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * BUG: Histogramdd breaks on big arrays in Windows Resolved the issue with line change from int to np.intp in numpy/numpy/lib/histograms.py * BUG: Histogramdd breaks on big arrays in Windows Resolved the issue with line change from int to np.intp in numpy/numpy/lib/histograms.py * Removed the binary files * Update test_histograms.py * Update test_histograms.py * Update test_histograms.py
| * BLD: update OpenBLAS to 0.3.21 and clean up openblas download test (#22525)Matti Picus2022-11-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * BUILD: update OpenBLAS to 0.3.21 and clean up openblas download test * set LDFLAGS on windows64 like the openblaslib build does * use rtools compilers on windows when building wheels * fix typos * add rtools gfortran to PATH * use the openblas dll from the zip archive without rewrapping * typos * copy dll import library for 64-bit interfaces * revert many of the changes to azure-steps-windows.yaml, copy openblas better in wheels * fix wildcard copy * test OpenBLAS build worked with threadpoolctl * typos * install threadpoolctl where needed, use for loop to recursively copy * update macos OpenBLAS suffixes for newer gfortran hashes * use libgfortran5.dylib on macos * fix scripts * re-use gfortran install from MacPython/gfortran-install on macos * use pre-release version of delocate * fixes for wheel builds/tests * add debugging cruft for pypy+win, macos wheels * add DYLD_LIBRARY_PATH on macosx-x86_64 * use 32-bit openblas interfaces for ppc64le tests * skip large_archive test that sometimes segfaults on PyPy+windows