diff options
author | Kasia <39829548+katleszek@users.noreply.github.com> | 2021-05-09 14:35:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-09 14:35:36 +0200 |
commit | 7c61d16aa6a09172dc35662c0005fc2e289e403d (patch) | |
tree | 7c68f9504341f5026985149fec7450b719e7e508 | |
parent | 70dd918b8b531ce7be91bb9e6bb52fdc7c7199b9 (diff) | |
parent | e3583316cab5e71f2b361c32a3eee748905f40c5 (diff) | |
download | numpy-7c61d16aa6a09172dc35662c0005fc2e289e403d.tar.gz |
Merge pull request #1 from numpy/main
update from main - fixing SVD
93 files changed, 5713 insertions, 1743 deletions
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 52d78a38d..cc4950590 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,10 +5,8 @@ on: branches: - main paths: - - './environment.yml' - tags: - - '*' - + - 'environment.yml' + jobs: build: name: Build base Docker image @@ -56,4 +54,4 @@ jobs: numpy/numpy-dev:${{ steps.getrefs.outputs.date }}-${{ steps.getrefs.outputs.branch}}-${{ steps.getrefs.outputs.sha8 }}, numpy/numpy-dev:latest - name: Image digest # Return details of the image build: sha and shell - run: echo ${{ steps.docker_build.outputs.digest }}
\ No newline at end of file + run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.gitignore b/.gitignore index 736597b6b..a2a1f2b68 100644 --- a/.gitignore +++ b/.gitignore @@ -187,6 +187,7 @@ numpy/random/legacy/*.c numpy/random/_mtrand/randint_helpers.pxi numpy/random/bounded_integers.pyx numpy/random/bounded_integers.pxd +numpy/random/lib/npyrandom.lib tools/swig/test/Array_wrap.cxx tools/swig/test/Farray_wrap.cxx tools/swig/test/Farray.py diff --git a/doc/changelog/1.17.0-changelog.rst b/doc/changelog/1.17.0-changelog.rst index 4177c848f..8179c180b 100644 --- a/doc/changelog/1.17.0-changelog.rst +++ b/doc/changelog/1.17.0-changelog.rst @@ -159,7 +159,7 @@ names contributed a patch for the first time. Pull requests merged ==================== -A total of 531 pull requests were merged for this release. +A total of 532 pull requests were merged for this release. * `#4808 <https://github.com/numpy/numpy/pull/4808>`__: ENH: Make the `mode` parameter of np.pad default to 'constant' * `#8131 <https://github.com/numpy/numpy/pull/8131>`__: BUG: Fix help() formatting for deprecated functions. @@ -174,6 +174,7 @@ A total of 531 pull requests were merged for this release. * `#10855 <https://github.com/numpy/numpy/pull/10855>`__: ENH: Adding a count parameter to np.unpackbits * `#11230 <https://github.com/numpy/numpy/pull/11230>`__: MAINT: More cleanup of einsum * `#11233 <https://github.com/numpy/numpy/pull/11233>`__: BUG: ensure i0 does not change the shape. +* `#11358 <https://github.com/numpy/numpy/pull/11358>`__: MAINT: Rewrite numpy.pad without concatenate * `#11684 <https://github.com/numpy/numpy/pull/11684>`__: BUG: Raise when unravel_index, ravel_multi_index are given empty... * `#11689 <https://github.com/numpy/numpy/pull/11689>`__: DOC: Add ref docs for C generic types. * `#11721 <https://github.com/numpy/numpy/pull/11721>`__: BUG: Make `arr.ctypes.data` hold onto a reference to the underlying... diff --git a/doc/changelog/1.18.0-changelog.rst b/doc/changelog/1.18.0-changelog.rst index b86b3614a..266ff0807 100644 --- a/doc/changelog/1.18.0-changelog.rst +++ b/doc/changelog/1.18.0-changelog.rst @@ -123,20 +123,20 @@ names contributed a patch for the first time. Pull requests merged ==================== -A total of 406 pull requests were merged for this release. +A total of 413 pull requests were merged for this release. * `#9301 <https://github.com/numpy/numpy/pull/9301>`__: DOC: added note to docstring of numpy.savez * `#10151 <https://github.com/numpy/numpy/pull/10151>`__: BUG: Numpy scalar types sometimes have the same name * `#12129 <https://github.com/numpy/numpy/pull/12129>`__: DOC: Improve axes shift description and example in np.tensordot -* `#12205 <https://github.com/numpy/numpy/pull/12205>`__: MAINT: avoid relying on `np.generic.__name__` in `np.dtype.name` +* `#12205 <https://github.com/numpy/numpy/pull/12205>`__: MAINT: avoid relying on ``np.generic.__name__`` in ``np.dtype.name`` * `#12284 <https://github.com/numpy/numpy/pull/12284>`__: ENH: supply our version of numpy.pxd, requires cython>=0.29 * `#12633 <https://github.com/numpy/numpy/pull/12633>`__: BUG: General fixes to f2py reference counts (dereferencing) * `#12658 <https://github.com/numpy/numpy/pull/12658>`__: BUG: NaT now sorts to ends of arrays * `#12828 <https://github.com/numpy/numpy/pull/12828>`__: DOC: Updates to nditer usage instructions -* `#13003 <https://github.com/numpy/numpy/pull/13003>`__: BUG: Do not crash on recursive `.dtype` attribute lookup. +* `#13003 <https://github.com/numpy/numpy/pull/13003>`__: BUG: Do not crash on recursive ``.dtype`` attribute lookup. * `#13368 <https://github.com/numpy/numpy/pull/13368>`__: ENH: Use AVX for float32 implementation of np.sin & np.cos * `#13605 <https://github.com/numpy/numpy/pull/13605>`__: DEP: Deprecate silent ignoring of bad data in fromfile/fromstring -* `#13610 <https://github.com/numpy/numpy/pull/13610>`__: ENH: Always produce a consistent shape in the result of `argwhere` +* `#13610 <https://github.com/numpy/numpy/pull/13610>`__: ENH: Always produce a consistent shape in the result of ``argwhere`` * `#13673 <https://github.com/numpy/numpy/pull/13673>`__: DOC: array(obj, dtype=dt) can downcast * `#13698 <https://github.com/numpy/numpy/pull/13698>`__: DOC: Document ma.filled behavior with non-scalar fill_value * `#13710 <https://github.com/numpy/numpy/pull/13710>`__: DOC: Add note to irfft-like functions about the default sizes @@ -144,6 +144,7 @@ A total of 406 pull requests were merged for this release. * `#13766 <https://github.com/numpy/numpy/pull/13766>`__: MAINT: Update NEP template. * `#13794 <https://github.com/numpy/numpy/pull/13794>`__: ENH: random: Add the multivariate hypergeometric distribution. * `#13799 <https://github.com/numpy/numpy/pull/13799>`__: DOC: Fix unrendered links +* `#13802 <https://github.com/numpy/numpy/pull/13802>`__: BUG: Fixed maximum relative error reporting in assert_allclose * `#13812 <https://github.com/numpy/numpy/pull/13812>`__: MAINT: Rewrite Floyd algorithm * `#13825 <https://github.com/numpy/numpy/pull/13825>`__: DOC: Add missing macros to C-API documentation * `#13829 <https://github.com/numpy/numpy/pull/13829>`__: ENH: Add axis argument to random.permutation and random.shuffle @@ -162,6 +163,7 @@ A total of 406 pull requests were merged for this release. * `#13892 <https://github.com/numpy/numpy/pull/13892>`__: DOC : Refactor Array API documentation -- Array Structure and... * `#13895 <https://github.com/numpy/numpy/pull/13895>`__: DOC: Fix typo in "make_mask" documentation * `#13896 <https://github.com/numpy/numpy/pull/13896>`__: MAINT: Delete unused _aliased_types.py +* `#13899 <https://github.com/numpy/numpy/pull/13899>`__: MAINT: Change the type of error raised in set_printoptions * `#13901 <https://github.com/numpy/numpy/pull/13901>`__: BLD: Remove Trusty dist in Travis CI build * `#13907 <https://github.com/numpy/numpy/pull/13907>`__: BUG: Handle weird bytestrings in dtype() * `#13908 <https://github.com/numpy/numpy/pull/13908>`__: ENH: use towncrier to build the release note @@ -174,7 +176,7 @@ A total of 406 pull requests were merged for this release. * `#13926 <https://github.com/numpy/numpy/pull/13926>`__: DOC: Remove explicit .next method calls with built-in next function... * `#13928 <https://github.com/numpy/numpy/pull/13928>`__: DOC: Don't override MaskedArray.view documentation with the one... * `#13930 <https://github.com/numpy/numpy/pull/13930>`__: BUG: Fix incorrect GIL release in array.nonzero -* `#13935 <https://github.com/numpy/numpy/pull/13935>`__: MAINT: Warn if `_add_newdocs.py` is used to add docstrings to... +* `#13935 <https://github.com/numpy/numpy/pull/13935>`__: MAINT: Warn if ``_add_newdocs.py`` is used to add docstrings to... * `#13943 <https://github.com/numpy/numpy/pull/13943>`__: MAINT: Revert #13876, "MAINT,BUG,DOC: Fix errors in _add_newdocs" * `#13944 <https://github.com/numpy/numpy/pull/13944>`__: MAINT,BUG,DOC: Fix errors in _add_newdocs * `#13945 <https://github.com/numpy/numpy/pull/13945>`__: DOC, MAINT: emphasize random API changes, remove Generator.randint @@ -184,7 +186,7 @@ A total of 406 pull requests were merged for this release. * `#13950 <https://github.com/numpy/numpy/pull/13950>`__: Fixing failure on Python 2.7 on Windows 7 * `#13952 <https://github.com/numpy/numpy/pull/13952>`__: Fix a typo related to the range of indices * `#13959 <https://github.com/numpy/numpy/pull/13959>`__: DOC: add space between words across lines -* `#13964 <https://github.com/numpy/numpy/pull/13964>`__: BUG, DOC: add new recfunctions to `__all__` +* `#13964 <https://github.com/numpy/numpy/pull/13964>`__: BUG, DOC: add new recfunctions to ``__all__`` * `#13967 <https://github.com/numpy/numpy/pull/13967>`__: DOC: Change (old) range() to np.arange() * `#13968 <https://github.com/numpy/numpy/pull/13968>`__: DOC: improve np.sort docstring * `#13970 <https://github.com/numpy/numpy/pull/13970>`__: DOC: spellcheck numpy/doc/broadcasting.py @@ -226,7 +228,7 @@ A total of 406 pull requests were merged for this release. * `#14076 <https://github.com/numpy/numpy/pull/14076>`__: TST: Add 3.8-dev to travisCI testing. * `#14085 <https://github.com/numpy/numpy/pull/14085>`__: DOC: Add blank line above doctest for intersect1d * `#14086 <https://github.com/numpy/numpy/pull/14086>`__: ENH: Propose standard policy for dropping support of old Python... -* `#14089 <https://github.com/numpy/numpy/pull/14089>`__: DOC: Use `pip install .` where possible instead of calling setup.py +* `#14089 <https://github.com/numpy/numpy/pull/14089>`__: DOC: Use ``pip install .`` where possible instead of calling setup.py * `#14091 <https://github.com/numpy/numpy/pull/14091>`__: MAINT: adjustments to test_ufunc_noncontigous * `#14092 <https://github.com/numpy/numpy/pull/14092>`__: MAINT: Improve NEP template * `#14096 <https://github.com/numpy/numpy/pull/14096>`__: DOC: fix documentation of i and j for tri. @@ -236,6 +238,7 @@ A total of 406 pull requests were merged for this release. * `#14106 <https://github.com/numpy/numpy/pull/14106>`__: MAINT: remove duplicate variable assignments * `#14108 <https://github.com/numpy/numpy/pull/14108>`__: BUG: initialize variable that is passed by pointer * `#14110 <https://github.com/numpy/numpy/pull/14110>`__: DOC: fix typo in c-api/array.rst doc +* `#14115 <https://github.com/numpy/numpy/pull/14115>`__: DOC: fix markup of news fragment readme * `#14121 <https://github.com/numpy/numpy/pull/14121>`__: BUG: Add gcd/lcm definitions to npy_math.h * `#14122 <https://github.com/numpy/numpy/pull/14122>`__: MAINT: Mark umath accuracy test xfail. * `#14124 <https://github.com/numpy/numpy/pull/14124>`__: MAINT: Use equality instead of identity check with literal @@ -249,36 +252,39 @@ A total of 406 pull requests were merged for this release. * `#14153 <https://github.com/numpy/numpy/pull/14153>`__: TST: Allow fuss in testing strided/non-strided exp/log loops * `#14170 <https://github.com/numpy/numpy/pull/14170>`__: NEP: Proposal for __duckarray__ protocol * `#14171 <https://github.com/numpy/numpy/pull/14171>`__: BUG: Make advanced indexing result on read-only subclass writeable +* `#14174 <https://github.com/numpy/numpy/pull/14174>`__: BUG: Check for existence of ``fromstr`` which used in ``fromstr_next_element`` * `#14178 <https://github.com/numpy/numpy/pull/14178>`__: TST: Clean up of test_pocketfft.py * `#14181 <https://github.com/numpy/numpy/pull/14181>`__: DEP: Deprecate np.alen +* `#14183 <https://github.com/numpy/numpy/pull/14183>`__: DOC: Fix misleading ``allclose`` docstring for ``equal_nan`` * `#14185 <https://github.com/numpy/numpy/pull/14185>`__: MAINT: Workaround for Intel compiler bug leading to failing test -* `#14190 <https://github.com/numpy/numpy/pull/14190>`__: DOC: Fix hermitian argument docs in `svd` +* `#14190 <https://github.com/numpy/numpy/pull/14190>`__: DOC: Fix hermitian argument docs in ``svd`` * `#14195 <https://github.com/numpy/numpy/pull/14195>`__: MAINT: Fix a docstring typo. -* `#14196 <https://github.com/numpy/numpy/pull/14196>`__: DOC: Fix links in `/.github/CONTRIBUTING.md`. +* `#14196 <https://github.com/numpy/numpy/pull/14196>`__: DOC: Fix links in ``/.github/CONTRIBUTING.md``. * `#14197 <https://github.com/numpy/numpy/pull/14197>`__: ENH: Multivariate normal speedups * `#14203 <https://github.com/numpy/numpy/pull/14203>`__: MAINT: Improve mismatch message of np.testing.assert_array_equal * `#14204 <https://github.com/numpy/numpy/pull/14204>`__: DOC,MAINT: Move towncrier files and fixup categories * `#14207 <https://github.com/numpy/numpy/pull/14207>`__: BUG: Fixed default BitGenerator name * `#14209 <https://github.com/numpy/numpy/pull/14209>`__: BUG: Fix uint-overflow if padding with linear_ramp and negative... * `#14216 <https://github.com/numpy/numpy/pull/14216>`__: ENH: Enable huge pages in all Linux builds -* `#14217 <https://github.com/numpy/numpy/pull/14217>`__: BUG: Fix leak in the f2py-generated module init and `PyMem_Del`... +* `#14217 <https://github.com/numpy/numpy/pull/14217>`__: BUG: Fix leak in the f2py-generated module init and ``PyMem_Del``... * `#14219 <https://github.com/numpy/numpy/pull/14219>`__: DOC: new nan_to_num keywords are from 1.17 onwards * `#14223 <https://github.com/numpy/numpy/pull/14223>`__: TST: Add tests for deprecated C functions (PyArray_As1D, PyArray_As1D) -* `#14224 <https://github.com/numpy/numpy/pull/14224>`__: DOC: mention `take_along_axis` in `choose` +* `#14224 <https://github.com/numpy/numpy/pull/14224>`__: DOC: mention ``take_along_axis`` in ``choose`` * `#14227 <https://github.com/numpy/numpy/pull/14227>`__: ENH: Parse complex number from string * `#14231 <https://github.com/numpy/numpy/pull/14231>`__: DOC: update or remove outdated sourceforge links * `#14234 <https://github.com/numpy/numpy/pull/14234>`__: MAINT: Better error message for norm * `#14235 <https://github.com/numpy/numpy/pull/14235>`__: DOC: add backlinks to numpy.org * `#14240 <https://github.com/numpy/numpy/pull/14240>`__: BUG: Don't fail when lexsorting some empty arrays. -* `#14241 <https://github.com/numpy/numpy/pull/14241>`__: BUG: Fix segfault in `random.permutation(x)` when x is a string. +* `#14241 <https://github.com/numpy/numpy/pull/14241>`__: BUG: Fix segfault in ``random.permutation(x)`` when x is a string. * `#14245 <https://github.com/numpy/numpy/pull/14245>`__: Doc: fix a typo in NEP21 * `#14249 <https://github.com/numpy/numpy/pull/14249>`__: DOC: set status of NEP 28 (website redesign) to Accepted * `#14250 <https://github.com/numpy/numpy/pull/14250>`__: BLD: MAINT: change default behavior of build flag appending. * `#14252 <https://github.com/numpy/numpy/pull/14252>`__: BUG: Fixes StopIteration error from 'np.genfromtext' for empty... -* `#14255 <https://github.com/numpy/numpy/pull/14255>`__: BUG: fix inconsistent axes ordering for axis in function `unique` +* `#14255 <https://github.com/numpy/numpy/pull/14255>`__: BUG: fix inconsistent axes ordering for axis in function ``unique`` * `#14256 <https://github.com/numpy/numpy/pull/14256>`__: DEP: Deprecate load/dump functions in favour of pickle methods * `#14257 <https://github.com/numpy/numpy/pull/14257>`__: MAINT: Update NEP-30 * `#14259 <https://github.com/numpy/numpy/pull/14259>`__: DEP: Deprecate arrayprint formatting functions +* `#14263 <https://github.com/numpy/numpy/pull/14263>`__: DOC: Make Py3K docs C code snippets RST literal blocks * `#14266 <https://github.com/numpy/numpy/pull/14266>`__: DOC: remove scipy.org from the breadcrumb formattiong * `#14270 <https://github.com/numpy/numpy/pull/14270>`__: BUG: Fix formatting error in exception message * `#14272 <https://github.com/numpy/numpy/pull/14272>`__: DOC: Address typos in dispatch docs @@ -293,9 +299,9 @@ A total of 406 pull requests were merged for this release. * `#14313 <https://github.com/numpy/numpy/pull/14313>`__: DOC: Clarify rules about broadcasting when empty arrays are involved. * `#14321 <https://github.com/numpy/numpy/pull/14321>`__: TST, MAINT: bump to OpenBLAS 0.3.7 stable * `#14325 <https://github.com/numpy/numpy/pull/14325>`__: DEP: numpy.testing.rand -* `#14335 <https://github.com/numpy/numpy/pull/14335>`__: DEP: Deprecate class `SafeEval` +* `#14335 <https://github.com/numpy/numpy/pull/14335>`__: DEP: Deprecate class ``SafeEval`` * `#14341 <https://github.com/numpy/numpy/pull/14341>`__: BUG: revert detecting and raising error on ragged arrays -* `#14342 <https://github.com/numpy/numpy/pull/14342>`__: DOC: Improve documentation of `isscalar`. +* `#14342 <https://github.com/numpy/numpy/pull/14342>`__: DOC: Improve documentation of ``isscalar``. * `#14349 <https://github.com/numpy/numpy/pull/14349>`__: MAINT: Fix bloated mismatch error percentage in array comparisons. * `#14351 <https://github.com/numpy/numpy/pull/14351>`__: DOC: Fix a minor typo in dispatch documentation. * `#14352 <https://github.com/numpy/numpy/pull/14352>`__: MAINT: Remove redundant deprecation checks @@ -344,7 +350,7 @@ A total of 406 pull requests were merged for this release. * `#14475 <https://github.com/numpy/numpy/pull/14475>`__: DOC: add timedelta64 signature * `#14477 <https://github.com/numpy/numpy/pull/14477>`__: MAINT: Extract raising of MemoryError to a helper function * `#14483 <https://github.com/numpy/numpy/pull/14483>`__: BUG,MAINT: Some fixes and minor cleanup based on clang analysis -* `#14484 <https://github.com/numpy/numpy/pull/14484>`__: MAINT: Add `NPY_UNUSED` and `const` qualified suggested by clang +* `#14484 <https://github.com/numpy/numpy/pull/14484>`__: MAINT: Add ``NPY_UNUSED`` and ``const`` qualified suggested by clang * `#14485 <https://github.com/numpy/numpy/pull/14485>`__: MAINT: Silence integer comparison build warnings in assert statements * `#14486 <https://github.com/numpy/numpy/pull/14486>`__: MAINT: distutils: Add newline at the end of printed warnings. * `#14490 <https://github.com/numpy/numpy/pull/14490>`__: BUG: random: Revert gh-14458 and refix gh-14557. @@ -383,7 +389,7 @@ A total of 406 pull requests were merged for this release. * `#14567 <https://github.com/numpy/numpy/pull/14567>`__: DEP: remove deprecated (and private) numpy.testing submodules. * `#14568 <https://github.com/numpy/numpy/pull/14568>`__: BLD, DOC: fix gh-14518, add release note * `#14570 <https://github.com/numpy/numpy/pull/14570>`__: BUG: importing build_src breaks setuptools monkeypatch for msvc14 -* `#14572 <https://github.com/numpy/numpy/pull/14572>`__: DOC: Note runtests.py `-- -s` method to use pytests `-s` +* `#14572 <https://github.com/numpy/numpy/pull/14572>`__: DOC: Note runtests.py ``-- -s`` method to use pytests ``-s`` * `#14573 <https://github.com/numpy/numpy/pull/14573>`__: DOC: update submodule docstrings, remove info.py files * `#14576 <https://github.com/numpy/numpy/pull/14576>`__: DOC: Document the NPY_SCALARKIND values as C variables. * `#14582 <https://github.com/numpy/numpy/pull/14582>`__: MAINT: Bump pytest from 5.1.2 to 5.1.3 @@ -405,30 +411,31 @@ A total of 406 pull requests were merged for this release. * `#14614 <https://github.com/numpy/numpy/pull/14614>`__: MAINT: Bump pytest from 5.1.3 to 5.2.0 * `#14615 <https://github.com/numpy/numpy/pull/14615>`__: MAINT: Add "MAINT" tag to dependabot commit msg * `#14616 <https://github.com/numpy/numpy/pull/14616>`__: DOC: Updated sphinx directive formatting -* `#14620 <https://github.com/numpy/numpy/pull/14620>`__: DEP: Finish deprecation of non-integer `num` in linspace +* `#14620 <https://github.com/numpy/numpy/pull/14620>`__: DEP: Finish deprecation of non-integer ``num`` in linspace * `#14621 <https://github.com/numpy/numpy/pull/14621>`__: DOC: s/OR/AND/ in np.logical_and docstring * `#14623 <https://github.com/numpy/numpy/pull/14623>`__: DOC: misleading np.sinc() documentation * `#14629 <https://github.com/numpy/numpy/pull/14629>`__: DOC: clarify residual in np.polyfit * `#14630 <https://github.com/numpy/numpy/pull/14630>`__: BUILD: change to build_src --verbose-cfg, runtests.py --debug-info * `#14631 <https://github.com/numpy/numpy/pull/14631>`__: BUG: always free clean_sep -* `#14634 <https://github.com/numpy/numpy/pull/14634>`__: DOC: Create `class Extension` docstring and add it to documentation. -* `#14636 <https://github.com/numpy/numpy/pull/14636>`__: DOC: add `printoptions` as a context manager to `set_printoptions` +* `#14634 <https://github.com/numpy/numpy/pull/14634>`__: DOC: Create ``class Extension`` docstring and add it to documentation. +* `#14636 <https://github.com/numpy/numpy/pull/14636>`__: DOC: add ``printoptions`` as a context manager to ``set_printoptions`` * `#14639 <https://github.com/numpy/numpy/pull/14639>`__: DOC: Fix typo in NEP 29 * `#14643 <https://github.com/numpy/numpy/pull/14643>`__: MAINT: Use scalar math power function directly * `#14649 <https://github.com/numpy/numpy/pull/14649>`__: DOC: Add IPython to dependencies needed to build docs. * `#14652 <https://github.com/numpy/numpy/pull/14652>`__: MAINT: Bump pytest-cov from 2.7.1 to 2.8.1 * `#14653 <https://github.com/numpy/numpy/pull/14653>`__: MAINT: Bump pytest from 5.2.0 to 5.2.1 * `#14654 <https://github.com/numpy/numpy/pull/14654>`__: MAINT: Bump pytz from 2019.2 to 2019.3 -* `#14656 <https://github.com/numpy/numpy/pull/14656>`__: MAINT: Use `extract_unit` throughout datetime +* `#14656 <https://github.com/numpy/numpy/pull/14656>`__: MAINT: Use ``extract_unit`` throughout datetime * `#14657 <https://github.com/numpy/numpy/pull/14657>`__: BUG: fix fromfile behavior when reading sub-array dtypes * `#14662 <https://github.com/numpy/numpy/pull/14662>`__: BUG: random: Use correct length when axis is given to shuffle. * `#14669 <https://github.com/numpy/numpy/pull/14669>`__: BUG: Do not rely on undefined behaviour to cast from float to... * `#14674 <https://github.com/numpy/numpy/pull/14674>`__: NEP: add default-dtype-object-deprecation nep 34 * `#14681 <https://github.com/numpy/numpy/pull/14681>`__: MAINT: Remove unused boolean negative/subtract loops -* `#14682 <https://github.com/numpy/numpy/pull/14682>`__: DEP: ufunc `out` argument must be a tuple for multiple outputs -* `#14693 <https://github.com/numpy/numpy/pull/14693>`__: BUG: Fix `np.einsum` errors on Power9 Linux and z/Linux +* `#14682 <https://github.com/numpy/numpy/pull/14682>`__: DEP: ufunc ``out`` argument must be a tuple for multiple outputs +* `#14693 <https://github.com/numpy/numpy/pull/14693>`__: BUG: Fix ``np.einsum`` errors on Power9 Linux and z/Linux * `#14696 <https://github.com/numpy/numpy/pull/14696>`__: DOC: Note release notes process changes on devdocs start page * `#14699 <https://github.com/numpy/numpy/pull/14699>`__: Doc warnings +* `#14703 <https://github.com/numpy/numpy/pull/14703>`__: TST: Adding CI stages, with one initial job to the Travis CI * `#14705 <https://github.com/numpy/numpy/pull/14705>`__: DOC: Switch Markdown link to RST in NEP 29 * `#14709 <https://github.com/numpy/numpy/pull/14709>`__: TST: Divide Azure CI Pipelines into stages. * `#14710 <https://github.com/numpy/numpy/pull/14710>`__: DEP: Finish the out kwarg deprecation for ufunc calls @@ -526,7 +533,7 @@ A total of 406 pull requests were merged for this release. * `#15058 <https://github.com/numpy/numpy/pull/15058>`__: API, DOC: change names to multivariate_hypergeometric, improve docs * `#15059 <https://github.com/numpy/numpy/pull/15059>`__: REL: Prepare for NumPy 1.18.0 release. * `#15109 <https://github.com/numpy/numpy/pull/15109>`__: TST: Check requires_memory immediately before the test -* `#15111 <https://github.com/numpy/numpy/pull/15111>`__: ENH: Add support to sort timedelta64 `NaT` to end of the array +* `#15111 <https://github.com/numpy/numpy/pull/15111>`__: ENH: Add support to sort timedelta64 ``NaT`` to end of the array * `#15112 <https://github.com/numpy/numpy/pull/15112>`__: MAINT: follow-up cleanup for blas64 PR * `#15113 <https://github.com/numpy/numpy/pull/15113>`__: ENH: f2py: add --f2cmap option for specifying the name of .f2py_f2cmap * `#15114 <https://github.com/numpy/numpy/pull/15114>`__: ENH: add support for ILP64 OpenBLAS (without symbol suffix) diff --git a/doc/changelog/1.19.0-changelog.rst b/doc/changelog/1.19.0-changelog.rst index bd743832a..bde002499 100644 --- a/doc/changelog/1.19.0-changelog.rst +++ b/doc/changelog/1.19.0-changelog.rst @@ -136,25 +136,28 @@ names contributed a patch for the first time. Pull requests merged ==================== -A total of 452 pull requests were merged for this release. +A total of 488 pull requests were merged for this release. * `#8255 <https://github.com/numpy/numpy/pull/8255>`__: ENH: add identity kwarg to frompyfunc +* `#10600 <https://github.com/numpy/numpy/pull/10600>`__: DOC: Do not complain about contiguity when mutating ``ndarray.shape`` * `#12646 <https://github.com/numpy/numpy/pull/12646>`__: TST: check exception details in refguide_check.py * `#13421 <https://github.com/numpy/numpy/pull/13421>`__: ENH: improve runtime detection of CPU features * `#14326 <https://github.com/numpy/numpy/pull/14326>`__: TST: Add assert_array_equal test for big integer arrays. * `#14376 <https://github.com/numpy/numpy/pull/14376>`__: MAINT: Remove unnecessary 'from __future__ import ...' statements * `#14530 <https://github.com/numpy/numpy/pull/14530>`__: MAINT: Fix typos and copy edit NEP-0030. * `#14546 <https://github.com/numpy/numpy/pull/14546>`__: DOC: NumPy for absolute beginners tutorial -* `#14715 <https://github.com/numpy/numpy/pull/14715>`__: NEP: Proposal for array creation dispatching with `__array_function__` +* `#14715 <https://github.com/numpy/numpy/pull/14715>`__: NEP: Proposal for array creation dispatching with ``__array_function__`` * `#14867 <https://github.com/numpy/numpy/pull/14867>`__: ENH: Use AVX-512F for np.maximum and np.minimum * `#14924 <https://github.com/numpy/numpy/pull/14924>`__: BUG: Fix numpy.random.dirichlet returns NaN for small 'alpha'... -* `#14933 <https://github.com/numpy/numpy/pull/14933>`__: API: Use `ResultType` in `PyArray_ConvertToCommonType` +* `#14933 <https://github.com/numpy/numpy/pull/14933>`__: API: Use ``ResultType`` in ``PyArray_ConvertToCommonType`` +* `#14940 <https://github.com/numpy/numpy/pull/14940>`__: BUG: pickle the content of a scalar containing objects, not the... * `#14942 <https://github.com/numpy/numpy/pull/14942>`__: MAINT,API: ignore and NULL fasttake/fastputmask ArrFuncs slots * `#14981 <https://github.com/numpy/numpy/pull/14981>`__: BUG: Make ``ediff1d`` kwarg casting consistent * `#14988 <https://github.com/numpy/numpy/pull/14988>`__: DOC: linalg: Include information about scipy.linalg. * `#14995 <https://github.com/numpy/numpy/pull/14995>`__: BUG: Use ``__array__`` during dimension discovery * `#15011 <https://github.com/numpy/numpy/pull/15011>`__: MAINT: cleanup compat.py3k.py * `#15022 <https://github.com/numpy/numpy/pull/15022>`__: ENH: f2py: improve error messages +* `#15024 <https://github.com/numpy/numpy/pull/15024>`__: DOC: clarify documentation for transpose() * `#15028 <https://github.com/numpy/numpy/pull/15028>`__: [DOC] LaTeX: fix preamble (closes #15026) * `#15035 <https://github.com/numpy/numpy/pull/15035>`__: BUG: add endfunction, endsubroutine to valid fortran end words * `#15040 <https://github.com/numpy/numpy/pull/15040>`__: TST: Add test for object method (and general unary) loops @@ -165,6 +168,7 @@ A total of 452 pull requests were merged for this release. * `#15052 <https://github.com/numpy/numpy/pull/15052>`__: MAINT: follow-up cleanup for blas64 PR * `#15054 <https://github.com/numpy/numpy/pull/15054>`__: DOC: add docstrings to refguide-check * `#15066 <https://github.com/numpy/numpy/pull/15066>`__: Revert "DEP: issue deprecation warning when creating ragged array... +* `#15068 <https://github.com/numpy/numpy/pull/15068>`__: ENH: Add support to sort timedelta64 ``NaT`` to end of the array * `#15069 <https://github.com/numpy/numpy/pull/15069>`__: ENH: add support for ILP64 OpenBLAS (without symbol suffix) * `#15070 <https://github.com/numpy/numpy/pull/15070>`__: DOC: correct version for NaT sort * `#15072 <https://github.com/numpy/numpy/pull/15072>`__: TST: Check requires_memory immediately before the test @@ -201,6 +205,7 @@ A total of 452 pull requests were merged for this release. * `#15187 <https://github.com/numpy/numpy/pull/15187>`__: MAINT: unskip test on win32 * `#15189 <https://github.com/numpy/numpy/pull/15189>`__: ENH: Add property-based tests using Hypothesis * `#15194 <https://github.com/numpy/numpy/pull/15194>`__: BUG: test, fix for c++ compilation +* `#15195 <https://github.com/numpy/numpy/pull/15195>`__: MAINT: refactoring in np.core.records * `#15196 <https://github.com/numpy/numpy/pull/15196>`__: DOC: Adding instructions for building documentation to developer... * `#15197 <https://github.com/numpy/numpy/pull/15197>`__: DOC: NEP 37: A dispatch protocol for NumPy-like modules * `#15203 <https://github.com/numpy/numpy/pull/15203>`__: MAINT: Do not use private Python function in testing @@ -215,6 +220,8 @@ A total of 452 pull requests were merged for this release. * `#15227 <https://github.com/numpy/numpy/pull/15227>`__: DOC: typo in release.rst * `#15228 <https://github.com/numpy/numpy/pull/15228>`__: NEP: universal SIMD NEP 38 * `#15229 <https://github.com/numpy/numpy/pull/15229>`__: MAINT: Remove unused int_asbuffer +* `#15230 <https://github.com/numpy/numpy/pull/15230>`__: BUG: do not emit warnings for np.sign, np.equal when using nan +* `#15231 <https://github.com/numpy/numpy/pull/15231>`__: MAINT: Remove Python2 specific C module setup [part2] * `#15232 <https://github.com/numpy/numpy/pull/15232>`__: MAINT: Cleaning up PY_MAJOR_VERSION/PY_VERSION_HEX * `#15233 <https://github.com/numpy/numpy/pull/15233>`__: MAINT: Clean up more PY_VERSION_HEX * `#15236 <https://github.com/numpy/numpy/pull/15236>`__: MAINT: Remove implicit inheritance from object class @@ -224,14 +231,14 @@ A total of 452 pull requests were merged for this release. * `#15241 <https://github.com/numpy/numpy/pull/15241>`__: MAINT: Remove references to non-existent sys.exc_clear() * `#15242 <https://github.com/numpy/numpy/pull/15242>`__: DOC: Update HOWTO_RELEASE.rst * `#15248 <https://github.com/numpy/numpy/pull/15248>`__: MAINT: cleanup use of sys.exc_info -* `#15249 <https://github.com/numpy/numpy/pull/15249>`__: MAINT: Eliminate some calls to `eval` +* `#15249 <https://github.com/numpy/numpy/pull/15249>`__: MAINT: Eliminate some calls to ``eval`` * `#15251 <https://github.com/numpy/numpy/pull/15251>`__: MAINT: Improve const-correctness of shapes and strides * `#15253 <https://github.com/numpy/numpy/pull/15253>`__: DOC: clarify the effect of None parameters passed to ndarray.view * `#15254 <https://github.com/numpy/numpy/pull/15254>`__: MAINT: Improve const-correctness of string arguments * `#15255 <https://github.com/numpy/numpy/pull/15255>`__: MAINT: Delete numpy.distutils.compat * `#15256 <https://github.com/numpy/numpy/pull/15256>`__: MAINT: Implement keyword-only arguments as syntax * `#15260 <https://github.com/numpy/numpy/pull/15260>`__: MAINT: Remove FIXME comments introduced in the previous commit -* `#15261 <https://github.com/numpy/numpy/pull/15261>`__: MAINT: Work with unicode strings in `dtype('i8,i8')` +* `#15261 <https://github.com/numpy/numpy/pull/15261>`__: MAINT: Work with unicode strings in ``dtype('i8,i8')`` * `#15262 <https://github.com/numpy/numpy/pull/15262>`__: BUG: Use PyDict_GetItemWithError() instead of PyDict_GetItem() * `#15263 <https://github.com/numpy/numpy/pull/15263>`__: MAINT: Remove python2 array_{get,set}slice * `#15264 <https://github.com/numpy/numpy/pull/15264>`__: DOC: Add some missing functions in the list of available ufuncs. @@ -248,8 +255,9 @@ A total of 452 pull requests were merged for this release. * `#15280 <https://github.com/numpy/numpy/pull/15280>`__: BENCH: Add basic benchmarks for take and putmask * `#15281 <https://github.com/numpy/numpy/pull/15281>`__: MAINT: Cleanup most PY3K #ifdef guards * `#15282 <https://github.com/numpy/numpy/pull/15282>`__: DOC: BLD: add empty release notes for 1.19.0 to fix doc build... +* `#15283 <https://github.com/numpy/numpy/pull/15283>`__: MAINT: Cleanup more NPY_PY3K * `#15284 <https://github.com/numpy/numpy/pull/15284>`__: MAINT: Use a simpler return convention for internal functions -* `#15285 <https://github.com/numpy/numpy/pull/15285>`__: MAINT: Simplify np.int_ inheritance +* `#15285 <https://github.com/numpy/numpy/pull/15285>`__: MAINT: Simplify ``np.int_`` inheritance * `#15286 <https://github.com/numpy/numpy/pull/15286>`__: DOC" Update np.full docstring. * `#15287 <https://github.com/numpy/numpy/pull/15287>`__: MAINT: Express PyArray_DescrAlignConverter in terms of _convert_from_any * `#15288 <https://github.com/numpy/numpy/pull/15288>`__: MAINT: Push down declarations in _convert_from_* @@ -261,7 +269,7 @@ A total of 452 pull requests were merged for this release. * `#15304 <https://github.com/numpy/numpy/pull/15304>`__: MAINT: Remove NPY_PY3K constant * `#15305 <https://github.com/numpy/numpy/pull/15305>`__: MAINT: Remove sys.version checks in tests * `#15307 <https://github.com/numpy/numpy/pull/15307>`__: MAINT: cleanup sys.version dependant code -* `#15310 <https://github.com/numpy/numpy/pull/15310>`__: MAINT: Ensure `_convert_from_*` functions set errors +* `#15310 <https://github.com/numpy/numpy/pull/15310>`__: MAINT: Ensure ``_convert_from_*`` functions set errors * `#15312 <https://github.com/numpy/numpy/pull/15312>`__: MAINT: Avoid escaping unicode in error messages * `#15315 <https://github.com/numpy/numpy/pull/15315>`__: MAINT: Change file extension of ma README to rst. * `#15319 <https://github.com/numpy/numpy/pull/15319>`__: BUG: fix NameError in clip nan propagation tests @@ -271,22 +279,25 @@ A total of 452 pull requests were merged for this release. * `#15329 <https://github.com/numpy/numpy/pull/15329>`__: TST: move _no_tracing to testing._private, remove testing.support * `#15333 <https://github.com/numpy/numpy/pull/15333>`__: BUG: Add some missing C error handling * `#15335 <https://github.com/numpy/numpy/pull/15335>`__: MAINT: Remove sys.version checks -* `#15336 <https://github.com/numpy/numpy/pull/15336>`__: DEP: Deprecate `->f->fastclip` at registration time +* `#15336 <https://github.com/numpy/numpy/pull/15336>`__: DEP: Deprecate ``->f->fastclip`` at registration time * `#15338 <https://github.com/numpy/numpy/pull/15338>`__: DOC: document site.cfg.example * `#15350 <https://github.com/numpy/numpy/pull/15350>`__: MAINT: Fix mistype in histogramdd docstring * `#15351 <https://github.com/numpy/numpy/pull/15351>`__: DOC, BLD: reword release note, upgrade sphinx version * `#15353 <https://github.com/numpy/numpy/pull/15353>`__: MAINT: Remove unnecessary calls to PyArray_DATA from binomial... * `#15354 <https://github.com/numpy/numpy/pull/15354>`__: MAINT: Bump pytest from 5.3.2 to 5.3.3 +* `#15355 <https://github.com/numpy/numpy/pull/15355>`__: MAINT: Const qualify UFunc inner loops * `#15358 <https://github.com/numpy/numpy/pull/15358>`__: MAINT: Remove six * `#15361 <https://github.com/numpy/numpy/pull/15361>`__: MAINT: Revise imports from collections.abc module * `#15362 <https://github.com/numpy/numpy/pull/15362>`__: MAINT: remove internal functions required to handle Python2/3... * `#15364 <https://github.com/numpy/numpy/pull/15364>`__: MAINT: Remove other uses of six module * `#15366 <https://github.com/numpy/numpy/pull/15366>`__: MAINT: resolve pyflake F403 'from module import *' used +* `#15367 <https://github.com/numpy/numpy/pull/15367>`__: DOC: Fix Multithreaded Generation example docs * `#15368 <https://github.com/numpy/numpy/pull/15368>`__: MAINT: Update tox for supported Python versions * `#15369 <https://github.com/numpy/numpy/pull/15369>`__: MAINT: simd: Avoid signed comparison warning -* `#15370 <https://github.com/numpy/numpy/pull/15370>`__: DOC: Updating Chararry Buffer datatypes #15360 +* `#15370 <https://github.com/numpy/numpy/pull/15370>`__: DOC: Updating Chararry Buffer datatypes +* `#15373 <https://github.com/numpy/numpy/pull/15373>`__: MAINT: Remove sys.version checks * `#15374 <https://github.com/numpy/numpy/pull/15374>`__: TST: Simplify unicode test -* `#15375 <https://github.com/numpy/numpy/pull/15375>`__: MAINT: Use `with open` when possible +* `#15375 <https://github.com/numpy/numpy/pull/15375>`__: MAINT: Use ``with open`` when possible * `#15377 <https://github.com/numpy/numpy/pull/15377>`__: MAINT: Cleanup python2 references * `#15379 <https://github.com/numpy/numpy/pull/15379>`__: MAINT: Python2 Cleanups * `#15381 <https://github.com/numpy/numpy/pull/15381>`__: DEP: add PendingDeprecation to matlib.py funky namespace @@ -303,11 +314,14 @@ A total of 452 pull requests were merged for this release. * `#15407 <https://github.com/numpy/numpy/pull/15407>`__: MAINT: Replace basestring with str. * `#15408 <https://github.com/numpy/numpy/pull/15408>`__: ENH: Use AVX-512F for complex number arithmetic, absolute, square... * `#15414 <https://github.com/numpy/numpy/pull/15414>`__: MAINT: Remove Python2 workarounds +* `#15415 <https://github.com/numpy/numpy/pull/15415>`__: MAINT: Revert f2py Python 2.6 workaround * `#15417 <https://github.com/numpy/numpy/pull/15417>`__: MAINT: Cleanup references to python2 * `#15418 <https://github.com/numpy/numpy/pull/15418>`__: MAINT, DOC: Remove use of old Python __builtin__, now known as... * `#15421 <https://github.com/numpy/numpy/pull/15421>`__: ENH: Make use of ExitStack in npyio.py * `#15422 <https://github.com/numpy/numpy/pull/15422>`__: MAINT: Inline gentype_getreadbuf * `#15423 <https://github.com/numpy/numpy/pull/15423>`__: MAINT: Use f-strings for clarity. +* `#15425 <https://github.com/numpy/numpy/pull/15425>`__: MAINT: dir(numpy) returns duplicate "testing" +* `#15426 <https://github.com/numpy/numpy/pull/15426>`__: MAINT: Use the PyArrayScalar_VAL macro where possible * `#15427 <https://github.com/numpy/numpy/pull/15427>`__: DEP: Schedule unused C-API functions for removal/disabling * `#15428 <https://github.com/numpy/numpy/pull/15428>`__: DOC: Improve ndarray.ctypes example * `#15429 <https://github.com/numpy/numpy/pull/15429>`__: DOC: distutils: Add a docstring to show_config(). @@ -315,14 +329,15 @@ A total of 452 pull requests were merged for this release. * `#15434 <https://github.com/numpy/numpy/pull/15434>`__: MAINT: Updated polynomial to use fstrings * `#15435 <https://github.com/numpy/numpy/pull/15435>`__: DOC: Fix Incorrect document in Beginner Docs * `#15436 <https://github.com/numpy/numpy/pull/15436>`__: MAINT: Update core.py with fstrings (issue #15420) -* `#15439 <https://github.com/numpy/numpy/pull/15439>`__: DOC: fix docstrings so `python tools/refguide-check --rst <file>... +* `#15439 <https://github.com/numpy/numpy/pull/15439>`__: DOC: fix docstrings so ``python tools/refguide-check --rst <file>``... * `#15441 <https://github.com/numpy/numpy/pull/15441>`__: MAINT: Tidy macros in scalar_new * `#15444 <https://github.com/numpy/numpy/pull/15444>`__: MAINT: use 'yield from <expr>' for simple cases * `#15445 <https://github.com/numpy/numpy/pull/15445>`__: MAINT: Bump pytest from 5.3.3 to 5.3.4 * `#15446 <https://github.com/numpy/numpy/pull/15446>`__: BUG: Reject nonsense arguments to scalar constructors * `#15449 <https://github.com/numpy/numpy/pull/15449>`__: DOC: Update refguide_check note on how to skip code -* `#15451 <https://github.com/numpy/numpy/pull/15451>`__: MAINT: Simplify `np.object_.__new__` +* `#15451 <https://github.com/numpy/numpy/pull/15451>`__: MAINT: Simplify ``np.object_.__new__`` * `#15452 <https://github.com/numpy/numpy/pull/15452>`__: STY,MAINT: avoid 'multiple imports on one line' +* `#15463 <https://github.com/numpy/numpy/pull/15463>`__: ENH: expose ``bit_generator`` and random C-API to cython * `#15464 <https://github.com/numpy/numpy/pull/15464>`__: MAINT: Cleanup duplicate line in refguide_check * `#15465 <https://github.com/numpy/numpy/pull/15465>`__: MAINT: cleanup unused imports; avoid redefinition of imports * `#15468 <https://github.com/numpy/numpy/pull/15468>`__: BUG: Fix for SVD not always sorted with hermitian=True @@ -330,21 +345,22 @@ A total of 452 pull requests were merged for this release. * `#15474 <https://github.com/numpy/numpy/pull/15474>`__: MAINT: Eliminate messy _WORK macro * `#15476 <https://github.com/numpy/numpy/pull/15476>`__: update result of rng.random(3) to current rng output * `#15480 <https://github.com/numpy/numpy/pull/15480>`__: DOC: Correct get_state doc -* `#15482 <https://github.com/numpy/numpy/pull/15482>`__: MAINT: Use `.identifier = val` to fill type structs +* `#15482 <https://github.com/numpy/numpy/pull/15482>`__: MAINT: Use ``.identifier = val`` to fill type structs * `#15483 <https://github.com/numpy/numpy/pull/15483>`__: [DOC] Mention behaviour of np.squeeze with one element * `#15484 <https://github.com/numpy/numpy/pull/15484>`__: ENH: fixing generic error messages to be more specific in multiarray/descriptor.c * `#15487 <https://github.com/numpy/numpy/pull/15487>`__: BUG: Fixing result of np quantile edge case * `#15491 <https://github.com/numpy/numpy/pull/15491>`__: TST: mark the top 3 slowest tests to save ~10 seconds * `#15493 <https://github.com/numpy/numpy/pull/15493>`__: MAINT: Bump pytest from 5.3.4 to 5.3.5 * `#15500 <https://github.com/numpy/numpy/pull/15500>`__: MAINT: Use True/False instead of 1/0 in np.dtype.__reduce__ -* `#15503 <https://github.com/numpy/numpy/pull/15503>`__: MAINT: Do not allow `copyswap` and friends to fail silently +* `#15503 <https://github.com/numpy/numpy/pull/15503>`__: MAINT: Do not allow ``copyswap`` and friends to fail silently * `#15504 <https://github.com/numpy/numpy/pull/15504>`__: DOC: Remove duplicated code in true_divide docstring * `#15505 <https://github.com/numpy/numpy/pull/15505>`__: NEP 40: Informational NEP about current DTypes +* `#15506 <https://github.com/numpy/numpy/pull/15506>`__: NEP 41: First steps towards improved Datatype Support * `#15510 <https://github.com/numpy/numpy/pull/15510>`__: DOC: Update unique docstring example * `#15511 <https://github.com/numpy/numpy/pull/15511>`__: MAINT: Large overhead in some random functions * `#15516 <https://github.com/numpy/numpy/pull/15516>`__: TST: Fix missing output in refguide-check * `#15521 <https://github.com/numpy/numpy/pull/15521>`__: MAINT: Simplify arraydescr_richcompare -* `#15522 <https://github.com/numpy/numpy/pull/15522>`__: MAINT: Fix internal misuses of `NPY_TITLE_KEY` +* `#15522 <https://github.com/numpy/numpy/pull/15522>`__: MAINT: Fix internal misuses of ``NPY_TITLE_KEY`` * `#15524 <https://github.com/numpy/numpy/pull/15524>`__: DOC: Update instructions for building/archiving docs. * `#15526 <https://github.com/numpy/numpy/pull/15526>`__: BUG: Fix inline assembly that detects cpu features on x86(32bit) * `#15532 <https://github.com/numpy/numpy/pull/15532>`__: update doctests, small bugs and changes of repr @@ -354,13 +370,15 @@ A total of 452 pull requests were merged for this release. * `#15543 <https://github.com/numpy/numpy/pull/15543>`__: NEP: edit and move NEP 38 to accepted status * `#15547 <https://github.com/numpy/numpy/pull/15547>`__: MAINT: Refresh Doxyfile and modernize numpyfilter.py * `#15549 <https://github.com/numpy/numpy/pull/15549>`__: TST: Accuracy test float32 sin/cos/exp/log for AVX platforms -* `#15550 <https://github.com/numpy/numpy/pull/15550>`__: DOC: Improve the `numpy.linalg.eig` docstring. +* `#15550 <https://github.com/numpy/numpy/pull/15550>`__: DOC: Improve the ``numpy.linalg.eig`` docstring. +* `#15553 <https://github.com/numpy/numpy/pull/15553>`__: BUG: Added missing error check in ``ndarray.__contains__`` * `#15554 <https://github.com/numpy/numpy/pull/15554>`__: NEP 44 - Restructuring the NumPy Documentation * `#15556 <https://github.com/numpy/numpy/pull/15556>`__: TST: (Travis CI) Use full python3-dbg path for virtual env creation * `#15560 <https://github.com/numpy/numpy/pull/15560>`__: BUG, DOC: restore missing import * `#15566 <https://github.com/numpy/numpy/pull/15566>`__: DOC: Removing bad practices from quick start + some PEP8 * `#15574 <https://github.com/numpy/numpy/pull/15574>`__: TST: Do not create symbolic link named gfortran. * `#15575 <https://github.com/numpy/numpy/pull/15575>`__: DOC: Document caveat in random.uniform +* `#15577 <https://github.com/numpy/numpy/pull/15577>`__: TST: Test division by zero both with scalar and with array * `#15579 <https://github.com/numpy/numpy/pull/15579>`__: DOC: numpy.clip is equivalent to minimum(..., maximum(...)) * `#15582 <https://github.com/numpy/numpy/pull/15582>`__: MAINT: Bump cython from 0.29.14 to 0.29.15 * `#15583 <https://github.com/numpy/numpy/pull/15583>`__: MAINT: Bump hypothesis from 5.3.0 to 5.5.4 @@ -369,6 +387,7 @@ A total of 452 pull requests were merged for this release. * `#15600 <https://github.com/numpy/numpy/pull/15600>`__: TST: use manylinux2010 docker instead of ubuntu * `#15610 <https://github.com/numpy/numpy/pull/15610>`__: TST: mask DeprecationWarning in xfailed test * `#15612 <https://github.com/numpy/numpy/pull/15612>`__: BUG: Fix bug in AVX-512F np.maximum and np.minimum +* `#15614 <https://github.com/numpy/numpy/pull/15614>`__: DOC: Reword docstring for assert_equal * `#15615 <https://github.com/numpy/numpy/pull/15615>`__: BUG: Remove check requiring natural alignment of float/double... * `#15616 <https://github.com/numpy/numpy/pull/15616>`__: DOC: Add missing imports, definitions and dummy file * `#15619 <https://github.com/numpy/numpy/pull/15619>`__: DOC: Fix documentation for apply_along_axis @@ -376,9 +395,10 @@ A total of 452 pull requests were merged for this release. * `#15631 <https://github.com/numpy/numpy/pull/15631>`__: MAINT: Pull identical line out of conditional. * `#15633 <https://github.com/numpy/numpy/pull/15633>`__: DOC: remove broken link in f2py tutorial * `#15639 <https://github.com/numpy/numpy/pull/15639>`__: BLD: update openblas download to new location, use manylinux2010-base +* `#15644 <https://github.com/numpy/numpy/pull/15644>`__: DOC: Update to clarify actual behavior real_if_(all elements)_close * `#15648 <https://github.com/numpy/numpy/pull/15648>`__: MAINT: AVX512 implementation with intrinsic for float64 input... * `#15653 <https://github.com/numpy/numpy/pull/15653>`__: BLD: update OpenBLAS to pre-0.3.9 version -* `#15662 <https://github.com/numpy/numpy/pull/15662>`__: DOC: Refactor `np.polynomial` docs using `automodule` +* `#15662 <https://github.com/numpy/numpy/pull/15662>`__: DOC: Refactor ``np.polynomial`` docs using ``automodule`` * `#15665 <https://github.com/numpy/numpy/pull/15665>`__: BUG: fix doctest exception messages * `#15672 <https://github.com/numpy/numpy/pull/15672>`__: MAINT: Added comment pointing FIXME to relevant PR. * `#15673 <https://github.com/numpy/numpy/pull/15673>`__: DOC: Make extension module wording more clear @@ -386,16 +406,18 @@ A total of 452 pull requests were merged for this release. * `#15680 <https://github.com/numpy/numpy/pull/15680>`__: DOC: Improve Benchmark README with environment setup and more... * `#15682 <https://github.com/numpy/numpy/pull/15682>`__: MAINT: Bump hypothesis from 5.5.4 to 5.6.0 * `#15683 <https://github.com/numpy/numpy/pull/15683>`__: NEP: move NEP 44 to accepted status +* `#15685 <https://github.com/numpy/numpy/pull/15685>`__: ENH: Add ``subok`` parameter to np.copy function (cf. #6509) * `#15694 <https://github.com/numpy/numpy/pull/15694>`__: DOC: Fix indexing docs to pass refguide * `#15695 <https://github.com/numpy/numpy/pull/15695>`__: MAINT: Test during import to detect bugs with Accelerate(MacOS)... * `#15696 <https://github.com/numpy/numpy/pull/15696>`__: MAINT: Add a fast path to var for complex input * `#15701 <https://github.com/numpy/numpy/pull/15701>`__: MAINT: Convert shebang from python to python3 (#15687) * `#15702 <https://github.com/numpy/numpy/pull/15702>`__: MAINT: replace optparse with argparse for 'doc' and 'tools' scripts * `#15703 <https://github.com/numpy/numpy/pull/15703>`__: DOC: Fix quickstart doc to pass refguide +* `#15705 <https://github.com/numpy/numpy/pull/15705>`__: DOC: Change list to tuple in example description. * `#15706 <https://github.com/numpy/numpy/pull/15706>`__: MAINT: Fixing typos in f2py comments and code. * `#15710 <https://github.com/numpy/numpy/pull/15710>`__: DOC: fix SVD tutorial to pass refguide * `#15714 <https://github.com/numpy/numpy/pull/15714>`__: MAINT: use list-based APIs to call subprocesses -* `#15715 <https://github.com/numpy/numpy/pull/15715>`__: ENH: update numpy.linalg.multi_dot to accept an `out` argument +* `#15715 <https://github.com/numpy/numpy/pull/15715>`__: ENH: update numpy.linalg.multi_dot to accept an ``out`` argument * `#15716 <https://github.com/numpy/numpy/pull/15716>`__: TST: always use 'python -mpip' not 'pip' * `#15717 <https://github.com/numpy/numpy/pull/15717>`__: DOC: update datetime reference to pass refguide * `#15718 <https://github.com/numpy/numpy/pull/15718>`__: DOC: Fix coremath.rst to fix refguide_check @@ -403,6 +425,7 @@ A total of 452 pull requests were merged for this release. * `#15723 <https://github.com/numpy/numpy/pull/15723>`__: BUG: fix logic error when nm fails on 32-bit * `#15724 <https://github.com/numpy/numpy/pull/15724>`__: TST: Remove nose from the test_requirements.txt file. * `#15733 <https://github.com/numpy/numpy/pull/15733>`__: DOC: Allow NEPs to link to python, numpy, scipy, and matplotlib... +* `#15735 <https://github.com/numpy/numpy/pull/15735>`__: DOC: LICENSE 2019 -> 2020 * `#15736 <https://github.com/numpy/numpy/pull/15736>`__: BUG: Guarantee array is in valid state after memory error occurs... * `#15738 <https://github.com/numpy/numpy/pull/15738>`__: MAINT: Remove non-native byte order from _var check. * `#15740 <https://github.com/numpy/numpy/pull/15740>`__: MAINT: Add better error handling in linalg.norm for vectors and... @@ -418,28 +441,30 @@ A total of 452 pull requests were merged for this release. * `#15769 <https://github.com/numpy/numpy/pull/15769>`__: ENH: Allow toggling madvise hugepage and fix default * `#15771 <https://github.com/numpy/numpy/pull/15771>`__: DOC: Fix runtests example in developer docs * `#15773 <https://github.com/numpy/numpy/pull/15773>`__: DEP: Make issubdtype consistent for types and dtypes -* `#15774 <https://github.com/numpy/numpy/pull/15774>`__: MAINT: remove useless `global` statements +* `#15774 <https://github.com/numpy/numpy/pull/15774>`__: MAINT: remove useless ``global`` statements * `#15778 <https://github.com/numpy/numpy/pull/15778>`__: BLD: Add requirements.txt file for building docs * `#15781 <https://github.com/numpy/numpy/pull/15781>`__: BUG: don't add 'public' or 'private' if the other one exists -* `#15784 <https://github.com/numpy/numpy/pull/15784>`__: ENH: Use TypeError in `np.array` for python consistency +* `#15784 <https://github.com/numpy/numpy/pull/15784>`__: ENH: Use TypeError in ``np.array`` for python consistency * `#15794 <https://github.com/numpy/numpy/pull/15794>`__: BUG: Add basic __format__ for masked element to fix incorrect... * `#15797 <https://github.com/numpy/numpy/pull/15797>`__: TST: Add unit test for out=None of np.einsum * `#15799 <https://github.com/numpy/numpy/pull/15799>`__: MAINT: Cleanups to np.insert and np.delete * `#15800 <https://github.com/numpy/numpy/pull/15800>`__: BUG: Add error-checking versions of strided casts. -* `#15802 <https://github.com/numpy/numpy/pull/15802>`__: DEP: Make `np.insert` and `np.delete` on 0d arrays with an axis... -* `#15803 <https://github.com/numpy/numpy/pull/15803>`__: DOC: correct possible list lengths for `extobj` in ufunc calls +* `#15802 <https://github.com/numpy/numpy/pull/15802>`__: DEP: Make ``np.insert`` and ``np.delete`` on 0d arrays with an axis... +* `#15803 <https://github.com/numpy/numpy/pull/15803>`__: DOC: correct possible list lengths for ``extobj`` in ufunc calls * `#15804 <https://github.com/numpy/numpy/pull/15804>`__: DEP: Make np.delete on out-of-bounds indices an error -* `#15805 <https://github.com/numpy/numpy/pull/15805>`__: DEP: Forbid passing non-integral index arrays to `insert` and... +* `#15805 <https://github.com/numpy/numpy/pull/15805>`__: DEP: Forbid passing non-integral index arrays to ``insert`` and... * `#15806 <https://github.com/numpy/numpy/pull/15806>`__: TST: Parametrize sort test * `#15809 <https://github.com/numpy/numpy/pull/15809>`__: TST: switch PyPy job with CPython * `#15812 <https://github.com/numpy/numpy/pull/15812>`__: TST: Remove code that is not supposed to warn out of warning... * `#15815 <https://github.com/numpy/numpy/pull/15815>`__: DEP: Do not cast boolean indices to integers in np.delete * `#15816 <https://github.com/numpy/numpy/pull/15816>`__: MAINT: simplify code that assumes str/unicode and int/long are... +* `#15827 <https://github.com/numpy/numpy/pull/15827>`__: BUG: Break on all errors when performing strided casts. * `#15830 <https://github.com/numpy/numpy/pull/15830>`__: MAINT: pathlib and hashlib are in stdlib in Python 3.5+ -* `#15832 <https://github.com/numpy/numpy/pull/15832>`__: ENH: improved error message `IndexError: too many indices for... +* `#15832 <https://github.com/numpy/numpy/pull/15832>`__: ENH: improved error message ``IndexError: too many indices for``... +* `#15834 <https://github.com/numpy/numpy/pull/15834>`__: NEP: Add paragraph to NEP 41 about no array-object use and fix... * `#15836 <https://github.com/numpy/numpy/pull/15836>`__: BUG: Fix IndexError for illegal axis in np.mean * `#15839 <https://github.com/numpy/numpy/pull/15839>`__: DOC: Minor fix to _hist_bin_fd documentation -* `#15840 <https://github.com/numpy/numpy/pull/15840>`__: BUG,DEP: Make `scalar.__round__()` behave like pythons round +* `#15840 <https://github.com/numpy/numpy/pull/15840>`__: BUG,DEP: Make ``scalar.__round__()`` behave like pythons round * `#15843 <https://github.com/numpy/numpy/pull/15843>`__: DOC: First steps towards docs restructuring (NEP 44) * `#15848 <https://github.com/numpy/numpy/pull/15848>`__: DOC, TST: enable refguide_check in circleci * `#15850 <https://github.com/numpy/numpy/pull/15850>`__: DOC: fix typo in C-API reference @@ -447,8 +472,9 @@ A total of 452 pull requests were merged for this release. * `#15866 <https://github.com/numpy/numpy/pull/15866>`__: MAINT: Bump cython from 0.29.15 to 0.29.16 * `#15867 <https://github.com/numpy/numpy/pull/15867>`__: DEP: Deprecate ndarray.tostring() * `#15868 <https://github.com/numpy/numpy/pull/15868>`__: TST: use draft OpenBLAS build +* `#15870 <https://github.com/numpy/numpy/pull/15870>`__: ENH: Add keepdims argument to count_nonzero * `#15872 <https://github.com/numpy/numpy/pull/15872>`__: BUG: Fix eigh and cholesky methods of numpy.random.multivariate_normal -* `#15876 <https://github.com/numpy/numpy/pull/15876>`__: BUG: Check that `pvals` is 1D in `_generator.multinomial`. +* `#15876 <https://github.com/numpy/numpy/pull/15876>`__: BUG: Check that ``pvals`` is 1D in ``_generator.multinomial``. * `#15877 <https://github.com/numpy/numpy/pull/15877>`__: DOC: Add missing signature from nditer docstring * `#15881 <https://github.com/numpy/numpy/pull/15881>`__: BUG: Fix empty_like to respect shape=() * `#15882 <https://github.com/numpy/numpy/pull/15882>`__: BUG: Do not ignore empty tuple of strides in ndarray.__new__ @@ -456,29 +482,34 @@ A total of 452 pull requests were merged for this release. * `#15884 <https://github.com/numpy/numpy/pull/15884>`__: BUG: Setting a 0d array's strides to themselves should be legal * `#15885 <https://github.com/numpy/numpy/pull/15885>`__: BUG: Respect itershape=() in nditer * `#15887 <https://github.com/numpy/numpy/pull/15887>`__: MAINT: Clean-up 'next = __next__' used for Python 2 compatibility +* `#15891 <https://github.com/numpy/numpy/pull/15891>`__: DOC: Clarify docs on mixed advanced indexing and slicing * `#15893 <https://github.com/numpy/numpy/pull/15893>`__: TST: Run test_large_zip in a child process * `#15894 <https://github.com/numpy/numpy/pull/15894>`__: DOC: Add missing doc of numpy.ma.apply_over_axes in API list. * `#15899 <https://github.com/numpy/numpy/pull/15899>`__: DOC: Improve record module documentation * `#15901 <https://github.com/numpy/numpy/pull/15901>`__: DOC: Fixed order of items and link to mailing list in dev docs... * `#15903 <https://github.com/numpy/numpy/pull/15903>`__: BLD: report clang version on macOS -* `#15904 <https://github.com/numpy/numpy/pull/15904>`__: MAINT: records: Remove private `format_parser._descr` attribute +* `#15904 <https://github.com/numpy/numpy/pull/15904>`__: MAINT: records: Remove private ``format_parser._descr`` attribute +* `#15907 <https://github.com/numpy/numpy/pull/15907>`__: DOC: Update documentation w.r.t. NPY_RELAXED_STRIDES_CHECKING * `#15914 <https://github.com/numpy/numpy/pull/15914>`__: BUG: random: Disallow p=0 in negative_binomial +* `#15920 <https://github.com/numpy/numpy/pull/15920>`__: DOC: Improve docstring for numpy.linalg.lstsq * `#15921 <https://github.com/numpy/numpy/pull/15921>`__: ENH: Use sysconfig instead of probing Makefile * `#15928 <https://github.com/numpy/numpy/pull/15928>`__: DOC: Update np.copy docstring to include ragged case * `#15931 <https://github.com/numpy/numpy/pull/15931>`__: DOC: Correct private function name to PyArray_AdaptFlexibleDType -* `#15936 <https://github.com/numpy/numpy/pull/15936>`__: MAINT: Fix capitalization in error message in `mtrand.pyx` +* `#15936 <https://github.com/numpy/numpy/pull/15936>`__: MAINT: Fix capitalization in error message in ``mtrand.pyx`` +* `#15938 <https://github.com/numpy/numpy/pull/15938>`__: BUG: Add _LARGE_FILES to def_macros[] when platform is AIX. * `#15939 <https://github.com/numpy/numpy/pull/15939>`__: DOC: Update np.rollaxis docstring * `#15949 <https://github.com/numpy/numpy/pull/15949>`__: BUG: fix AttributeError on accessing object in nested MaskedArray. -* `#15951 <https://github.com/numpy/numpy/pull/15951>`__: BUG: Alpha parameter must be 1D in `generator.dirichlet` +* `#15951 <https://github.com/numpy/numpy/pull/15951>`__: BUG: Alpha parameter must be 1D in ``generator.dirichlet`` * `#15953 <https://github.com/numpy/numpy/pull/15953>`__: NEP: minor maintenance, update filename and fix a cross-reference * `#15964 <https://github.com/numpy/numpy/pull/15964>`__: MAINT: Bump hypothesis from 5.8.0 to 5.8.3 * `#15967 <https://github.com/numpy/numpy/pull/15967>`__: TST: Add slow_pypy support * `#15968 <https://github.com/numpy/numpy/pull/15968>`__: DOC: Added note to angle function docstring about angle(0) being... * `#15982 <https://github.com/numpy/numpy/pull/15982>`__: MAINT/BUG: Cleanup and minor fixes to conform_reduce_result -* `#15985 <https://github.com/numpy/numpy/pull/15985>`__: BUG: Avoid duplication in stack trace of `linspace(a, b, num=1.5)` -* `#15988 <https://github.com/numpy/numpy/pull/15988>`__: BUG: Fix inf and NaN-warnings in half float `nextafter` +* `#15985 <https://github.com/numpy/numpy/pull/15985>`__: BUG: Avoid duplication in stack trace of ``linspace(a, b, num=1.5)`` +* `#15988 <https://github.com/numpy/numpy/pull/15988>`__: BUG: Fix inf and NaN-warnings in half float ``nextafter`` * `#15989 <https://github.com/numpy/numpy/pull/15989>`__: MAINT: Remove 0d check for PyArray_ISONESEGMENT * `#15990 <https://github.com/numpy/numpy/pull/15990>`__: DEV: Pass additional runtests.py args to ASV +* `#15991 <https://github.com/numpy/numpy/pull/15991>`__: BUG: max/min of a masked array dtype fix * `#15993 <https://github.com/numpy/numpy/pull/15993>`__: DOC: Fix method documentation of function sort in MaskedArray * `#16000 <https://github.com/numpy/numpy/pull/16000>`__: NEP: Improve Value Based Casting paragraph in NEP 40 * `#16001 <https://github.com/numpy/numpy/pull/16001>`__: DOC: add note on flatten ordering in matlab page @@ -496,6 +527,8 @@ A total of 452 pull requests were merged for this release. * `#16038 <https://github.com/numpy/numpy/pull/16038>`__: MAINT,TST: Move _repr_latex tests to test_printing. * `#16041 <https://github.com/numpy/numpy/pull/16041>`__: BUG: missing 'f' prefix for fstring * `#16042 <https://github.com/numpy/numpy/pull/16042>`__: ENH: Fix exception causes in build_ext.py +* `#16043 <https://github.com/numpy/numpy/pull/16043>`__: DOC: Add converters example to the loadtxt docstring +* `#16051 <https://github.com/numpy/numpy/pull/16051>`__: DOC: Add missing bracket * `#16053 <https://github.com/numpy/numpy/pull/16053>`__: DOC: Small typo fixes to NEP 40. * `#16054 <https://github.com/numpy/numpy/pull/16054>`__: DOC, BLD: update release howto and walkthrough for ananconda.org... * `#16061 <https://github.com/numpy/numpy/pull/16061>`__: ENH: Chained exceptions in linalg.py and polyutils.py @@ -508,6 +541,7 @@ A total of 452 pull requests were merged for this release. * `#16077 <https://github.com/numpy/numpy/pull/16077>`__: BLD: fix path to libgfortran on macOS * `#16078 <https://github.com/numpy/numpy/pull/16078>`__: DOC: Add axis to random module "new or different" docs * `#16079 <https://github.com/numpy/numpy/pull/16079>`__: DOC,BLD: Limit timeit iterations in random docs. +* `#16080 <https://github.com/numpy/numpy/pull/16080>`__: BUG: numpy.einsum indexing arrays now accept numpy int type * `#16081 <https://github.com/numpy/numpy/pull/16081>`__: DOC: add note on type casting to numpy.left_shift(). * `#16083 <https://github.com/numpy/numpy/pull/16083>`__: DOC: improve development debugging doc * `#16084 <https://github.com/numpy/numpy/pull/16084>`__: DOC: tweak neps/scope.rst @@ -517,10 +551,12 @@ A total of 452 pull requests were merged for this release. * `#16097 <https://github.com/numpy/numpy/pull/16097>`__: MAINT, DOC: Improve grammar on a comment in the quickstart * `#16100 <https://github.com/numpy/numpy/pull/16100>`__: NEP 41: Accept NEP 41 and add DType<->scalar duplication paragraph * `#16101 <https://github.com/numpy/numpy/pull/16101>`__: BLD: put openblas library in local directory on windows +* `#16102 <https://github.com/numpy/numpy/pull/16102>`__: ENH: correct identity for logaddexp2 ufunc: -inf * `#16113 <https://github.com/numpy/numpy/pull/16113>`__: MAINT: Fix random.PCG64 signature * `#16119 <https://github.com/numpy/numpy/pull/16119>`__: DOC: Move misplaced news fragment for gh-13421 * `#16122 <https://github.com/numpy/numpy/pull/16122>`__: DOC: Fix links for NEP 40 in NEP 41 * `#16125 <https://github.com/numpy/numpy/pull/16125>`__: BUG: lib: Fix a problem with vectorize with default parameters. +* `#16128 <https://github.com/numpy/numpy/pull/16128>`__: ENH: Add equal_nan keyword argument to array_equal * `#16129 <https://github.com/numpy/numpy/pull/16129>`__: ENH: Better error message when ``bins`` has float value in ``histogramdd``. * `#16133 <https://github.com/numpy/numpy/pull/16133>`__: MAINT: Unify casting error creation (outside the iterator) * `#16141 <https://github.com/numpy/numpy/pull/16141>`__: BENCH: Default to building HEAD instead of master @@ -571,7 +607,7 @@ A total of 452 pull requests were merged for this release. * `#16344 <https://github.com/numpy/numpy/pull/16344>`__: BUG: Allow attaching documentation twice in add_docstring * `#16355 <https://github.com/numpy/numpy/pull/16355>`__: MAINT: Remove f-strings in setup.py. (gh-16346) * `#16356 <https://github.com/numpy/numpy/pull/16356>`__: BUG: Indentation for docstrings -* `#16358 <https://github.com/numpy/numpy/pull/16358>`__: BUG: Fix dtype leak in `PyArray_FromAny` error path +* `#16358 <https://github.com/numpy/numpy/pull/16358>`__: BUG: Fix dtype leak in ``PyArray_FromAny`` error path * `#16383 <https://github.com/numpy/numpy/pull/16383>`__: ENH: Optimize Cpu feature detect in X86, fix for GCC on macOS... * `#16398 <https://github.com/numpy/numpy/pull/16398>`__: MAINT: core: Use a raw string for the fromstring docstring. * `#16399 <https://github.com/numpy/numpy/pull/16399>`__: MAINT: Make ctypes optional on Windows diff --git a/doc/changelog/1.20.0-changelog.rst b/doc/changelog/1.20.0-changelog.rst index f0c2a2723..f06bd8a8d 100644 --- a/doc/changelog/1.20.0-changelog.rst +++ b/doc/changelog/1.20.0-changelog.rst @@ -193,41 +193,47 @@ names contributed a patch for the first time. Pull requests merged ==================== -A total of 684 pull requests were merged for this release. +A total of 716 pull requests were merged for this release. * `#13516 <https://github.com/numpy/numpy/pull/13516>`__: ENH: enable multi-platform SIMD compiler optimizations * `#14779 <https://github.com/numpy/numpy/pull/14779>`__: NEP 36 (fair play) * `#14882 <https://github.com/numpy/numpy/pull/14882>`__: DEP: Deprecate aliases of builtin types in python 3.7+ -* `#15037 <https://github.com/numpy/numpy/pull/15037>`__: BUG: `np.resize` negative shape and subclasses edge case fixes -* `#15121 <https://github.com/numpy/numpy/pull/15121>`__: ENH: random: Add the method `permuted` to Generator. +* `#15037 <https://github.com/numpy/numpy/pull/15037>`__: BUG: ``np.resize`` negative shape and subclasses edge case fixes +* `#15121 <https://github.com/numpy/numpy/pull/15121>`__: ENH: random: Add the method ``permuted`` to Generator. * `#15162 <https://github.com/numpy/numpy/pull/15162>`__: BUG,MAINT: Fix issues with non-reduce broadcasting axes * `#15471 <https://github.com/numpy/numpy/pull/15471>`__: BUG: Ensure PyArray_FromScalar always returns the requested dtype * `#15507 <https://github.com/numpy/numpy/pull/15507>`__: NEP 42: Technical decisions for new DTypes * `#15508 <https://github.com/numpy/numpy/pull/15508>`__: API: Create Preliminary DTypeMeta class and np.dtype subclasses +* `#15551 <https://github.com/numpy/numpy/pull/15551>`__: DOC: Simd optimization documentation * `#15604 <https://github.com/numpy/numpy/pull/15604>`__: MAINT: Avoid exception in NpzFile destructor if constructor raises... -* `#15666 <https://github.com/numpy/numpy/pull/15666>`__: ENH: Improved `__str__` for polynomials +* `#15666 <https://github.com/numpy/numpy/pull/15666>`__: ENH: Improved ``__str__`` for polynomials * `#15759 <https://github.com/numpy/numpy/pull/15759>`__: BUILD: Remove Accelerate support * `#15791 <https://github.com/numpy/numpy/pull/15791>`__: [DOC] Added tutorial about the numpy.ma module. * `#15852 <https://github.com/numpy/numpy/pull/15852>`__: ENH: Add where argument to np.mean * `#15886 <https://github.com/numpy/numpy/pull/15886>`__: DEP: Deprecate passing shape=None to mean shape=() * `#15900 <https://github.com/numpy/numpy/pull/15900>`__: DEP: Ensure indexing errors will be raised even on empty results * `#15997 <https://github.com/numpy/numpy/pull/15997>`__: ENH: improve printing of arrays with multi-line reprs +* `#16056 <https://github.com/numpy/numpy/pull/16056>`__: DEP: Deprecate inexact matches for mode, searchside * `#16130 <https://github.com/numpy/numpy/pull/16130>`__: DOC: Correct documentation of ``__array__`` when used as output... * `#16134 <https://github.com/numpy/numpy/pull/16134>`__: ENH: Implement concatenate dtype and casting keyword arguments -* `#16156 <https://github.com/numpy/numpy/pull/16156>`__: DEP: Deprecate `numpy.dual`. +* `#16156 <https://github.com/numpy/numpy/pull/16156>`__: DEP: Deprecate ``numpy.dual``. * `#16161 <https://github.com/numpy/numpy/pull/16161>`__: BUG: Potential fix for divmod(1.0, 0.0) to raise divbyzero and... * `#16167 <https://github.com/numpy/numpy/pull/16167>`__: DOC: Increase guidance and detail of np.polynomial docstring * `#16174 <https://github.com/numpy/numpy/pull/16174>`__: DOC: Add transition note to all lib/poly functions * `#16200 <https://github.com/numpy/numpy/pull/16200>`__: ENH: Rewrite of array-coercion to support new dtypes * `#16205 <https://github.com/numpy/numpy/pull/16205>`__: ENH: Add ``full_output`` argument to ``f2py.compile``. +* `#16207 <https://github.com/numpy/numpy/pull/16207>`__: DOC: Add PyArray_ContiguousFromObject C docs * `#16232 <https://github.com/numpy/numpy/pull/16232>`__: DEP: Deprecate ufunc.outer with matrix inputs +* `#16237 <https://github.com/numpy/numpy/pull/16237>`__: MAINT: precompute ``log(2.0 * M_PI)`` in ``random_loggam`` * `#16238 <https://github.com/numpy/numpy/pull/16238>`__: MAINT: Unify cached (C-level static) imports * `#16239 <https://github.com/numpy/numpy/pull/16239>`__: BUG,DOC: Allow attach docs twice but error if wrong * `#16242 <https://github.com/numpy/numpy/pull/16242>`__: BUG: Fix default fallback in genfromtxt * `#16247 <https://github.com/numpy/numpy/pull/16247>`__: ENH:Umath Replace raw SIMD of unary float point(32-64) with NPYV... * `#16248 <https://github.com/numpy/numpy/pull/16248>`__: MRG, ENH: added edge keyword argument to digitize +* `#16253 <https://github.com/numpy/numpy/pull/16253>`__: DOC: Clarify tiny/xmin in finfo and machar +* `#16254 <https://github.com/numpy/numpy/pull/16254>`__: MAINT: Chain exceptions in generate_umath.py * `#16257 <https://github.com/numpy/numpy/pull/16257>`__: DOC: Update the f2py section of the "Using Python as Glue" page. -* `#16260 <https://github.com/numpy/numpy/pull/16260>`__: DOC: Improve `rec.array` function documentation (#15853) +* `#16260 <https://github.com/numpy/numpy/pull/16260>`__: DOC: Improve ``rec.array`` function documentation * `#16266 <https://github.com/numpy/numpy/pull/16266>`__: ENH: include dt64/td64 isinstance checks in ``__init__.pxd`` * `#16267 <https://github.com/numpy/numpy/pull/16267>`__: DOC: Clarifications for np.std * `#16273 <https://github.com/numpy/numpy/pull/16273>`__: BUG: Order percentile monotonically @@ -238,6 +244,7 @@ A total of 684 pull requests were merged for this release. * `#16283 <https://github.com/numpy/numpy/pull/16283>`__: DOC: Add a note about performance of isclose compared to math.isclose * `#16284 <https://github.com/numpy/numpy/pull/16284>`__: MAINT: Clean up the implementation of quantile * `#16285 <https://github.com/numpy/numpy/pull/16285>`__: MAINT: Bump hypothesis from 5.12.0 to 5.14.0 +* `#16288 <https://github.com/numpy/numpy/pull/16288>`__: BLD: Avoid "visibility attribute not supported" warning * `#16291 <https://github.com/numpy/numpy/pull/16291>`__: DOC: Improve "tobytes" docstring. * `#16292 <https://github.com/numpy/numpy/pull/16292>`__: BUG: Fix tools/download-wheels.py. * `#16295 <https://github.com/numpy/numpy/pull/16295>`__: BUG: Require Python >= 3.6 in setup.py @@ -254,14 +261,17 @@ A total of 684 pull requests were merged for this release. * `#16318 <https://github.com/numpy/numpy/pull/16318>`__: MAINT: Stop Using PyEval_Call* and simplify some uses * `#16321 <https://github.com/numpy/numpy/pull/16321>`__: ENH: Improve the ARM cpu feature detection by parsing /proc/cpuinfo * `#16323 <https://github.com/numpy/numpy/pull/16323>`__: DOC: Reconstruct Testing Guideline. +* `#16327 <https://github.com/numpy/numpy/pull/16327>`__: BUG: Don't segfault on bad __len__ when assigning. * `#16329 <https://github.com/numpy/numpy/pull/16329>`__: MAINT: Cleanup 'tools/download-wheels.py' * `#16332 <https://github.com/numpy/numpy/pull/16332>`__: DOC: link np.interp to SciPy's interpolation functions (closes... * `#16333 <https://github.com/numpy/numpy/pull/16333>`__: DOC: Fix spelling typo - homogenous to homogeneous. (#16324) * `#16334 <https://github.com/numpy/numpy/pull/16334>`__: ENH: Use AVX-512 for np.isnan, np.infinite, np.isinf and np.signbit * `#16336 <https://github.com/numpy/numpy/pull/16336>`__: BUG: Fix refcounting in add_newdoc * `#16337 <https://github.com/numpy/numpy/pull/16337>`__: CI: Create a link for the circleCI artifact -* `#16348 <https://github.com/numpy/numpy/pull/16348>`__: BUG: Fix dtype leak in `PyArray_FromAny` error path +* `#16346 <https://github.com/numpy/numpy/pull/16346>`__: MAINT: Remove f-strings in setup.py. +* `#16348 <https://github.com/numpy/numpy/pull/16348>`__: BUG: Fix dtype leak in ``PyArray_FromAny`` error path * `#16349 <https://github.com/numpy/numpy/pull/16349>`__: BUG: Indentation for docstrings +* `#16350 <https://github.com/numpy/numpy/pull/16350>`__: BUG: Set readonly flag in array interface * `#16351 <https://github.com/numpy/numpy/pull/16351>`__: BUG: Fix small leaks in error path and ``empty_like`` with shape * `#16362 <https://github.com/numpy/numpy/pull/16362>`__: MAINT: Streamline download-wheels. * `#16365 <https://github.com/numpy/numpy/pull/16365>`__: DOC: Fix an obvious mistake in a message printed in doc/Makefile. @@ -301,6 +311,7 @@ A total of 684 pull requests were merged for this release. * `#16447 <https://github.com/numpy/numpy/pull/16447>`__: DOC: add a "make show" command to doc/Makefile * `#16450 <https://github.com/numpy/numpy/pull/16450>`__: DOC: Add a NEP link to all neps. * `#16452 <https://github.com/numpy/numpy/pull/16452>`__: DOC,ENH: extend error message when Accelerate is detected +* `#16454 <https://github.com/numpy/numpy/pull/16454>`__: TST: Add tests for PyArray_IntpConverter * `#16463 <https://github.com/numpy/numpy/pull/16463>`__: DOC: Improve assert_warns docstring with example * `#16464 <https://github.com/numpy/numpy/pull/16464>`__: MAINT: Bump hypothesis from 5.15.1 to 5.16.0 * `#16465 <https://github.com/numpy/numpy/pull/16465>`__: DOC: Fix development_workflow links @@ -308,7 +319,7 @@ A total of 684 pull requests were merged for this release. * `#16471 <https://github.com/numpy/numpy/pull/16471>`__: BLD: install mingw32 v7.3.0 for win32 * `#16472 <https://github.com/numpy/numpy/pull/16472>`__: DOC: Fixes for 18 broken links * `#16474 <https://github.com/numpy/numpy/pull/16474>`__: MAINT: use zip instead of range in piecewise -* `#16476 <https://github.com/numpy/numpy/pull/16476>`__: ENH: add `norm=forward,backward` to numpy.fft functions +* `#16476 <https://github.com/numpy/numpy/pull/16476>`__: ENH: add ``norm=forward,backward`` to numpy.fft functions * `#16482 <https://github.com/numpy/numpy/pull/16482>`__: SIMD: Optimize the performace of np.packbits in ARM-based machine. * `#16485 <https://github.com/numpy/numpy/pull/16485>`__: BUG: Fix result when a gufunc output broadcasts the inputs. * `#16500 <https://github.com/numpy/numpy/pull/16500>`__: DOC: Point Contributing page to new NEP 45 @@ -340,6 +351,7 @@ A total of 684 pull requests were merged for this release. * `#16574 <https://github.com/numpy/numpy/pull/16574>`__: MAINT: fix name of first parameter to dtype constructor in type... * `#16581 <https://github.com/numpy/numpy/pull/16581>`__: DOC: Added an example for np.transpose(4d_array) * `#16583 <https://github.com/numpy/numpy/pull/16583>`__: MAINT: changed np.generic arguments to positional-only +* `#16589 <https://github.com/numpy/numpy/pull/16589>`__: MAINT: Remove nickname from polynomial classes. * `#16590 <https://github.com/numpy/numpy/pull/16590>`__: DOC: Clarify dtype default for logspace and geomspace * `#16591 <https://github.com/numpy/numpy/pull/16591>`__: DOC: Disallow complex args in arange * `#16592 <https://github.com/numpy/numpy/pull/16592>`__: BUG: Raise TypeError for float->timedelta promotion @@ -364,8 +376,9 @@ A total of 684 pull requests were merged for this release. * `#16633 <https://github.com/numpy/numpy/pull/16633>`__: MAINT: lib: Some code clean up in loadtxt * `#16635 <https://github.com/numpy/numpy/pull/16635>`__: BENCH: remove obsolete goal_time param * `#16639 <https://github.com/numpy/numpy/pull/16639>`__: BUG: Fix uint->timedelta promotion to raise TypeError -* `#16642 <https://github.com/numpy/numpy/pull/16642>`__: MAINT: Replace `PyUString_GET_SIZE` with `PyUnicode_GetLength`. +* `#16642 <https://github.com/numpy/numpy/pull/16642>`__: MAINT: Replace ``PyUString_GET_SIZE`` with ``PyUnicode_GetLength``. * `#16643 <https://github.com/numpy/numpy/pull/16643>`__: REL: Fix outdated docs link +* `#16644 <https://github.com/numpy/numpy/pull/16644>`__: MAINT: Improve performance of np.full * `#16646 <https://github.com/numpy/numpy/pull/16646>`__: TST: add a static typing test for memoryviews as ArrayLikes * `#16647 <https://github.com/numpy/numpy/pull/16647>`__: ENH: Added annotations to 8 functions from np.core.fromnumeric * `#16648 <https://github.com/numpy/numpy/pull/16648>`__: REL: Update master after 1.19.0 release. @@ -377,14 +390,15 @@ A total of 684 pull requests were merged for this release. * `#16664 <https://github.com/numpy/numpy/pull/16664>`__: DOC: Add lib.format.open_memmap to autosummary. * `#16666 <https://github.com/numpy/numpy/pull/16666>`__: BUG: Fix bug in AVX complex absolute while processing array of... * `#16669 <https://github.com/numpy/numpy/pull/16669>`__: MAINT: remove blacklist/whitelist terms +* `#16671 <https://github.com/numpy/numpy/pull/16671>`__: DOC: Simplify and update git setup page * `#16674 <https://github.com/numpy/numpy/pull/16674>`__: TST: Add extra debugging information to CPU features detection * `#16675 <https://github.com/numpy/numpy/pull/16675>`__: ENH: Add support for file like objects to np.core.records.fromfile * `#16683 <https://github.com/numpy/numpy/pull/16683>`__: DOC: updated gcc minimum recommend version to build from source -* `#16684 <https://github.com/numpy/numpy/pull/16684>`__: MAINT: Allow `None` to be passed to certain `generic` subclasses +* `#16684 <https://github.com/numpy/numpy/pull/16684>`__: MAINT: Allow None to be passed to certain generic subclasses * `#16690 <https://github.com/numpy/numpy/pull/16690>`__: DOC: fixed docstring for descr_to_dtype -* `#16691 <https://github.com/numpy/numpy/pull/16691>`__: DOC: Remove "matrix" from `triu` docstring. +* `#16691 <https://github.com/numpy/numpy/pull/16691>`__: DOC: Remove "matrix" from ``triu`` docstring. * `#16696 <https://github.com/numpy/numpy/pull/16696>`__: MAINT: add py.typed sentinel to package manifest -* `#16699 <https://github.com/numpy/numpy/pull/16699>`__: MAINT: Fixup quantile tests to not use `np.float` +* `#16699 <https://github.com/numpy/numpy/pull/16699>`__: MAINT: Fixup quantile tests to not use ``np.float`` * `#16702 <https://github.com/numpy/numpy/pull/16702>`__: BLD: Add CPU entry for Emscripten / WebAssembly * `#16704 <https://github.com/numpy/numpy/pull/16704>`__: TST: Disable Python 3.9-dev testing. * `#16706 <https://github.com/numpy/numpy/pull/16706>`__: DOC: Add instruction about stable symlink @@ -393,11 +407,12 @@ A total of 684 pull requests were merged for this release. * `#16710 <https://github.com/numpy/numpy/pull/16710>`__: ENH, BLD: Add RPATH support for AIX * `#16718 <https://github.com/numpy/numpy/pull/16718>`__: DOC: fix typo * `#16720 <https://github.com/numpy/numpy/pull/16720>`__: BUG: Fix PyArray_SearchSorted signature. +* `#16723 <https://github.com/numpy/numpy/pull/16723>`__: NEP: Initial draft for NEP 43 for extensible ufuncs * `#16729 <https://github.com/numpy/numpy/pull/16729>`__: ENH: Add annotations to the last 8 functions in numpy.core.fromnumeric * `#16730 <https://github.com/numpy/numpy/pull/16730>`__: ENH: Use f90 compiler specified in f2py command line args for... * `#16731 <https://github.com/numpy/numpy/pull/16731>`__: DOC: reword random c-api introduction, cython is documented in... * `#16735 <https://github.com/numpy/numpy/pull/16735>`__: DOC: Tweak a sentence about broadcasting. -* `#16736 <https://github.com/numpy/numpy/pull/16736>`__: DOC: Prepend `ma.` to references in ``numpy.ma`` +* `#16736 <https://github.com/numpy/numpy/pull/16736>`__: DOC: Prepend ``ma.`` to references in ``numpy.ma`` * `#16738 <https://github.com/numpy/numpy/pull/16738>`__: DOC: Remove redundant word * `#16742 <https://github.com/numpy/numpy/pull/16742>`__: DOC: add unique() to See Also of repeat() * `#16743 <https://github.com/numpy/numpy/pull/16743>`__: DOC: add example to unique() and make connection to repeat() @@ -414,6 +429,8 @@ A total of 684 pull requests were merged for this release. * `#16770 <https://github.com/numpy/numpy/pull/16770>`__: MAINT: Remove unneeded call to PyUnicode_READY * `#16771 <https://github.com/numpy/numpy/pull/16771>`__: MAINT: Fix deprecated functions in scalarapi.c * `#16775 <https://github.com/numpy/numpy/pull/16775>`__: DOC: switch to logo with text +* `#16777 <https://github.com/numpy/numpy/pull/16777>`__: BUG: Added missing return after raising error in methods.c +* `#16778 <https://github.com/numpy/numpy/pull/16778>`__: NEP: Update NEP 42 to note the issue of circular references * `#16782 <https://github.com/numpy/numpy/pull/16782>`__: ENH, TST: Bring the NumPy C SIMD vectorization interface "NPYV"... * `#16786 <https://github.com/numpy/numpy/pull/16786>`__: BENCH: Add basic benchmarks for scalar indexing and assignment * `#16789 <https://github.com/numpy/numpy/pull/16789>`__: BUG: fix decode error when building and get rid of warn @@ -467,7 +484,8 @@ A total of 684 pull requests were merged for this release. * `#16886 <https://github.com/numpy/numpy/pull/16886>`__: DOC: Fix types including curly braces * `#16887 <https://github.com/numpy/numpy/pull/16887>`__: DOC: Remove the links for ``True`` and ``False`` * `#16888 <https://github.com/numpy/numpy/pull/16888>`__: ENH: Integrate the new CPU dispatcher with umath generator -* `#16894 <https://github.com/numpy/numpy/pull/16894>`__: DOC: Fix wrong markups in `arrays.dtypes` +* `#16890 <https://github.com/numpy/numpy/pull/16890>`__: TST, BUG: Re-raise MemoryError exception in test_large_zip's... +* `#16894 <https://github.com/numpy/numpy/pull/16894>`__: DOC: Fix wrong markups in ``arrays.dtypes`` * `#16896 <https://github.com/numpy/numpy/pull/16896>`__: DOC: Remove links for C codes * `#16897 <https://github.com/numpy/numpy/pull/16897>`__: DOC: Fix the declarations of C fuctions * `#16899 <https://github.com/numpy/numpy/pull/16899>`__: MNT: also use Py_SET_REFCNT instead of Py_REFCNT @@ -480,23 +498,24 @@ A total of 684 pull requests were merged for this release. * `#16919 <https://github.com/numpy/numpy/pull/16919>`__: DOC: Add ufunc docstring to generated docs. * `#16925 <https://github.com/numpy/numpy/pull/16925>`__: REL: Update master after 1.19.1 release. * `#16931 <https://github.com/numpy/numpy/pull/16931>`__: Revert "Merge pull request #16248 from alexrockhill/edge" +* `#16935 <https://github.com/numpy/numpy/pull/16935>`__: ENH: implement NEP-35's ``like=`` argument * `#16936 <https://github.com/numpy/numpy/pull/16936>`__: BUG: Fix memory leak of buffer-info cache due to relaxed strides * `#16938 <https://github.com/numpy/numpy/pull/16938>`__: ENH,API: Store exported buffer info on the array * `#16940 <https://github.com/numpy/numpy/pull/16940>`__: BLD: update OpenBLAS build * `#16941 <https://github.com/numpy/numpy/pull/16941>`__: BUG: Allow array-like types to be coerced as object array elements * `#16943 <https://github.com/numpy/numpy/pull/16943>`__: DEP: Deprecate size-one ragged array coercion * `#16944 <https://github.com/numpy/numpy/pull/16944>`__: Change the name of the folder "icons" to "logo". -* `#16949 <https://github.com/numpy/numpy/pull/16949>`__: ENH: enable colors for `runtests.py --ipython` +* `#16949 <https://github.com/numpy/numpy/pull/16949>`__: ENH: enable colors for ``runtests.py --ipython`` * `#16950 <https://github.com/numpy/numpy/pull/16950>`__: DOC: Clarify input to irfft/irfft2/irfftn * `#16952 <https://github.com/numpy/numpy/pull/16952>`__: MAINT: Bump hypothesis from 5.20.2 to 5.23.2 * `#16953 <https://github.com/numpy/numpy/pull/16953>`__: update numpy/lib/arraypad.py with appropriate chain exception * `#16957 <https://github.com/numpy/numpy/pull/16957>`__: MAINT: Use arm64 instead of aarch64 on travisCI. * `#16962 <https://github.com/numpy/numpy/pull/16962>`__: MAINT: Chain exception in ``distutils/fcompiler/environment.py``. -* `#16966 <https://github.com/numpy/numpy/pull/16966>`__: MAINT: Added the `order` parameter to `np.array()` +* `#16966 <https://github.com/numpy/numpy/pull/16966>`__: MAINT: Added the ``order`` parameter to ``np.array()`` * `#16969 <https://github.com/numpy/numpy/pull/16969>`__: ENH: Add Neon SIMD implementations for add, sub, mul, and div * `#16973 <https://github.com/numpy/numpy/pull/16973>`__: DOC: Fixed typo in lib/recfunctions.py * `#16974 <https://github.com/numpy/numpy/pull/16974>`__: TST: Add pypy win32 CI testing. -* `#16982 <https://github.com/numpy/numpy/pull/16982>`__: ENH: Increase the use of `Literal` types +* `#16982 <https://github.com/numpy/numpy/pull/16982>`__: ENH: Increase the use of ``Literal`` types * `#16986 <https://github.com/numpy/numpy/pull/16986>`__: ENH: Add NumPy declarations to be used by Cython 3.0+ * `#16988 <https://github.com/numpy/numpy/pull/16988>`__: DOC: Add the new NumPy logo to Sphinx pages * `#16991 <https://github.com/numpy/numpy/pull/16991>`__: MAINT: Bump hypothesis from 5.23.2 to 5.23.9 @@ -505,18 +524,24 @@ A total of 684 pull requests were merged for this release. * `#16996 <https://github.com/numpy/numpy/pull/16996>`__: DOC: Revise glossary page * `#17002 <https://github.com/numpy/numpy/pull/17002>`__: DOC: clip() allows arguments. * `#17009 <https://github.com/numpy/numpy/pull/17009>`__: NEP: Updated NEP-35 with keyword-only instruction +* `#17010 <https://github.com/numpy/numpy/pull/17010>`__: BUG: Raise correct errors in boolean indexing fast path * `#17013 <https://github.com/numpy/numpy/pull/17013>`__: MAINT: Simplify scalar power * `#17014 <https://github.com/numpy/numpy/pull/17014>`__: MAINT: Improve error handling in umathmodule setup +* `#17022 <https://github.com/numpy/numpy/pull/17022>`__: DOC: Fix non-matching pronoun. * `#17028 <https://github.com/numpy/numpy/pull/17028>`__: DOC: Disclaimer for FFT library * `#17029 <https://github.com/numpy/numpy/pull/17029>`__: MAINT: Add error return to all casting functionality and NpyIter * `#17033 <https://github.com/numpy/numpy/pull/17033>`__: BUG: fix a compile and a test warning -* `#17036 <https://github.com/numpy/numpy/pull/17036>`__: DOC: Clarify that `np.char` comparison functions always return... +* `#17036 <https://github.com/numpy/numpy/pull/17036>`__: DOC: Clarify that ``np.char`` comparison functions always return... * `#17039 <https://github.com/numpy/numpy/pull/17039>`__: DOC: Use a less ambiguous example for array_split * `#17041 <https://github.com/numpy/numpy/pull/17041>`__: MAINT: Bump hypothesis from 5.23.9 to 5.23.12 * `#17048 <https://github.com/numpy/numpy/pull/17048>`__: STY: core._internal style fixups * `#17050 <https://github.com/numpy/numpy/pull/17050>`__: MAINT: Remove _EXTRAFLAGS variable +* `#17050 <https://github.com/numpy/numpy/pull/17051>`__: MAINT: change ``for line in open()`` to ``with open() as f`` +* `#17052 <https://github.com/numpy/numpy/pull/17052>`__: MAINT: Delete obsolete conversion to list * `#17053 <https://github.com/numpy/numpy/pull/17053>`__: BUG: fix typo in polydiv that prevented promotion to poly1d +* `#17055 <https://github.com/numpy/numpy/pull/17055>`__: MAINT: Replace lambda function by list comprehension * `#17058 <https://github.com/numpy/numpy/pull/17058>`__: MAINT: Revert boolean casting back to elementwise comparisons... +* `#17059 <https://github.com/numpy/numpy/pull/17059>`__: BUG: fix pickling of arrays larger than 2GiB * `#17062 <https://github.com/numpy/numpy/pull/17062>`__: API, BUG: Raise error on complex input to i0 * `#17063 <https://github.com/numpy/numpy/pull/17063>`__: MAINT: Remove obsolete conversion to set * `#17067 <https://github.com/numpy/numpy/pull/17067>`__: DEP: lib: Remove the deprecated financial functions. @@ -530,7 +555,7 @@ A total of 684 pull requests were merged for this release. * `#17109 <https://github.com/numpy/numpy/pull/17109>`__: MAINT: Split einsum into multiple files * `#17112 <https://github.com/numpy/numpy/pull/17112>`__: BUG: Handle errors from the PyCapsule API * `#17115 <https://github.com/numpy/numpy/pull/17115>`__: DOC: Fix spacing in vectorize doc -* `#17116 <https://github.com/numpy/numpy/pull/17116>`__: API: Remove `np.ctypeslib.ctypes_load_library` +* `#17116 <https://github.com/numpy/numpy/pull/17116>`__: API: Remove ``np.ctypeslib.ctypes_load_library`` * `#17119 <https://github.com/numpy/numpy/pull/17119>`__: DOC: make spacing consistent in NEP 41 bullet points * `#17121 <https://github.com/numpy/numpy/pull/17121>`__: BUG: core: fix ilp64 blas dot/vdot/... for strides > int32 max * `#17123 <https://github.com/numpy/numpy/pull/17123>`__: ENH: allow running mypy through runtests.py @@ -542,13 +567,13 @@ A total of 684 pull requests were merged for this release. * `#17141 <https://github.com/numpy/numpy/pull/17141>`__: MAINT: Make arrayprint str and repr the ndarray defaults. * `#17142 <https://github.com/numpy/numpy/pull/17142>`__: DOC: NEP-42: Fix a few typos. * `#17143 <https://github.com/numpy/numpy/pull/17143>`__: MAINT: Change handling of the expired financial functions. -* `#17144 <https://github.com/numpy/numpy/pull/17144>`__: ENH: Add annotations to 3 functions in `np.core.function_base` +* `#17144 <https://github.com/numpy/numpy/pull/17144>`__: ENH: Add annotations to 3 functions in ``np.core.function_base`` * `#17145 <https://github.com/numpy/numpy/pull/17145>`__: MAINT, BUG: Replace uses of PyString_AsString. * `#17146 <https://github.com/numpy/numpy/pull/17146>`__: MAINT: ``Replace PyUString_*`` by ``PyUnicode_*`` equivalents. * `#17149 <https://github.com/numpy/numpy/pull/17149>`__: MAINT: Replace PyInt macros with their PyLong replacement * `#17150 <https://github.com/numpy/numpy/pull/17150>`__: ENH: Add support for the abstract scalars to cython code * `#17151 <https://github.com/numpy/numpy/pull/17151>`__: BUG: Fix incorrect cython definition of npy_cfloat -* `#17152 <https://github.com/numpy/numpy/pull/17152>`__: MAINT: Clean up some Npy_ vs Py_ macro usage +* `#17152 <https://github.com/numpy/numpy/pull/17152>`__: MAINT: Clean up some ``Npy_`` vs ``Py_`` macro usage * `#17154 <https://github.com/numpy/numpy/pull/17154>`__: DOC: Remove references to PyCObject * `#17159 <https://github.com/numpy/numpy/pull/17159>`__: DOC: Update numpy4matlab * `#17160 <https://github.com/numpy/numpy/pull/17160>`__: Clean up some more bytes vs unicode handling @@ -558,22 +583,23 @@ A total of 684 pull requests were merged for this release. * `#17167 <https://github.com/numpy/numpy/pull/17167>`__: BLD: Merge the npysort library into multiarray * `#17168 <https://github.com/numpy/numpy/pull/17168>`__: TST: Add tests mapping out the rules for metadata in promotion * `#17171 <https://github.com/numpy/numpy/pull/17171>`__: BUG: revert trim_zeros changes from gh-16911 -* `#17172 <https://github.com/numpy/numpy/pull/17172>`__: ENH: Make `np.complexfloating` generic w.r.t. `np.floating` +* `#17172 <https://github.com/numpy/numpy/pull/17172>`__: ENH: Make ``np.complexfloating`` generic w.r.t. ``np.floating`` * `#17176 <https://github.com/numpy/numpy/pull/17176>`__: MAINT/ENH: datetime: remove calls to PyUnicode_AsASCIIString,... -* `#17180 <https://github.com/numpy/numpy/pull/17180>`__: ENH: Added missing methods to `np.flatiter` +* `#17180 <https://github.com/numpy/numpy/pull/17180>`__: ENH: Added missing methods to ``np.flatiter`` * `#17181 <https://github.com/numpy/numpy/pull/17181>`__: DOC: Correct error in description of ndarray.base -* `#17182 <https://github.com/numpy/numpy/pull/17182>`__: DOC: Document `dtype.metadata` +* `#17182 <https://github.com/numpy/numpy/pull/17182>`__: DOC: Document ``dtype.metadata`` * `#17186 <https://github.com/numpy/numpy/pull/17186>`__: MAINT: Use utf8 strings in more of datetime -* `#17188 <https://github.com/numpy/numpy/pull/17188>`__: MAINT: Add placeholder stubs for `ndarray` and `generic` +* `#17188 <https://github.com/numpy/numpy/pull/17188>`__: MAINT: Add placeholder stubs for ``ndarray`` and ``generic`` * `#17191 <https://github.com/numpy/numpy/pull/17191>`__: MAINT: Bump hypothesis from 5.26.0 to 5.30.0 * `#17193 <https://github.com/numpy/numpy/pull/17193>`__: MAINT: Remove some callers of functions in numpy.compat * `#17195 <https://github.com/numpy/numpy/pull/17195>`__: ENH: Make the window functions exactly symmetric * `#17197 <https://github.com/numpy/numpy/pull/17197>`__: MAINT: Improve error handling in npy_cpu_init -* `#17199 <https://github.com/numpy/numpy/pull/17199>`__: DOC: Fix the documented signatures of four `ufunc` methods -* `#17201 <https://github.com/numpy/numpy/pull/17201>`__: MAINT: Make the `NPY_CPU_DISPATCH_CALL` macros expressions not... +* `#17199 <https://github.com/numpy/numpy/pull/17199>`__: DOC: Fix the documented signatures of four ``ufunc`` methods +* `#17201 <https://github.com/numpy/numpy/pull/17201>`__: MAINT: Make the ``NPY_CPU_DISPATCH_CALL`` macros expressions not... * `#17204 <https://github.com/numpy/numpy/pull/17204>`__: DOC: Fixed headings for tutorials so they appear at new theme... * `#17210 <https://github.com/numpy/numpy/pull/17210>`__: DOC: Canonical_urls -* `#17214 <https://github.com/numpy/numpy/pull/17214>`__: MAINT: Fix various issues with the `np.generic` annotations +* `#17214 <https://github.com/numpy/numpy/pull/17214>`__: MAINT: Fix various issues with the ``np.generic`` annotations +* `#17215 <https://github.com/numpy/numpy/pull/17215>`__: DOC: Use official MATLAB spelling in numpy-for-matlab-users.rst * `#17219 <https://github.com/numpy/numpy/pull/17219>`__: BLD: enabled negation of library choices in NPY_*_ORDER * `#17220 <https://github.com/numpy/numpy/pull/17220>`__: BUG, DOC: comment out metadata added via javascript * `#17222 <https://github.com/numpy/numpy/pull/17222>`__: MAINT, DOC: move informational files from numpy.doc.*.py to their... @@ -583,7 +609,9 @@ A total of 684 pull requests were merged for this release. * `#17233 <https://github.com/numpy/numpy/pull/17233>`__: DEP: Deprecated ndindex.ndincr * `#17235 <https://github.com/numpy/numpy/pull/17235>`__: MAINT: Remove old PY_VERSION_HEX and sys.version_info code * `#17237 <https://github.com/numpy/numpy/pull/17237>`__: BUG: Avoid using ``np.random`` in typing tests. +* `#17238 <https://github.com/numpy/numpy/pull/17238>`__: DOC: Use SPDX license expressions with correct license * `#17239 <https://github.com/numpy/numpy/pull/17239>`__: DOC: Fix link quick-start in old random API functions +* `#17240 <https://github.com/numpy/numpy/pull/17240>`__: MAINT: added exception chaining in shape_base.py * `#17241 <https://github.com/numpy/numpy/pull/17241>`__: MAINT: ``__array_interface__`` data address cannot be bytes * `#17242 <https://github.com/numpy/numpy/pull/17242>`__: MAINT: Run slow CI jobs earlier so builds finishes sooner * `#17247 <https://github.com/numpy/numpy/pull/17247>`__: ENH: Add tool to help speed up Travis CI @@ -595,9 +623,9 @@ A total of 684 pull requests were merged for this release. * `#17260 <https://github.com/numpy/numpy/pull/17260>`__: MAINT: Bump pydata-sphinx-theme from 0.3.2 to 0.4.0 * `#17263 <https://github.com/numpy/numpy/pull/17263>`__: DOC: add new glossary terms * `#17264 <https://github.com/numpy/numpy/pull/17264>`__: DOC: remove some glosssary terms -* `#17267 <https://github.com/numpy/numpy/pull/17267>`__: TST: Fix the path to `mypy.ini` in `runtests.py` +* `#17267 <https://github.com/numpy/numpy/pull/17267>`__: TST: Fix the path to ``mypy.ini`` in ``runtests.py`` * `#17268 <https://github.com/numpy/numpy/pull/17268>`__: BUG: sysconfig attributes/distutils issue -* `#17273 <https://github.com/numpy/numpy/pull/17273>`__: ENH: Annotate the arithmetic operations of `ndarray` and `generic` +* `#17273 <https://github.com/numpy/numpy/pull/17273>`__: ENH: Annotate the arithmetic operations of ``ndarray`` and ``generic`` * `#17278 <https://github.com/numpy/numpy/pull/17278>`__: MAINT: Merge together index page content into a single file * `#17279 <https://github.com/numpy/numpy/pull/17279>`__: DOC: Fix a typo in shape_base. * `#17284 <https://github.com/numpy/numpy/pull/17284>`__: ENH: Pass optimizations arguments to asv build @@ -616,23 +644,23 @@ A total of 684 pull requests were merged for this release. * `#17304 <https://github.com/numpy/numpy/pull/17304>`__: BUILD: pin pygments to 2.6.1, 2.7.0 breaks custom NumPyC lexer * `#17307 <https://github.com/numpy/numpy/pull/17307>`__: MAINT: Bump hypothesis from 5.33.0 to 5.35.1 * `#17308 <https://github.com/numpy/numpy/pull/17308>`__: MAINT: Bump pytest from 6.0.1 to 6.0.2 -* `#17309 <https://github.com/numpy/numpy/pull/17309>`__: MAINT: Move the `fromnumeric` annotations to their own stub file +* `#17309 <https://github.com/numpy/numpy/pull/17309>`__: MAINT: Move the ``fromnumeric`` annotations to their own stub file * `#17312 <https://github.com/numpy/numpy/pull/17312>`__: MAINT: Syntax-highlight .src files on github * `#17313 <https://github.com/numpy/numpy/pull/17313>`__: MAINT: Mark vendored/generated files in .gitattributes * `#17315 <https://github.com/numpy/numpy/pull/17315>`__: MAINT: Cleanup f2py/cfuncs.py * `#17319 <https://github.com/numpy/numpy/pull/17319>`__: BUG: Set deprecated fields to null in PyArray_InitArrFuncs * `#17320 <https://github.com/numpy/numpy/pull/17320>`__: BUG: allow registration of hard-coded structured dtypes * `#17326 <https://github.com/numpy/numpy/pull/17326>`__: ENH: Add annotations for five array construction functions -* `#17329 <https://github.com/numpy/numpy/pull/17329>`__: DOC: Fix incorrect `.. deprecated::` syntax that led to this... -* `#17330 <https://github.com/numpy/numpy/pull/17330>`__: DOC: improve `issubdtype` and scalar type docs -* `#17331 <https://github.com/numpy/numpy/pull/17331>`__: DOC: Remove the tables of scalar types, and use `..autoclass`... +* `#17329 <https://github.com/numpy/numpy/pull/17329>`__: DOC: Fix incorrect ``.. deprecated::`` syntax that led to this... +* `#17330 <https://github.com/numpy/numpy/pull/17330>`__: DOC: improve ``issubdtype`` and scalar type docs +* `#17331 <https://github.com/numpy/numpy/pull/17331>`__: DOC: Remove the tables of scalar types, and use ``..autoclass``... * `#17332 <https://github.com/numpy/numpy/pull/17332>`__: DOC, BLD: update lexer highlighting and make numpydocs a regular... * `#17334 <https://github.com/numpy/numpy/pull/17334>`__: MAINT: Chaining exceptions in npyio.py * `#17337 <https://github.com/numpy/numpy/pull/17337>`__: NEP: Regenerate table in NEP 29 (add numpy 1.18 and 1.19 to list) * `#17338 <https://github.com/numpy/numpy/pull/17338>`__: DOC: Fix syntax errors in docstrings for versionchanged, versionadded * `#17340 <https://github.com/numpy/numpy/pull/17340>`__: SIMD: Add partial/non-contig load and store intrinsics for 32/64-bit * `#17344 <https://github.com/numpy/numpy/pull/17344>`__: ENH, BLD: Support for the NVIDIA HPC SDK nvfortran compiler -* `#17346 <https://github.com/numpy/numpy/pull/17346>`__: BLD,BUG: Fix a macOS build failure when `NPY_BLAS_ORDER=""` +* `#17346 <https://github.com/numpy/numpy/pull/17346>`__: BLD,BUG: Fix a macOS build failure when ``NPY_BLAS_ORDER=""`` * `#17350 <https://github.com/numpy/numpy/pull/17350>`__: DEV: Add PR prefix labeler and numpy prefix mapping * `#17352 <https://github.com/numpy/numpy/pull/17352>`__: DOC: Guide to writing how-tos * `#17353 <https://github.com/numpy/numpy/pull/17353>`__: DOC: How-to guide for I/O @@ -642,7 +670,7 @@ A total of 684 pull requests were merged for this release. * `#17364 <https://github.com/numpy/numpy/pull/17364>`__: MAINT: Finish replacing PyInt_Check * `#17369 <https://github.com/numpy/numpy/pull/17369>`__: DOC: distutils: Remove an obsolete paragraph. * `#17370 <https://github.com/numpy/numpy/pull/17370>`__: NEP: Edit nep-0042 for more clarity -* `#17372 <https://github.com/numpy/numpy/pull/17372>`__: ENH: Add annotations for remaining `ndarray` / `generic` non-magic... +* `#17372 <https://github.com/numpy/numpy/pull/17372>`__: ENH: Add annotations for remaining ``ndarray`` / ``generic`` non-magic... * `#17373 <https://github.com/numpy/numpy/pull/17373>`__: BUG: Fixes module data docstrings. * `#17375 <https://github.com/numpy/numpy/pull/17375>`__: DOC: Fix default_rng docstring * `#17377 <https://github.com/numpy/numpy/pull/17377>`__: BUG: ensure _UFuncNoLoopError can be pickled @@ -654,6 +682,7 @@ A total of 684 pull requests were merged for this release. * `#17391 <https://github.com/numpy/numpy/pull/17391>`__: DOC: Replace "About NumPy" with "Document conventions" * `#17392 <https://github.com/numpy/numpy/pull/17392>`__: DOC: Update info on doc style rules * `#17393 <https://github.com/numpy/numpy/pull/17393>`__: BUG: Fix default void, datetime, and timedelta in array coercion +* `#17394 <https://github.com/numpy/numpy/pull/17394>`__: ENH: Implement sliding window * `#17396 <https://github.com/numpy/numpy/pull/17396>`__: MAINT: Replace append_metastr_to_string function. * `#17399 <https://github.com/numpy/numpy/pull/17399>`__: BLD: Fixed ARGOUTVIEWM memory deallocation. Closes #17398. * `#17400 <https://github.com/numpy/numpy/pull/17400>`__: DOC: rm incorrect alias from recarray user article. @@ -661,12 +690,12 @@ A total of 684 pull requests were merged for this release. * `#17402 <https://github.com/numpy/numpy/pull/17402>`__: DOC: Add arraysetops to an autosummary * `#17404 <https://github.com/numpy/numpy/pull/17404>`__: MAINT: Replace PyUString_ConcatAndDel in nditer_constr.c. * `#17405 <https://github.com/numpy/numpy/pull/17405>`__: MAINT: Replace PyUString_ConcatAndDel in mapping.c. -* `#17406 <https://github.com/numpy/numpy/pull/17406>`__: ENH: Replace the module-level `__getattr__` with explicit type... +* `#17406 <https://github.com/numpy/numpy/pull/17406>`__: ENH: Replace the module-level ``__getattr__`` with explicit type... * `#17407 <https://github.com/numpy/numpy/pull/17407>`__: DOC: in PR template, set expectations for PR review timeline * `#17409 <https://github.com/numpy/numpy/pull/17409>`__: MAINT: Cleanup remaining PyUString_ConcatAndDel use. * `#17410 <https://github.com/numpy/numpy/pull/17410>`__: API: Special case how numpy scalars are coerced to signed integer * `#17411 <https://github.com/numpy/numpy/pull/17411>`__: TST: Mark the typing tests as slow -* `#17412 <https://github.com/numpy/numpy/pull/17412>`__: DOC: Fix a parameter type in the `putmask` docs +* `#17412 <https://github.com/numpy/numpy/pull/17412>`__: DOC: Fix a parameter type in the ``putmask`` docs * `#17418 <https://github.com/numpy/numpy/pull/17418>`__: DOC: adding operational form documentation for array ops * `#17419 <https://github.com/numpy/numpy/pull/17419>`__: DEP: Deprecate coercion to subarray dtypes * `#17421 <https://github.com/numpy/numpy/pull/17421>`__: BUG: Fix memory leak in array-coercion error paths @@ -674,7 +703,7 @@ A total of 684 pull requests were merged for this release. * `#17423 <https://github.com/numpy/numpy/pull/17423>`__: DOC: Remove bogus reference to _a_ * `#17424 <https://github.com/numpy/numpy/pull/17424>`__: DOC: Fix formatting issues in description of .c.src files * `#17427 <https://github.com/numpy/numpy/pull/17427>`__: NEP: nep-0029 typo correction -* `#17429 <https://github.com/numpy/numpy/pull/17429>`__: MAINT: Move aliases for common scalar unions to `numpy.typing` +* `#17429 <https://github.com/numpy/numpy/pull/17429>`__: MAINT: Move aliases for common scalar unions to ``numpy.typing`` * `#17430 <https://github.com/numpy/numpy/pull/17430>`__: BUG: Fix memoryleaks related to NEP 37 function overrides * `#17431 <https://github.com/numpy/numpy/pull/17431>`__: DOC: Fix the links for ``Ellipsis`` * `#17432 <https://github.com/numpy/numpy/pull/17432>`__: DOC: add references to einops and opt_einsum @@ -685,7 +714,7 @@ A total of 684 pull requests were merged for this release. * `#17440 <https://github.com/numpy/numpy/pull/17440>`__: DOC: Cleaner template for PRs * `#17442 <https://github.com/numpy/numpy/pull/17442>`__: MAINT: fix exception chaining in format.py * `#17443 <https://github.com/numpy/numpy/pull/17443>`__: ENH: Warn on unsupported Python 3.10+ -* `#17444 <https://github.com/numpy/numpy/pull/17444>`__: ENH: Add `Typing :: Typed` to the PyPi classifier +* `#17444 <https://github.com/numpy/numpy/pull/17444>`__: ENH: Add ``Typing :: Typed`` to the PyPi classifier * `#17445 <https://github.com/numpy/numpy/pull/17445>`__: DOC: Fix the references for macros * `#17447 <https://github.com/numpy/numpy/pull/17447>`__: NEP: update NEP 42 with discussion of type hinting applications * `#17448 <https://github.com/numpy/numpy/pull/17448>`__: DOC: Remove CoC pages from Sphinx @@ -699,16 +728,17 @@ A total of 684 pull requests were merged for this release. * `#17468 <https://github.com/numpy/numpy/pull/17468>`__: DOC: add some missing scalar aliases * `#17472 <https://github.com/numpy/numpy/pull/17472>`__: TST: Fix doctest for full_like * `#17473 <https://github.com/numpy/numpy/pull/17473>`__: MAINT: py3k: remove os.fspath and os.PathLike backports -* `#17474 <https://github.com/numpy/numpy/pull/17474>`__: MAINT: Move the `np.core.numeric` annotations to their own stub... -* `#17479 <https://github.com/numpy/numpy/pull/17479>`__: ENH: type np.unicode_ as np.str_ +* `#17474 <https://github.com/numpy/numpy/pull/17474>`__: MAINT: Move the ``np.core.numeric`` annotations to their own stub... +* `#17479 <https://github.com/numpy/numpy/pull/17479>`__: ENH: type ``np.unicode_`` as ``np.str_`` * `#17481 <https://github.com/numpy/numpy/pull/17481>`__: DOC: Fix the entries for members of structures -* `#17483 <https://github.com/numpy/numpy/pull/17483>`__: DOC: Fix the references for `random.*` +* `#17483 <https://github.com/numpy/numpy/pull/17483>`__: DOC: Fix the references for ``random.*`` * `#17485 <https://github.com/numpy/numpy/pull/17485>`__: BLD: circleCI- merge before build, add -n to sphinx * `#17487 <https://github.com/numpy/numpy/pull/17487>`__: MAINT: Remove duplicate placeholder annotations +* `#17493 <https://github.com/numpy/numpy/pull/17493>`__: DOC: New round of NEP 42 edits * `#17497 <https://github.com/numpy/numpy/pull/17497>`__: DOC: Use consistent lowercase on docs landing page * `#17498 <https://github.com/numpy/numpy/pull/17498>`__: MAINT: fix incompatible type comparison in numpy.lib.utils.info * `#17501 <https://github.com/numpy/numpy/pull/17501>`__: BUG: Fix failures in master related to userdtype registeration -* `#17502 <https://github.com/numpy/numpy/pull/17502>`__: BUG: remove `sys` from the type stubs +* `#17502 <https://github.com/numpy/numpy/pull/17502>`__: BUG: remove ``sys`` from the type stubs * `#17503 <https://github.com/numpy/numpy/pull/17503>`__: DOC: Fix empty 'C style guide' page * `#17504 <https://github.com/numpy/numpy/pull/17504>`__: DOC: Rename 'Quickstart tutorial' * `#17508 <https://github.com/numpy/numpy/pull/17508>`__: ENH: Added the Final feature for all constants @@ -726,15 +756,15 @@ A total of 684 pull requests were merged for this release. * `#17537 <https://github.com/numpy/numpy/pull/17537>`__: MAINT: Bump hypothesis from 5.37.0 to 5.37.1 * `#17538 <https://github.com/numpy/numpy/pull/17538>`__: MAINT: Bump pydata-sphinx-theme from 0.4.0 to 0.4.1 * `#17539 <https://github.com/numpy/numpy/pull/17539>`__: MAINT: Bump mypy from 0.782 to 0.790 -* `#17540 <https://github.com/numpy/numpy/pull/17540>`__: ENH: Make `np.number` generic with respect to its precision +* `#17540 <https://github.com/numpy/numpy/pull/17540>`__: ENH: Make ``np.number`` generic with respect to its precision * `#17541 <https://github.com/numpy/numpy/pull/17541>`__: CI: fix conditional for PR merge command -* `#17546 <https://github.com/numpy/numpy/pull/17546>`__: MAINT: explicit disabling `CCompilerOpt` in F2PY +* `#17546 <https://github.com/numpy/numpy/pull/17546>`__: MAINT: explicit disabling ``CCompilerOpt`` in F2PY * `#17548 <https://github.com/numpy/numpy/pull/17548>`__: BUG: Cygwin Workaround for #14787 on affected platforms * `#17549 <https://github.com/numpy/numpy/pull/17549>`__: DOC: Fix the entries of C functions * `#17555 <https://github.com/numpy/numpy/pull/17555>`__: DOC: Fix wrong blockquotes * `#17558 <https://github.com/numpy/numpy/pull/17558>`__: DOC: MAINT: Add NEP 43 links to NEP 42 * `#17559 <https://github.com/numpy/numpy/pull/17559>`__: DOC: Remove directives for some constants -* `#17564 <https://github.com/numpy/numpy/pull/17564>`__: MAINT: Update the annotations in `np.core.numeric` +* `#17564 <https://github.com/numpy/numpy/pull/17564>`__: MAINT: Update the annotations in ``np.core.numeric`` * `#17570 <https://github.com/numpy/numpy/pull/17570>`__: DOC: Add the entry for ``NPY_FEATURE_VERSION`` * `#17571 <https://github.com/numpy/numpy/pull/17571>`__: DOC: Fix typos * `#17572 <https://github.com/numpy/numpy/pull/17572>`__: ENH: Add annotations for three new constants @@ -742,27 +772,27 @@ A total of 684 pull requests were merged for this release. * `#17577 <https://github.com/numpy/numpy/pull/17577>`__: BUG: Respect dtype of all-zero argument to poly1d * `#17578 <https://github.com/numpy/numpy/pull/17578>`__: NEP36: include additional feedback * `#17580 <https://github.com/numpy/numpy/pull/17580>`__: MAINT: Cleanup swig for Python 3. -* `#17581 <https://github.com/numpy/numpy/pull/17581>`__: MAINT: Move the `np.core.numerictypes` annotations to their own... +* `#17581 <https://github.com/numpy/numpy/pull/17581>`__: MAINT: Move the ``np.core.numerictypes`` annotations to their own... * `#17583 <https://github.com/numpy/numpy/pull/17583>`__: MAINT: Bump hypothesis from 5.37.1 to 5.37.3 -* `#17584 <https://github.com/numpy/numpy/pull/17584>`__: ENH: Add annotations for `np.core._type_aliases` +* `#17584 <https://github.com/numpy/numpy/pull/17584>`__: ENH: Add annotations for ``np.core._type_aliases`` * `#17594 <https://github.com/numpy/numpy/pull/17594>`__: DOC: Typo in lexsort docstring * `#17596 <https://github.com/numpy/numpy/pull/17596>`__: DEP,BUG: Coercion/cast of array to a subarray dtype will be fixed * `#17597 <https://github.com/numpy/numpy/pull/17597>`__: TST: Clean up the errors of the typing tests * `#17598 <https://github.com/numpy/numpy/pull/17598>`__: BUG: Fixed file handle leak in array_tofile. -* `#17601 <https://github.com/numpy/numpy/pull/17601>`__: TST: Fix a broken `np.core.numeric` test +* `#17601 <https://github.com/numpy/numpy/pull/17601>`__: TST: Fix a broken ``np.core.numeric`` test * `#17603 <https://github.com/numpy/numpy/pull/17603>`__: MAINT: Mark dead code as intentional for clang. * `#17607 <https://github.com/numpy/numpy/pull/17607>`__: DOC: removed old references to submodule licenses * `#17608 <https://github.com/numpy/numpy/pull/17608>`__: DOC: Fix typos (general documentation) * `#17610 <https://github.com/numpy/numpy/pull/17610>`__: Fully qualify license trove classifier * `#17611 <https://github.com/numpy/numpy/pull/17611>`__: BUG: mac dylib treated as part of extra objects by f2py -* `#17613 <https://github.com/numpy/numpy/pull/17613>`__: ENH: Add annotations for 9 `ndarray`/`generic` magic methods +* `#17613 <https://github.com/numpy/numpy/pull/17613>`__: ENH: Add annotations for 9 ``ndarray``/``generic`` magic methods * `#17614 <https://github.com/numpy/numpy/pull/17614>`__: DOC: Fix the document for arrays interface * `#17618 <https://github.com/numpy/numpy/pull/17618>`__: MAINT: Conversion of some strings to f-strings * `#17619 <https://github.com/numpy/numpy/pull/17619>`__: DOC: Fix some references * `#17621 <https://github.com/numpy/numpy/pull/17621>`__: TST: Valid docstring for config_py function show() * `#17622 <https://github.com/numpy/numpy/pull/17622>`__: MAINT: Conversion of some strings to fstrings, part II * `#17623 <https://github.com/numpy/numpy/pull/17623>`__: MAINT: Conversion of some strings to fstrings, part III -* `#17624 <https://github.com/numpy/numpy/pull/17624>`__: DOC: Tidy up references to str_ / bytes_ +* `#17624 <https://github.com/numpy/numpy/pull/17624>`__: DOC: Tidy up references to ``str_`` / ``bytes_`` * `#17625 <https://github.com/numpy/numpy/pull/17625>`__: MAINT: Conversion of some strings to fstrings, part iv * `#17627 <https://github.com/numpy/numpy/pull/17627>`__: DOC: Fix the references for ``__array_*__`` * `#17628 <https://github.com/numpy/numpy/pull/17628>`__: DOC: Add entries for macros @@ -773,8 +803,8 @@ A total of 684 pull requests were merged for this release. * `#17639 <https://github.com/numpy/numpy/pull/17639>`__: MAINT: Bump hypothesis from 5.37.3 to 5.38.0 * `#17641 <https://github.com/numpy/numpy/pull/17641>`__: MAINT, BLD: update to OpenBLAS v0.3.12 * `#17642 <https://github.com/numpy/numpy/pull/17642>`__: DOC: Fix reference to atleast_1d -* `#17643 <https://github.com/numpy/numpy/pull/17643>`__: ENH: Add annotations for `np.core._ufunc_config` -* `#17644 <https://github.com/numpy/numpy/pull/17644>`__: ENH: Add annotations for `np.core.shape_base` +* `#17643 <https://github.com/numpy/numpy/pull/17643>`__: ENH: Add annotations for ``np.core._ufunc_config`` +* `#17644 <https://github.com/numpy/numpy/pull/17644>`__: ENH: Add annotations for ``np.core.shape_base`` * `#17645 <https://github.com/numpy/numpy/pull/17645>`__: BUG: fix np.timedelta64('nat').__format__ throwing an exception * `#17654 <https://github.com/numpy/numpy/pull/17654>`__: BUG: f2py incorrectly translates dimension declarations. * `#17655 <https://github.com/numpy/numpy/pull/17655>`__: BLD: Fix installing Numpy on z/OS @@ -799,7 +829,9 @@ A total of 684 pull requests were merged for this release. * `#17700 <https://github.com/numpy/numpy/pull/17700>`__: Fix small typos. * `#17701 <https://github.com/numpy/numpy/pull/17701>`__: BUG: Fixed an issue where ``.pyi`` files were ignored by numpy... * `#17703 <https://github.com/numpy/numpy/pull/17703>`__: Fix Doc Typos & Added Example +* `#17706 <https://github.com/numpy/numpy/pull/17706>`__: BUG: Raise promotion error if a DType was provided in array coercion * `#17708 <https://github.com/numpy/numpy/pull/17708>`__: Improve the einsum bench by adding new bench cases and variable... +* `#17711 <https://github.com/numpy/numpy/pull/17711>`__: ENH: adds type hints to numpy.version * `#17715 <https://github.com/numpy/numpy/pull/17715>`__: REV: Revert gh-17654 - f2py incorrectly translates dimension... * `#17717 <https://github.com/numpy/numpy/pull/17717>`__: MAINT: Add more files to ``.gitgnore`` * `#17720 <https://github.com/numpy/numpy/pull/17720>`__: API: Do not import sliding_window_view to main namespace @@ -836,9 +868,9 @@ A total of 684 pull requests were merged for this release. * `#17830 <https://github.com/numpy/numpy/pull/17830>`__: TST: Add back durations flag for DEBUG builds. * `#17832 <https://github.com/numpy/numpy/pull/17832>`__: BUG: Fix subarray dtype used with too large count in fromfile * `#17833 <https://github.com/numpy/numpy/pull/17833>`__: BUG: Fix pickling of scalars with NPY_LISTPICKLE -* `#17838 <https://github.com/numpy/numpy/pull/17838>`__: DOC: Update the `numpy.typing` documentation +* `#17838 <https://github.com/numpy/numpy/pull/17838>`__: DOC: Update the ``numpy.typing`` documentation * `#17841 <https://github.com/numpy/numpy/pull/17841>`__: DOC: Fixing boilerplate code example -* `#17844 <https://github.com/numpy/numpy/pull/17844>`__: MAINT: Add ``__all__`` to `numpy.typing` +* `#17844 <https://github.com/numpy/numpy/pull/17844>`__: MAINT: Add ``__all__`` to ``numpy.typing`` * `#17848 <https://github.com/numpy/numpy/pull/17848>`__: DOC: Add release note for gh-16161. * `#17855 <https://github.com/numpy/numpy/pull/17855>`__: BUG: Fix incorrect C function prototypes/declarations. * `#17857 <https://github.com/numpy/numpy/pull/17857>`__: MAINT: Prepare for the NumPy 1.20.x branch. diff --git a/doc/neps/nep-0049.rst b/doc/neps/nep-0049.rst index 9adf0ff26..743dd2ad6 100644 --- a/doc/neps/nep-0049.rst +++ b/doc/neps/nep-0049.rst @@ -6,6 +6,7 @@ NEP 49 — Data allocation strategies :Status: Draft :Type: Standards Track :Created: 2021-04-18 +:Resolution: http://numpy-discussion.10968.n7.nabble.com/NEP-49-Data-allocation-strategies-tt49185.html Abstract @@ -101,6 +102,11 @@ time of its instantiation, and these will be used to reallocate or free the data memory of the instance. Internally NumPy may use ``memcpy`` or ``memset`` on the pointer to the data memory. +The name of the handler will be exposed on the python level via a +``numpy.core.multiarray.get_handler_name(arr)`` function. If called as +``numpy.core.multiarray.get_handler_name()`` it will return the name of the +global handler that will be used to allocate data for the next new `ndarrray`. + NumPy C-API functions ===================== @@ -185,7 +191,7 @@ the ``sz`` argument is correct. if (strncmp(real, "originally allocated", 20) != 0) { fprintf(stdout, "uh-oh, unmatched shift_free, " "no appropriate prefix\\n"); - /* Make gcc crash by calling free on the wrong address */ + /* Make the C runtime crash by calling free on the wrong address */ free((char *)p + 10); /* free(real); */ } @@ -194,7 +200,7 @@ the ``sz`` argument is correct. if (i != sz) { fprintf(stderr, "uh-oh, unmatched " "shift_free(ptr, %d) but allocated %d\\n", sz, i); - /* Make gcc crash by calling free on the wrong address */ + /* Make the C runtime crash by calling free on the wrong address */ /* free((char *)p + 10); */ free(real); } diff --git a/doc/release/upcoming_changes/18874.change.rst b/doc/release/upcoming_changes/18874.change.rst new file mode 100644 index 000000000..c86fed83e --- /dev/null +++ b/doc/release/upcoming_changes/18874.change.rst @@ -0,0 +1,11 @@ +Enable Accelerate Framework +---------------------------- +With the release of macOS 11.3, several different issues that +numpy was encountering when using Accelerate Framework's +implementation of BLAS and LAPACK should be resolved. This +change enables the Accelerate Framework as an option on macOS. +If additional issues are found, please file a bug report +against Accelerate using the developer feedback assistant +tool (https://developer.apple.com/bug-reporting/). We +intend to address issues promptly and plan to continue +supporting and updating our BLAS and LAPACK libraries. diff --git a/doc/release/upcoming_changes/18906.new_function.rst b/doc/release/upcoming_changes/18906.new_function.rst new file mode 100644 index 000000000..38444009d --- /dev/null +++ b/doc/release/upcoming_changes/18906.new_function.rst @@ -0,0 +1,17 @@ +.. currentmodule:: numpy.random + +Add `PCG64DXSM` `BitGenerator` +------------------------------ + +Uses of the `PCG64` `BitGenerator` in a massively-parallel context have been +shown to have statistical weaknesses that were not apparent at the first +release in numpy 1.17. Most users will never observe this weakness and are +safe to continue to use `PCG64`. We have introduced a new `PCG64DXSM` +`BitGenerator` that will eventually become the new default `BitGenerator` +implementation used by `default_rng` in future releases. `PCG64DXSM` solves +the statistical weakness while preserving the performance and the features of +`PCG64`. + +See :ref:`upgrading-pcg64` for more details. + +.. currentmodule:: numpy diff --git a/doc/release/upcoming_changes/18934.improvement.rst b/doc/release/upcoming_changes/18934.improvement.rst new file mode 100644 index 000000000..582062f2f --- /dev/null +++ b/doc/release/upcoming_changes/18934.improvement.rst @@ -0,0 +1,5 @@ +Placeholder annotations have been improved +------------------------------------------ +All placeholder annotations, that were previously annotated as ``typing.Any``, +have been improved. Where appropiate they have been replaced with explicit +function definitions, classes or other miscellaneous objects. diff --git a/doc/source/dev/gitwash/development_setup.rst b/doc/source/dev/gitwash/development_setup.rst index badb73ca0..2be7125da 100644 --- a/doc/source/dev/gitwash/development_setup.rst +++ b/doc/source/dev/gitwash/development_setup.rst @@ -165,7 +165,7 @@ slightly. Instead of :: run :: - git clone git@github.com:numpy/numpy.git + git clone git@github.com:your-user-name/numpy.git and instead of showing an ``https`` URL, ``git remote -v`` will show :: diff --git a/doc/source/reference/random/bit_generators/index.rst b/doc/source/reference/random/bit_generators/index.rst index 6f8cf02ca..c5c349806 100644 --- a/doc/source/reference/random/bit_generators/index.rst +++ b/doc/source/reference/random/bit_generators/index.rst @@ -15,10 +15,13 @@ Supported BitGenerators The included BitGenerators are: -* PCG-64 - The default. A fast generator that supports many parallel streams - and can be advanced by an arbitrary amount. See the documentation for - :meth:`~.PCG64.advance`. PCG-64 has a period of :math:`2^{128}`. See the `PCG - author's page`_ for more details about this class of PRNG. +* PCG-64 - The default. A fast generator that can be advanced by an arbitrary + amount. See the documentation for :meth:`~.PCG64.advance`. PCG-64 has + a period of :math:`2^{128}`. See the `PCG author's page`_ for more details + about this class of PRNG. +* PCG-64 DXSM - An upgraded version of PCG-64 with better statistical + properties in parallel contexts. See :ref:`upgrading-pcg64` for more + information on these improvements. * MT19937 - The standard Python BitGenerator. Adds a `MT19937.jumped` function that returns a new generator with state as-if :math:`2^{128}` draws have been made. @@ -43,6 +46,7 @@ The included BitGenerators are: MT19937 <mt19937> PCG64 <pcg64> + PCG64DXSM <pcg64dxsm> Philox <philox> SFC64 <sfc64> diff --git a/doc/source/reference/random/bit_generators/pcg64dxsm.rst b/doc/source/reference/random/bit_generators/pcg64dxsm.rst new file mode 100644 index 000000000..e37efa5d3 --- /dev/null +++ b/doc/source/reference/random/bit_generators/pcg64dxsm.rst @@ -0,0 +1,32 @@ +Permuted Congruential Generator (64-bit, PCG64 DXSM) +---------------------------------------------------- + +.. currentmodule:: numpy.random + +.. autoclass:: PCG64DXSM + :members: __init__ + :exclude-members: __init__ + +State +===== + +.. autosummary:: + :toctree: generated/ + + ~PCG64DXSM.state + +Parallel generation +=================== +.. autosummary:: + :toctree: generated/ + + ~PCG64DXSM.advance + ~PCG64DXSM.jumped + +Extending +========= +.. autosummary:: + :toctree: generated/ + + ~PCG64DXSM.cffi + ~PCG64DXSM.ctypes diff --git a/doc/source/reference/random/index.rst b/doc/source/reference/random/index.rst index fc7743c64..96cd47017 100644 --- a/doc/source/reference/random/index.rst +++ b/doc/source/reference/random/index.rst @@ -222,6 +222,9 @@ one of three ways: * :ref:`independent-streams` * :ref:`parallel-jumped` +Users with a very large amount of parallelism will want to consult +:ref:`upgrading-pcg64`. + Concepts -------- .. toctree:: @@ -230,6 +233,7 @@ Concepts generator Legacy Generator (RandomState) <legacy> BitGenerators, SeedSequences <bit_generators/index> + Upgrading PCG64 with PCG64DXSM <upgrading-pcg64> Features -------- diff --git a/doc/source/reference/random/parallel.rst b/doc/source/reference/random/parallel.rst index 721584014..7f0207bde 100644 --- a/doc/source/reference/random/parallel.rst +++ b/doc/source/reference/random/parallel.rst @@ -88,10 +88,11 @@ territory ([2]_). estimate the naive upper bound on a napkin and take comfort knowing that the probability is actually lower. -.. [2] In this calculation, we can ignore the amount of numbers drawn from each - stream. Each of the PRNGs we provide has some extra protection built in +.. [2] In this calculation, we can mostly ignore the amount of numbers drawn from each + stream. See :ref:`upgrading-pcg64` for the technical details about + `PCG64`. The other PRNGs we provide have some extra protection built in that avoids overlaps if the `~SeedSequence` pools differ in the - slightest bit. `PCG64` has :math:`2^{127}` separate cycles + slightest bit. `PCG64DXSM` has :math:`2^{127}` separate cycles determined by the seed in addition to the position in the :math:`2^{128}` long period for each cycle, so one has to both get on or near the same cycle *and* seed a nearby position in the cycle. @@ -150,12 +151,14 @@ BitGenerator, the size of the jump and the bits in the default unsigned random are listed below. +-----------------+-------------------------+-------------------------+-------------------------+ -| BitGenerator | Period | Jump Size | Bits | +| BitGenerator | Period | Jump Size | Bits per Draw | +=================+=========================+=========================+=========================+ -| MT19937 | :math:`2^{19937}` | :math:`2^{128}` | 32 | +| MT19937 | :math:`2^{19937}-1` | :math:`2^{128}` | 32 | +-----------------+-------------------------+-------------------------+-------------------------+ | PCG64 | :math:`2^{128}` | :math:`~2^{127}` ([3]_) | 64 | +-----------------+-------------------------+-------------------------+-------------------------+ +| PCG64DXSM | :math:`2^{128}` | :math:`~2^{127}` ([3]_) | 64 | ++-----------------+-------------------------+-------------------------+-------------------------+ | Philox | :math:`2^{256}` | :math:`2^{128}` | 64 | +-----------------+-------------------------+-------------------------+-------------------------+ diff --git a/doc/source/reference/random/performance.py b/doc/source/reference/random/performance.py index 3267197f5..794142836 100644 --- a/doc/source/reference/random/performance.py +++ b/doc/source/reference/random/performance.py @@ -3,9 +3,9 @@ from timeit import repeat import pandas as pd import numpy as np -from numpy.random import MT19937, PCG64, Philox, SFC64 +from numpy.random import MT19937, PCG64, PCG64DXSM, Philox, SFC64 -PRNGS = [MT19937, PCG64, Philox, SFC64] +PRNGS = [MT19937, PCG64, PCG64DXSM, Philox, SFC64] funcs = {} integers = 'integers(0, 2**{bits},size=1000000, dtype="uint{bits}")' @@ -53,7 +53,7 @@ for key in npfuncs: col[key] = 1000 * min(t) table['RandomState'] = pd.Series(col) -columns = ['MT19937','PCG64','Philox','SFC64', 'RandomState'] +columns = ['MT19937', 'PCG64', 'PCG64DXSM', 'Philox', 'SFC64', 'RandomState'] table = pd.DataFrame(table) order = np.log(table).mean().sort_values().index table = table.T diff --git a/doc/source/reference/random/performance.rst b/doc/source/reference/random/performance.rst index 74dad4cc3..812c719f8 100644 --- a/doc/source/reference/random/performance.rst +++ b/doc/source/reference/random/performance.rst @@ -5,9 +5,12 @@ Performance Recommendation ************** -The recommended generator for general use is `PCG64`. It is -statistically high quality, full-featured, and fast on most platforms, but -somewhat slow when compiled for 32-bit processes. + +The recommended generator for general use is `PCG64` or its upgraded variant +`PCG64DXSM` for heavily-parallel use cases. They are statistically high quality, +full-featured, and fast on most platforms, but somewhat slow when compiled for +32-bit processes. See :ref:`upgrading-pcg64` for details on when heavy +parallelism would indicate using `PCG64DXSM`. `Philox` is fairly slow, but its statistical properties have very high quality, and it is easy to get assuredly-independent stream by using diff --git a/doc/source/reference/random/upgrading-pcg64.rst b/doc/source/reference/random/upgrading-pcg64.rst new file mode 100644 index 000000000..9e540ace9 --- /dev/null +++ b/doc/source/reference/random/upgrading-pcg64.rst @@ -0,0 +1,152 @@ +.. _upgrading-pcg64: + +.. currentmodule:: numpy.random + +Upgrading ``PCG64`` with ``PCG64DXSM`` +-------------------------------------- + +Uses of the `PCG64` `BitGenerator` in a massively-parallel context have been +shown to have statistical weaknesses that were not apparent at the first +release in numpy 1.17. Most users will never observe this weakness and are +safe to continue to use `PCG64`. We have introduced a new `PCG64DXSM` +`BitGenerator` that will eventually become the new default `BitGenerator` +implementation used by `default_rng` in future releases. `PCG64DXSM` solves +the statistical weakness while preserving the performance and the features of +`PCG64`. + +Does this affect me? +==================== + +If you + + 1. only use a single `Generator` instance, + 2. only use `RandomState` or the functions in `numpy.random`, + 3. only use the `PCG64.jumped` method to generate parallel streams, + 4. explicitly use a `BitGenerator` other than `PCG64`, + +then this weakness does not affect you at all. Carry on. + +If you use moderate numbers of parallel streams created with `default_rng` or +`SeedSequence.spawn`, in the 1000s, then the chance of observing this weakness +is negligibly small. You can continue to use `PCG64` comfortably. + +If you use very large numbers of parallel streams, in the millions, and draw +large amounts of numbers from each, then the chance of observing this weakness +can become non-negligible, if still small. An example of such a use case would +be a very large distributed reinforcement learning problem with millions of +long Monte Carlo playouts each generating billions of random number draws. Such +use cases should consider using `PCG64DXSM` explicitly or another +modern `BitGenerator` like `SFC64` or `Philox`, but it is unlikely that any +old results you may have calculated are invalid. In any case, the weakness is +a kind of `Birthday Paradox <https://en.wikipedia.org/wiki/Birthday_problem>`_ +collision. That is, a single pair of parallel streams out of the millions, +considered together, might fail a stringent set of statistical tests of +randomness. The remaining millions of streams would all be perfectly fine, and +the effect of the bad pair in the whole calculation is very likely to be +swamped by the remaining streams in most applications. + +.. _upgrading-pcg64-details: + +Technical Details +================= + +Like many PRNG algorithms, `PCG64` is constructed from a transition function, +which advances a 128-bit state, and an output function, that mixes the 128-bit +state into a 64-bit integer to be output. One of the guiding design principles +of the PCG family of PRNGs is to balance the computational cost (and +pseudorandomness strength) between the transition function and the output +function. The transition function is a 128-bit linear congruential generator +(LCG), which consists of multiplying the 128-bit state with a fixed +multiplication constant and then adding a user-chosen increment, in 128-bit +modular arithmetic. LCGs are well-analyzed PRNGs with known weaknesses, though +128-bit LCGs are large enough to pass stringent statistical tests on their own, +with only the trivial output function. The output function of `PCG64` is +intended to patch up some of those known weaknesses by doing "just enough" +scrambling of the bits to assist in the statistical properties without adding +too much computational cost. + +One of these known weaknesses is that advancing the state of the LCG by steps +numbering a power of two (``bg.advance(2**N)``) will leave the lower ``N`` bits +identical to the state that was just left. For a single stream drawn from +sequentially, this is of little consequence. The remaining :math:`128-N` bits provide +plenty of pseudorandomness that will be mixed in for any practical ``N`` that can +be observed in a single stream, which is why one does not need to worry about +this if you only use a single stream in your application. Similarly, the +`PCG64.jumped` method uses a carefully chosen number of steps to avoid creating +these collisions. However, once you start creating "randomly-initialized" +parallel streams, either using OS entropy by calling `default_rng` repeatedly +or using `SeedSequence.spawn`, then we need to consider how many lower bits +need to "collide" in order to create a bad pair of streams, and then evaluate +the probability of creating such a collision. +`Empirically <https://github.com/numpy/numpy/issues/16313>`_, it has been +determined that if one shares the lower 58 bits of state and shares an +increment, then the pair of streams, when interleaved, will fail +`PractRand <http://pracrand.sourceforge.net/>`_ in +a reasonable amount of time, after drawing a few gigabytes of data. Following +the standard Birthday Paradox calculations for a collision of 58 bits, we can +see that we can create :math:`2^{29}`, or about half a billion, streams which is when +the probability of such a collision becomes high. Half a billion streams is +quite high, and the amount of data each stream needs to draw before the +statistical correlations become apparent to even the strict ``PractRand`` tests +is in the gigabytes. But this is on the horizon for very large applications +like distributed reinforcement learning. There are reasons to expect that even +in these applications a collision probably will not have a practical effect in +the total result, since the statistical problem is constrained to just the +colliding pair. + +Now, let us consider the case when the increment is not constrained to be the +same. Our implementation of `PCG64` seeds both the state and the increment; +that is, two calls to `default_rng` (almost certainly) have different states +and increments. Upon our first release, we believed that having the seeded +increment would provide a certain amount of extra protection, that one would +have to be "close" in both the state space and increment space in order to +observe correlations (``PractRand`` failures) in a pair of streams. If that were +true, then the "bottleneck" for collisions would be the 128-bit entropy pool +size inside of `SeedSequence` (and 128-bit collisions are in the +"preposterously unlikely" category). Unfortunately, this is not true. + +One of the known properties of an LCG is that different increments create +*distinct* streams, but with a known relationship. Each LCG has an orbit that +traverses all :math:`2^{128}` different 128-bit states. Two LCGs with different +increments are related in that one can "rotate" the orbit of the first LCG +(advance it by a number of steps that we can compute from the two increments) +such that then both LCGs will always then have the same state, up to an +additive constant and maybe an inversion of the bits. If you then iterate both +streams in lockstep, then the states will *always* remain related by that same +additive constant (and the inversion, if present). Recall that `PCG64` is +constructed from both a transition function (the LCG) and an output function. +It was expected that the scrambling effect of the output function would have +been strong enough to make the distinct streams practically independent (i.e. +"passing the ``PractRand`` tests") unless the two increments were +pathologically related to each other (e.g. 1 and 3). The output function XSL-RR +of the then-standard PCG algorithm that we implemented in `PCG64` turns out to +be too weak to cover up for the 58-bit collision of the underlying LCG that we +described above. For any given pair of increments, the size of the "colliding" +space of states is the same, so for this weakness, the extra distinctness +provided by the increments does not translate into extra protection from +statistical correlations that ``PractRand`` can detect. + +Fortunately, strengthening the output function is able to correct this weakness +and *does* turn the extra distinctness provided by differing increments into +additional protection from these low-bit collisions. To the `PCG author's +credit <https://github.com/numpy/numpy/issues/13635#issuecomment-506088698>`_, +she had developed a stronger output function in response to related discussions +during the long birth of the new `BitGenerator` system. We NumPy developers +chose to be "conservative" and use the XSL-RR variant that had undergone +a longer period of testing at that time. The DXSM output function adopts +a "xorshift-multiply" construction used in strong integer hashes that has much +better avalanche properties than the XSL-RR output function. While there are +"pathological" pairs of increments that induce "bad" additive constants that +relate the two streams, the vast majority of pairs induce "good" additive +constants that make the merely-distinct streams of LCG states into +practically-independent output streams. Indeed, now the claim we once made +about `PCG64` is actually true of `PCG64DXSM`: collisions are possible, but +both streams have to simultaneously be both "close" in the 128 bit state space +*and* "close" in the 127-bit increment space, so that would be less likely than +the negligible chance of colliding in the 128-bit internal `SeedSequence` pool. +The DXSM output function is more computationally intensive than XSL-RR, but +some optimizations in the LCG more than make up for the performance hit on most +machines, so `PCG64DXSM` is a good, safe upgrade. There are, of course, an +infinite number of stronger output functions that one could consider, but most +will have a greater computational cost, and the DXSM output function has now +received many CPU cycles of testing via ``PractRand`` at this time. diff --git a/environment.yml b/environment.yml index 19fe69a79..5e1d4df23 100644 --- a/environment.yml +++ b/environment.yml @@ -1,6 +1,8 @@ # To use: +# # $ conda env create -f environment.yml # `mamba` works too for this command # $ conda activate numpy-dev +# name: numpy-dev channels: - conda-forge diff --git a/numpy/__init__.pyi b/numpy/__init__.pyi index 5c7a3c7e4..8824497f0 100644 --- a/numpy/__init__.pyi +++ b/numpy/__init__.pyi @@ -11,7 +11,6 @@ from numpy.typing import ( # Arrays ArrayLike, _ArrayND, - _ArrayOrScalar, _SupportsArray, _NestedSequence, _RecursiveSequence, @@ -1289,14 +1288,21 @@ class _ArrayOrScalarCommon: def __array_wrap__(array, context=...): ... def __setstate__(self, __state): ... # a `bool_` is returned when `keepdims=True` and `self` is a 0d array + @overload def all( - self, axis: None = ..., out: None = ..., keepdims: Literal[False] = ... + self, + axis: None = ..., + out: None = ..., + keepdims: Literal[False] = ..., ) -> bool_: ... @overload def all( - self, axis: Optional[_ShapeLike] = ..., out: None = ..., keepdims: bool = ... - ) -> Union[bool_, ndarray]: ... + self, + axis: Optional[_ShapeLike] = ..., + out: None = ..., + keepdims: bool = ..., + ) -> Any: ... @overload def all( self, @@ -1304,14 +1310,21 @@ class _ArrayOrScalarCommon: out: _NdArraySubClass = ..., keepdims: bool = ..., ) -> _NdArraySubClass: ... + @overload def any( - self, axis: None = ..., out: None = ..., keepdims: Literal[False] = ... + self, + axis: None = ..., + out: None = ..., + keepdims: Literal[False] = ..., ) -> bool_: ... @overload def any( - self, axis: Optional[_ShapeLike] = ..., out: None = ..., keepdims: bool = ... - ) -> Union[bool_, ndarray]: ... + self, + axis: Optional[_ShapeLike] = ..., + out: None = ..., + keepdims: bool = ..., + ) -> Any: ... @overload def any( self, @@ -1319,40 +1332,67 @@ class _ArrayOrScalarCommon: out: _NdArraySubClass = ..., keepdims: bool = ..., ) -> _NdArraySubClass: ... + @overload - def argmax(self, axis: None = ..., out: None = ...) -> intp: ... + def argmax( + self, + axis: None = ..., + out: None = ..., + ) -> intp: ... @overload def argmax( - self, axis: _ShapeLike = ..., out: None = ... - ) -> Union[ndarray, intp]: ... + self, + axis: _ShapeLike = ..., + out: None = ..., + ) -> Any: ... @overload def argmax( - self, axis: Optional[_ShapeLike] = ..., out: _NdArraySubClass = ... + self, + axis: Optional[_ShapeLike] = ..., + out: _NdArraySubClass = ..., ) -> _NdArraySubClass: ... + @overload - def argmin(self, axis: None = ..., out: None = ...) -> intp: ... + def argmin( + self, + axis: None = ..., + out: None = ..., + ) -> intp: ... @overload def argmin( - self, axis: _ShapeLike = ..., out: None = ... - ) -> Union[ndarray, intp]: ... + self, + axis: _ShapeLike = ..., + out: None = ..., + ) -> Any: ... @overload def argmin( - self, axis: Optional[_ShapeLike] = ..., out: _NdArraySubClass = ... + self, + axis: Optional[_ShapeLike] = ..., + out: _NdArraySubClass = ..., ) -> _NdArraySubClass: ... + def argsort( self, axis: Optional[SupportsIndex] = ..., kind: Optional[_SortKind] = ..., order: Union[None, str, Sequence[str]] = ..., ) -> ndarray: ... + @overload def choose( - self, choices: ArrayLike, out: None = ..., mode: _ModeKind = ..., + self, + choices: ArrayLike, + out: None = ..., + mode: _ModeKind = ..., ) -> ndarray: ... @overload def choose( - self, choices: ArrayLike, out: _NdArraySubClass = ..., mode: _ModeKind = ..., + self, + choices: ArrayLike, + out: _NdArraySubClass = ..., + mode: _ModeKind = ..., ) -> _NdArraySubClass: ... + @overload def clip( self, @@ -1360,7 +1400,7 @@ class _ArrayOrScalarCommon: max: Optional[ArrayLike] = ..., out: None = ..., **kwargs: Any, - ) -> Union[number, ndarray]: ... + ) -> ndarray: ... @overload def clip( self, @@ -1368,7 +1408,7 @@ class _ArrayOrScalarCommon: max: ArrayLike = ..., out: None = ..., **kwargs: Any, - ) -> Union[number, ndarray]: ... + ) -> ndarray: ... @overload def clip( self, @@ -1385,6 +1425,7 @@ class _ArrayOrScalarCommon: out: _NdArraySubClass = ..., **kwargs: Any, ) -> _NdArraySubClass: ... + @overload def compress( self, @@ -1399,8 +1440,11 @@ class _ArrayOrScalarCommon: axis: Optional[SupportsIndex] = ..., out: _NdArraySubClass = ..., ) -> _NdArraySubClass: ... + def conj(self: _ArraySelf) -> _ArraySelf: ... + def conjugate(self: _ArraySelf) -> _ArraySelf: ... + @overload def cumprod( self, @@ -1415,6 +1459,7 @@ class _ArrayOrScalarCommon: dtype: DTypeLike = ..., out: _NdArraySubClass = ..., ) -> _NdArraySubClass: ... + @overload def cumsum( self, @@ -1429,15 +1474,7 @@ class _ArrayOrScalarCommon: dtype: DTypeLike = ..., out: _NdArraySubClass = ..., ) -> _NdArraySubClass: ... - @overload - def max( - self, - axis: None = ..., - out: None = ..., - keepdims: Literal[False] = ..., - initial: _NumberLike_co = ..., - where: _ArrayLikeBool = ..., - ) -> number: ... + @overload def max( self, @@ -1446,7 +1483,7 @@ class _ArrayOrScalarCommon: keepdims: bool = ..., initial: _NumberLike_co = ..., where: _ArrayLikeBool = ..., - ) -> Union[number, ndarray]: ... + ) -> Any: ... @overload def max( self, @@ -1456,14 +1493,7 @@ class _ArrayOrScalarCommon: initial: _NumberLike_co = ..., where: _ArrayLikeBool = ..., ) -> _NdArraySubClass: ... - @overload - def mean( - self, - axis: None = ..., - dtype: DTypeLike = ..., - out: None = ..., - keepdims: Literal[False] = ..., - ) -> number: ... + @overload def mean( self, @@ -1471,7 +1501,7 @@ class _ArrayOrScalarCommon: dtype: DTypeLike = ..., out: None = ..., keepdims: bool = ..., - ) -> Union[number, ndarray]: ... + ) -> Any: ... @overload def mean( self, @@ -1480,15 +1510,7 @@ class _ArrayOrScalarCommon: out: _NdArraySubClass = ..., keepdims: bool = ..., ) -> _NdArraySubClass: ... - @overload - def min( - self, - axis: None = ..., - out: None = ..., - keepdims: Literal[False] = ..., - initial: _NumberLike_co = ..., - where: _ArrayLikeBool = ..., - ) -> number: ... + @overload def min( self, @@ -1497,7 +1519,7 @@ class _ArrayOrScalarCommon: keepdims: bool = ..., initial: _NumberLike_co = ..., where: _ArrayLikeBool = ..., - ) -> Union[number, ndarray]: ... + ) -> Any: ... @overload def min( self, @@ -1507,17 +1529,12 @@ class _ArrayOrScalarCommon: initial: _NumberLike_co = ..., where: _ArrayLikeBool = ..., ) -> _NdArraySubClass: ... - def newbyteorder(self: _ArraySelf, __new_order: _ByteOrder = ...) -> _ArraySelf: ... - @overload - def prod( - self, - axis: None = ..., - dtype: DTypeLike = ..., - out: None = ..., - keepdims: Literal[False] = ..., - initial: _NumberLike_co = ..., - where: _ArrayLikeBool = ..., - ) -> number: ... + + def newbyteorder( + self: _ArraySelf, + __new_order: _ByteOrder = ..., + ) -> _ArraySelf: ... + @overload def prod( self, @@ -1527,7 +1544,7 @@ class _ArrayOrScalarCommon: keepdims: bool = ..., initial: _NumberLike_co = ..., where: _ArrayLikeBool = ..., - ) -> Union[number, ndarray]: ... + ) -> Any: ... @overload def prod( self, @@ -1538,14 +1555,14 @@ class _ArrayOrScalarCommon: initial: _NumberLike_co = ..., where: _ArrayLikeBool = ..., ) -> _NdArraySubClass: ... + @overload def ptp( - self, axis: None = ..., out: None = ..., keepdims: Literal[False] = ..., - ) -> number: ... - @overload - def ptp( - self, axis: Optional[_ShapeLike] = ..., out: None = ..., keepdims: bool = ..., - ) -> Union[number, ndarray]: ... + self, + axis: Optional[_ShapeLike] = ..., + out: None = ..., + keepdims: bool = ..., + ) -> Any: ... @overload def ptp( self, @@ -1553,26 +1570,26 @@ class _ArrayOrScalarCommon: out: _NdArraySubClass = ..., keepdims: bool = ..., ) -> _NdArraySubClass: ... + def repeat( - self, repeats: _ArrayLikeIntOrBool, axis: Optional[SupportsIndex] = ... + self, + repeats: _ArrayLikeIntOrBool, + axis: Optional[SupportsIndex] = ..., ) -> ndarray: ... + @overload def round( - self: _ArraySelf, decimals: SupportsIndex = ..., out: None = ... + self: _ArraySelf, + decimals: SupportsIndex = ..., + out: None = ..., ) -> _ArraySelf: ... @overload def round( - self, decimals: SupportsIndex = ..., out: _NdArraySubClass = ... - ) -> _NdArraySubClass: ... - @overload - def std( self, - axis: None = ..., - dtype: DTypeLike = ..., - out: None = ..., - ddof: int = ..., - keepdims: Literal[False] = ..., - ) -> number: ... + decimals: SupportsIndex = ..., + out: _NdArraySubClass = ..., + ) -> _NdArraySubClass: ... + @overload def std( self, @@ -1581,7 +1598,7 @@ class _ArrayOrScalarCommon: out: None = ..., ddof: int = ..., keepdims: bool = ..., - ) -> Union[number, ndarray]: ... + ) -> Any: ... @overload def std( self, @@ -1591,16 +1608,7 @@ class _ArrayOrScalarCommon: ddof: int = ..., keepdims: bool = ..., ) -> _NdArraySubClass: ... - @overload - def sum( - self, - axis: None = ..., - dtype: DTypeLike = ..., - out: None = ..., - keepdims: Literal[False] = ..., - initial: _NumberLike_co = ..., - where: _ArrayLikeBool = ..., - ) -> number: ... + @overload def sum( self, @@ -1610,7 +1618,7 @@ class _ArrayOrScalarCommon: keepdims: bool = ..., initial: _NumberLike_co = ..., where: _ArrayLikeBool = ..., - ) -> Union[number, ndarray]: ... + ) -> Any: ... @overload def sum( self, @@ -1621,6 +1629,7 @@ class _ArrayOrScalarCommon: initial: _NumberLike_co = ..., where: _ArrayLikeBool = ..., ) -> _NdArraySubClass: ... + @overload def take( self, @@ -1628,7 +1637,7 @@ class _ArrayOrScalarCommon: axis: Optional[SupportsIndex] = ..., out: None = ..., mode: _ModeKind = ..., - ) -> generic: ... + ) -> Any: ... @overload def take( self, @@ -1645,15 +1654,7 @@ class _ArrayOrScalarCommon: out: _NdArraySubClass = ..., mode: _ModeKind = ..., ) -> _NdArraySubClass: ... - @overload - def var( - self, - axis: None = ..., - dtype: DTypeLike = ..., - out: None = ..., - ddof: int = ..., - keepdims: Literal[False] = ..., - ) -> number: ... + @overload def var( self, @@ -1662,7 +1663,7 @@ class _ArrayOrScalarCommon: out: None = ..., ddof: int = ..., keepdims: bool = ..., - ) -> Union[number, ndarray]: ... + ) -> Any: ... @overload def var( self, @@ -1772,7 +1773,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): axis2: SupportsIndex = ..., ) -> _ArraySelf: ... @overload - def dot(self, b: ArrayLike, out: None = ...) -> Union[number, ndarray]: ... + def dot(self, b: ArrayLike, out: None = ...) -> ndarray: ... @overload def dot(self, b: ArrayLike, out: _NdArraySubClass = ...) -> _NdArraySubClass: ... # `nonzero()` is deprecated for 0d arrays/generics @@ -1812,7 +1813,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): axis2: SupportsIndex = ..., dtype: DTypeLike = ..., out: None = ..., - ) -> Union[number, ndarray]: ... + ) -> Any: ... @overload def trace( self, # >= 2D array @@ -1843,105 +1844,105 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __lt__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __lt__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> _ArrayOrScalar[bool_]: ... + def __lt__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> _ArrayND[bool_]: ... @overload - def __lt__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayOrScalar[bool_]: ... + def __lt__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayND[bool_]: ... @overload - def __lt__(self: _ArrayND[datetime64], other: _ArrayLikeDT64_co) -> _ArrayOrScalar[bool_]: ... + def __lt__(self: _ArrayND[datetime64], other: _ArrayLikeDT64_co) -> _ArrayND[bool_]: ... @overload - def __lt__(self: _ArrayND[object_], other: Any) -> _ArrayOrScalar[bool_]: ... + def __lt__(self: _ArrayND[object_], other: Any) -> _ArrayND[bool_]: ... @overload - def __lt__(self: _ArrayND[Any], other: _ArrayLikeObject_co) -> _ArrayOrScalar[bool_]: ... + def __lt__(self: _ArrayND[Any], other: _ArrayLikeObject_co) -> _ArrayND[bool_]: ... @overload def __lt__( self: _ArrayND[Union[number[Any], datetime64, timedelta64, bool_]], other: _RecursiveSequence, - ) -> _ArrayOrScalar[bool_]: ... + ) -> _ArrayND[bool_]: ... @overload def __le__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __le__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> _ArrayOrScalar[bool_]: ... + def __le__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> _ArrayND[bool_]: ... @overload - def __le__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayOrScalar[bool_]: ... + def __le__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayND[bool_]: ... @overload - def __le__(self: _ArrayND[datetime64], other: _ArrayLikeDT64_co) -> _ArrayOrScalar[bool_]: ... + def __le__(self: _ArrayND[datetime64], other: _ArrayLikeDT64_co) -> _ArrayND[bool_]: ... @overload - def __le__(self: _ArrayND[object_], other: Any) -> _ArrayOrScalar[bool_]: ... + def __le__(self: _ArrayND[object_], other: Any) -> _ArrayND[bool_]: ... @overload - def __le__(self: _ArrayND[Any], other: _ArrayLikeObject_co) -> _ArrayOrScalar[bool_]: ... + def __le__(self: _ArrayND[Any], other: _ArrayLikeObject_co) -> _ArrayND[bool_]: ... @overload def __le__( self: _ArrayND[Union[number[Any], datetime64, timedelta64, bool_]], other: _RecursiveSequence, - ) -> _ArrayOrScalar[bool_]: ... + ) -> _ArrayND[bool_]: ... @overload def __gt__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __gt__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> _ArrayOrScalar[bool_]: ... + def __gt__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> _ArrayND[bool_]: ... @overload - def __gt__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayOrScalar[bool_]: ... + def __gt__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayND[bool_]: ... @overload - def __gt__(self: _ArrayND[datetime64], other: _ArrayLikeDT64_co) -> _ArrayOrScalar[bool_]: ... + def __gt__(self: _ArrayND[datetime64], other: _ArrayLikeDT64_co) -> _ArrayND[bool_]: ... @overload - def __gt__(self: _ArrayND[object_], other: Any) -> _ArrayOrScalar[bool_]: ... + def __gt__(self: _ArrayND[object_], other: Any) -> _ArrayND[bool_]: ... @overload - def __gt__(self: _ArrayND[Any], other: _ArrayLikeObject_co) -> _ArrayOrScalar[bool_]: ... + def __gt__(self: _ArrayND[Any], other: _ArrayLikeObject_co) -> _ArrayND[bool_]: ... @overload def __gt__( self: _ArrayND[Union[number[Any], datetime64, timedelta64, bool_]], other: _RecursiveSequence, - ) -> _ArrayOrScalar[bool_]: ... + ) -> _ArrayND[bool_]: ... @overload def __ge__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __ge__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> _ArrayOrScalar[bool_]: ... + def __ge__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> _ArrayND[bool_]: ... @overload - def __ge__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayOrScalar[bool_]: ... + def __ge__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayND[bool_]: ... @overload - def __ge__(self: _ArrayND[datetime64], other: _ArrayLikeDT64_co) -> _ArrayOrScalar[bool_]: ... + def __ge__(self: _ArrayND[datetime64], other: _ArrayLikeDT64_co) -> _ArrayND[bool_]: ... @overload - def __ge__(self: _ArrayND[object_], other: Any) -> _ArrayOrScalar[bool_]: ... + def __ge__(self: _ArrayND[object_], other: Any) -> _ArrayND[bool_]: ... @overload - def __ge__(self: _ArrayND[Any], other: _ArrayLikeObject_co) -> _ArrayOrScalar[bool_]: ... + def __ge__(self: _ArrayND[Any], other: _ArrayLikeObject_co) -> _ArrayND[bool_]: ... @overload def __ge__( self: _ArrayND[Union[number[Any], datetime64, timedelta64, bool_]], other: _RecursiveSequence, - ) -> _ArrayOrScalar[bool_]: ... + ) -> _ArrayND[bool_]: ... # Unary ops @overload - def __abs__(self: _ArrayND[bool_]) -> _ArrayOrScalar[bool_]: ... + def __abs__(self: _ArrayND[bool_]) -> _ArrayND[bool_]: ... @overload - def __abs__(self: _ArrayND[complexfloating[_NBit1, _NBit1]]) -> _ArrayOrScalar[floating[_NBit1]]: ... + def __abs__(self: _ArrayND[complexfloating[_NBit1, _NBit1]]) -> _ArrayND[floating[_NBit1]]: ... @overload - def __abs__(self: _ArrayND[_NumberType]) -> _ArrayOrScalar[_NumberType]: ... + def __abs__(self: _ArrayND[_NumberType]) -> _ArrayND[_NumberType]: ... @overload - def __abs__(self: _ArrayND[timedelta64]) -> _ArrayOrScalar[timedelta64]: ... + def __abs__(self: _ArrayND[timedelta64]) -> _ArrayND[timedelta64]: ... @overload def __abs__(self: _ArrayND[object_]) -> Any: ... @overload - def __invert__(self: _ArrayND[bool_]) -> _ArrayOrScalar[bool_]: ... + def __invert__(self: _ArrayND[bool_]) -> _ArrayND[bool_]: ... @overload - def __invert__(self: _ArrayND[_IntType]) -> _ArrayOrScalar[_IntType]: ... + def __invert__(self: _ArrayND[_IntType]) -> _ArrayND[_IntType]: ... @overload def __invert__(self: _ArrayND[object_]) -> Any: ... @overload - def __pos__(self: _ArrayND[_NumberType]) -> _ArrayOrScalar[_NumberType]: ... + def __pos__(self: _ArrayND[_NumberType]) -> _ArrayND[_NumberType]: ... @overload - def __pos__(self: _ArrayND[timedelta64]) -> _ArrayOrScalar[timedelta64]: ... + def __pos__(self: _ArrayND[timedelta64]) -> _ArrayND[timedelta64]: ... @overload def __pos__(self: _ArrayND[object_]) -> Any: ... @overload - def __neg__(self: _ArrayND[_NumberType]) -> _ArrayOrScalar[_NumberType]: ... + def __neg__(self: _ArrayND[_NumberType]) -> _ArrayND[_NumberType]: ... @overload - def __neg__(self: _ArrayND[timedelta64]) -> _ArrayOrScalar[timedelta64]: ... + def __neg__(self: _ArrayND[timedelta64]) -> _ArrayND[timedelta64]: ... @overload def __neg__(self: _ArrayND[object_]) -> Any: ... @@ -1950,15 +1951,15 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __matmul__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __matmul__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[bool_]: ... # type: ignore[misc] + def __matmul__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[bool_]: ... # type: ignore[misc] @overload - def __matmul__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __matmul__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __matmul__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... # type: ignore[misc] + def __matmul__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... # type: ignore[misc] @overload - def __matmul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __matmul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __matmul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayOrScalar[complexfloating[Any, Any]]: ... + def __matmul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayND[complexfloating[Any, Any]]: ... @overload def __matmul__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -1972,15 +1973,15 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __rmatmul__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __rmatmul__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[bool_]: ... # type: ignore[misc] + def __rmatmul__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[bool_]: ... # type: ignore[misc] @overload - def __rmatmul__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rmatmul__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __rmatmul__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... # type: ignore[misc] + def __rmatmul__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... # type: ignore[misc] @overload - def __rmatmul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __rmatmul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __rmatmul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayOrScalar[complexfloating[Any, Any]]: ... + def __rmatmul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayND[complexfloating[Any, Any]]: ... @overload def __rmatmul__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -1994,15 +1995,15 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __mod__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __mod__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[int8]: ... # type: ignore[misc] + def __mod__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[int8]: ... # type: ignore[misc] @overload - def __mod__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __mod__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __mod__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... # type: ignore[misc] + def __mod__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... # type: ignore[misc] @overload - def __mod__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __mod__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __mod__(self: _ArrayTD64_co, other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> _ArrayOrScalar[timedelta64]: ... + def __mod__(self: _ArrayTD64_co, other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> _ArrayND[timedelta64]: ... @overload def __mod__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2016,15 +2017,15 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __rmod__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __rmod__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[int8]: ... # type: ignore[misc] + def __rmod__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[int8]: ... # type: ignore[misc] @overload - def __rmod__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rmod__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __rmod__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... # type: ignore[misc] + def __rmod__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... # type: ignore[misc] @overload - def __rmod__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __rmod__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __rmod__(self: _ArrayTD64_co, other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> _ArrayOrScalar[timedelta64]: ... + def __rmod__(self: _ArrayTD64_co, other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> _ArrayND[timedelta64]: ... @overload def __rmod__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2038,15 +2039,15 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __divmod__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __divmod__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _2Tuple[_ArrayOrScalar[int8]]: ... # type: ignore[misc] + def __divmod__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _2Tuple[_ArrayND[int8]]: ... # type: ignore[misc] @overload - def __divmod__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _2Tuple[_ArrayOrScalar[unsignedinteger[Any]]]: ... # type: ignore[misc] + def __divmod__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _2Tuple[_ArrayND[unsignedinteger[Any]]]: ... # type: ignore[misc] @overload - def __divmod__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _2Tuple[_ArrayOrScalar[signedinteger[Any]]]: ... # type: ignore[misc] + def __divmod__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _2Tuple[_ArrayND[signedinteger[Any]]]: ... # type: ignore[misc] @overload - def __divmod__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _2Tuple[_ArrayOrScalar[floating[Any]]]: ... # type: ignore[misc] + def __divmod__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _2Tuple[_ArrayND[floating[Any]]]: ... # type: ignore[misc] @overload - def __divmod__(self: _ArrayTD64_co, other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> Union[Tuple[int64, timedelta64], Tuple[_ArrayND[int64], _ArrayND[timedelta64]]]: ... + def __divmod__(self: _ArrayTD64_co, other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> Tuple[_ArrayND[int64], _ArrayND[timedelta64]]: ... @overload def __divmod__( self: _ArrayND[Union[bool_, integer[Any], floating[Any], timedelta64]], @@ -2056,15 +2057,15 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __rdivmod__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __rdivmod__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _2Tuple[_ArrayOrScalar[int8]]: ... # type: ignore[misc] + def __rdivmod__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _2Tuple[_ArrayND[int8]]: ... # type: ignore[misc] @overload - def __rdivmod__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _2Tuple[_ArrayOrScalar[unsignedinteger[Any]]]: ... # type: ignore[misc] + def __rdivmod__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _2Tuple[_ArrayND[unsignedinteger[Any]]]: ... # type: ignore[misc] @overload - def __rdivmod__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _2Tuple[_ArrayOrScalar[signedinteger[Any]]]: ... # type: ignore[misc] + def __rdivmod__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _2Tuple[_ArrayND[signedinteger[Any]]]: ... # type: ignore[misc] @overload - def __rdivmod__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _2Tuple[_ArrayOrScalar[floating[Any]]]: ... # type: ignore[misc] + def __rdivmod__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _2Tuple[_ArrayND[floating[Any]]]: ... # type: ignore[misc] @overload - def __rdivmod__(self: _ArrayTD64_co, other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> Union[Tuple[int64, timedelta64], Tuple[_ArrayND[int64], _ArrayND[timedelta64]]]: ... + def __rdivmod__(self: _ArrayTD64_co, other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> Tuple[_ArrayND[int64], _ArrayND[timedelta64]]: ... @overload def __rdivmod__( self: _ArrayND[Union[bool_, integer[Any], floating[Any], timedelta64]], @@ -2074,21 +2075,21 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __add__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __add__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[bool_]: ... # type: ignore[misc] + def __add__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[bool_]: ... # type: ignore[misc] @overload - def __add__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __add__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __add__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... # type: ignore[misc] + def __add__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... # type: ignore[misc] @overload - def __add__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __add__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __add__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayOrScalar[complexfloating[Any, Any]]: ... # type: ignore[misc] + def __add__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayND[complexfloating[Any, Any]]: ... # type: ignore[misc] @overload - def __add__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayOrScalar[timedelta64]: ... # type: ignore[misc] + def __add__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayND[timedelta64]: ... # type: ignore[misc] @overload - def __add__(self: _ArrayTD64_co, other: _ArrayLikeDT64_co) -> _ArrayOrScalar[datetime64]: ... + def __add__(self: _ArrayTD64_co, other: _ArrayLikeDT64_co) -> _ArrayND[datetime64]: ... @overload - def __add__(self: _ArrayND[datetime64], other: _ArrayLikeTD64_co) -> _ArrayOrScalar[datetime64]: ... + def __add__(self: _ArrayND[datetime64], other: _ArrayLikeTD64_co) -> _ArrayND[datetime64]: ... @overload def __add__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2102,21 +2103,21 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __radd__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __radd__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[bool_]: ... # type: ignore[misc] + def __radd__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[bool_]: ... # type: ignore[misc] @overload - def __radd__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __radd__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __radd__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... # type: ignore[misc] + def __radd__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... # type: ignore[misc] @overload - def __radd__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __radd__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __radd__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayOrScalar[complexfloating[Any, Any]]: ... # type: ignore[misc] + def __radd__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayND[complexfloating[Any, Any]]: ... # type: ignore[misc] @overload - def __radd__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayOrScalar[timedelta64]: ... # type: ignore[misc] + def __radd__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayND[timedelta64]: ... # type: ignore[misc] @overload - def __radd__(self: _ArrayTD64_co, other: _ArrayLikeDT64_co) -> _ArrayOrScalar[datetime64]: ... + def __radd__(self: _ArrayTD64_co, other: _ArrayLikeDT64_co) -> _ArrayND[datetime64]: ... @overload - def __radd__(self: _ArrayND[datetime64], other: _ArrayLikeTD64_co) -> _ArrayOrScalar[datetime64]: ... + def __radd__(self: _ArrayND[datetime64], other: _ArrayLikeTD64_co) -> _ArrayND[datetime64]: ... @overload def __radd__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2132,19 +2133,19 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __sub__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> NoReturn: ... @overload - def __sub__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __sub__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __sub__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... # type: ignore[misc] + def __sub__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... # type: ignore[misc] @overload - def __sub__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __sub__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __sub__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayOrScalar[complexfloating[Any, Any]]: ... # type: ignore[misc] + def __sub__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayND[complexfloating[Any, Any]]: ... # type: ignore[misc] @overload - def __sub__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayOrScalar[timedelta64]: ... # type: ignore[misc] + def __sub__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayND[timedelta64]: ... # type: ignore[misc] @overload - def __sub__(self: _ArrayND[datetime64], other: _ArrayLikeTD64_co) -> _ArrayOrScalar[datetime64]: ... + def __sub__(self: _ArrayND[datetime64], other: _ArrayLikeTD64_co) -> _ArrayND[datetime64]: ... @overload - def __sub__(self: _ArrayND[datetime64], other: _ArrayLikeDT64_co) -> _ArrayOrScalar[timedelta64]: ... + def __sub__(self: _ArrayND[datetime64], other: _ArrayLikeDT64_co) -> _ArrayND[timedelta64]: ... @overload def __sub__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2160,19 +2161,19 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __rsub__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> NoReturn: ... @overload - def __rsub__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rsub__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __rsub__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... # type: ignore[misc] + def __rsub__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... # type: ignore[misc] @overload - def __rsub__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __rsub__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __rsub__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayOrScalar[complexfloating[Any, Any]]: ... # type: ignore[misc] + def __rsub__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayND[complexfloating[Any, Any]]: ... # type: ignore[misc] @overload - def __rsub__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayOrScalar[timedelta64]: ... # type: ignore[misc] + def __rsub__(self: _ArrayTD64_co, other: _ArrayLikeTD64_co) -> _ArrayND[timedelta64]: ... # type: ignore[misc] @overload - def __rsub__(self: _ArrayTD64_co, other: _ArrayLikeDT64_co) -> _ArrayOrScalar[datetime64]: ... # type: ignore[misc] + def __rsub__(self: _ArrayTD64_co, other: _ArrayLikeDT64_co) -> _ArrayND[datetime64]: ... # type: ignore[misc] @overload - def __rsub__(self: _ArrayND[datetime64], other: _ArrayLikeDT64_co) -> _ArrayOrScalar[timedelta64]: ... + def __rsub__(self: _ArrayND[datetime64], other: _ArrayLikeDT64_co) -> _ArrayND[timedelta64]: ... @overload def __rsub__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2186,19 +2187,19 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __mul__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __mul__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[bool_]: ... # type: ignore[misc] + def __mul__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[bool_]: ... # type: ignore[misc] @overload - def __mul__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __mul__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __mul__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... # type: ignore[misc] + def __mul__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... # type: ignore[misc] @overload - def __mul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __mul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __mul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayOrScalar[complexfloating[Any, Any]]: ... # type: ignore[misc] + def __mul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayND[complexfloating[Any, Any]]: ... # type: ignore[misc] @overload - def __mul__(self: _ArrayTD64_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[timedelta64]: ... + def __mul__(self: _ArrayTD64_co, other: _ArrayLikeFloat_co) -> _ArrayND[timedelta64]: ... @overload - def __mul__(self: _ArrayFloat_co, other: _ArrayLikeTD64_co) -> _ArrayOrScalar[timedelta64]: ... + def __mul__(self: _ArrayFloat_co, other: _ArrayLikeTD64_co) -> _ArrayND[timedelta64]: ... @overload def __mul__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2212,19 +2213,19 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __rmul__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __rmul__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[bool_]: ... # type: ignore[misc] + def __rmul__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[bool_]: ... # type: ignore[misc] @overload - def __rmul__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rmul__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __rmul__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... # type: ignore[misc] + def __rmul__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... # type: ignore[misc] @overload - def __rmul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __rmul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __rmul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayOrScalar[complexfloating[Any, Any]]: ... # type: ignore[misc] + def __rmul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayND[complexfloating[Any, Any]]: ... # type: ignore[misc] @overload - def __rmul__(self: _ArrayTD64_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[timedelta64]: ... + def __rmul__(self: _ArrayTD64_co, other: _ArrayLikeFloat_co) -> _ArrayND[timedelta64]: ... @overload - def __rmul__(self: _ArrayFloat_co, other: _ArrayLikeTD64_co) -> _ArrayOrScalar[timedelta64]: ... + def __rmul__(self: _ArrayFloat_co, other: _ArrayLikeTD64_co) -> _ArrayND[timedelta64]: ... @overload def __rmul__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2238,21 +2239,21 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __floordiv__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __floordiv__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[int8]: ... # type: ignore[misc] + def __floordiv__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[int8]: ... # type: ignore[misc] @overload - def __floordiv__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __floordiv__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __floordiv__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... # type: ignore[misc] + def __floordiv__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... # type: ignore[misc] @overload - def __floordiv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __floordiv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __floordiv__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayOrScalar[complexfloating[Any, Any]]: ... # type: ignore[misc] + def __floordiv__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayND[complexfloating[Any, Any]]: ... # type: ignore[misc] @overload - def __floordiv__(self: _ArrayND[timedelta64], other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> _ArrayOrScalar[int64]: ... + def __floordiv__(self: _ArrayND[timedelta64], other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> _ArrayND[int64]: ... @overload def __floordiv__(self: _ArrayND[timedelta64], other: _ArrayLikeBool_co) -> NoReturn: ... @overload - def __floordiv__(self: _ArrayND[timedelta64], other: _ArrayLikeFloat_co) -> _ArrayOrScalar[timedelta64]: ... + def __floordiv__(self: _ArrayND[timedelta64], other: _ArrayLikeFloat_co) -> _ArrayND[timedelta64]: ... @overload def __floordiv__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2266,21 +2267,21 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __rfloordiv__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __rfloordiv__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[int8]: ... # type: ignore[misc] + def __rfloordiv__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[int8]: ... # type: ignore[misc] @overload - def __rfloordiv__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rfloordiv__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __rfloordiv__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... # type: ignore[misc] + def __rfloordiv__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... # type: ignore[misc] @overload - def __rfloordiv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __rfloordiv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __rfloordiv__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayOrScalar[complexfloating[Any, Any]]: ... # type: ignore[misc] + def __rfloordiv__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayND[complexfloating[Any, Any]]: ... # type: ignore[misc] @overload - def __rfloordiv__(self: _ArrayND[timedelta64], other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> _ArrayOrScalar[int64]: ... + def __rfloordiv__(self: _ArrayND[timedelta64], other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> _ArrayND[int64]: ... @overload def __rfloordiv__(self: _ArrayND[bool_], other: _ArrayLikeTD64_co) -> NoReturn: ... @overload - def __rfloordiv__(self: _ArrayFloat_co, other: _ArrayLikeTD64_co) -> _ArrayOrScalar[timedelta64]: ... + def __rfloordiv__(self: _ArrayFloat_co, other: _ArrayLikeTD64_co) -> _ArrayND[timedelta64]: ... @overload def __rfloordiv__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2294,15 +2295,15 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __pow__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __pow__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[int8]: ... # type: ignore[misc] + def __pow__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[int8]: ... # type: ignore[misc] @overload - def __pow__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __pow__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __pow__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... # type: ignore[misc] + def __pow__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... # type: ignore[misc] @overload - def __pow__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __pow__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __pow__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayOrScalar[complexfloating[Any, Any]]: ... + def __pow__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayND[complexfloating[Any, Any]]: ... @overload def __pow__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2316,15 +2317,15 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __rpow__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __rpow__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[int8]: ... # type: ignore[misc] + def __rpow__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[int8]: ... # type: ignore[misc] @overload - def __rpow__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rpow__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __rpow__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... # type: ignore[misc] + def __rpow__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... # type: ignore[misc] @overload - def __rpow__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __rpow__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __rpow__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayOrScalar[complexfloating[Any, Any]]: ... + def __rpow__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayND[complexfloating[Any, Any]]: ... @overload def __rpow__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2338,17 +2339,17 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __truediv__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __truediv__(self: _ArrayInt_co, other: _ArrayInt_co) -> _ArrayOrScalar[float64]: ... # type: ignore[misc] + def __truediv__(self: _ArrayInt_co, other: _ArrayInt_co) -> _ArrayND[float64]: ... # type: ignore[misc] @overload - def __truediv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __truediv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __truediv__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayOrScalar[complexfloating[Any, Any]]: ... # type: ignore[misc] + def __truediv__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayND[complexfloating[Any, Any]]: ... # type: ignore[misc] @overload - def __truediv__(self: _ArrayND[timedelta64], other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> _ArrayOrScalar[float64]: ... + def __truediv__(self: _ArrayND[timedelta64], other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> _ArrayND[float64]: ... @overload def __truediv__(self: _ArrayND[timedelta64], other: _ArrayLikeBool_co) -> NoReturn: ... @overload - def __truediv__(self: _ArrayND[timedelta64], other: _ArrayLikeFloat_co) -> _ArrayOrScalar[timedelta64]: ... + def __truediv__(self: _ArrayND[timedelta64], other: _ArrayLikeFloat_co) -> _ArrayND[timedelta64]: ... @overload def __truediv__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2362,17 +2363,17 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __rtruediv__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __rtruediv__(self: _ArrayInt_co, other: _ArrayInt_co) -> _ArrayOrScalar[float64]: ... # type: ignore[misc] + def __rtruediv__(self: _ArrayInt_co, other: _ArrayInt_co) -> _ArrayND[float64]: ... # type: ignore[misc] @overload - def __rtruediv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayOrScalar[floating[Any]]: ... # type: ignore[misc] + def __rtruediv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co) -> _ArrayND[floating[Any]]: ... # type: ignore[misc] @overload - def __rtruediv__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayOrScalar[complexfloating[Any, Any]]: ... # type: ignore[misc] + def __rtruediv__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co) -> _ArrayND[complexfloating[Any, Any]]: ... # type: ignore[misc] @overload - def __rtruediv__(self: _ArrayND[timedelta64], other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> _ArrayOrScalar[float64]: ... + def __rtruediv__(self: _ArrayND[timedelta64], other: _NestedSequence[_SupportsArray[dtype[timedelta64]]]) -> _ArrayND[float64]: ... @overload def __rtruediv__(self: _ArrayND[bool_], other: _ArrayLikeTD64_co) -> NoReturn: ... @overload - def __rtruediv__(self: _ArrayFloat_co, other: _ArrayLikeTD64_co) -> _ArrayOrScalar[timedelta64]: ... + def __rtruediv__(self: _ArrayFloat_co, other: _ArrayLikeTD64_co) -> _ArrayND[timedelta64]: ... @overload def __rtruediv__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2386,11 +2387,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __lshift__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __lshift__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[int8]: ... # type: ignore[misc] + def __lshift__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[int8]: ... # type: ignore[misc] @overload - def __lshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __lshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __lshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... + def __lshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... @overload def __lshift__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2404,11 +2405,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __rlshift__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __rlshift__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[int8]: ... # type: ignore[misc] + def __rlshift__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[int8]: ... # type: ignore[misc] @overload - def __rlshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rlshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __rlshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... + def __rlshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... @overload def __rlshift__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2422,11 +2423,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __rshift__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __rshift__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[int8]: ... # type: ignore[misc] + def __rshift__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[int8]: ... # type: ignore[misc] @overload - def __rshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __rshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... + def __rshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... @overload def __rshift__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2440,11 +2441,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __rrshift__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __rrshift__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[int8]: ... # type: ignore[misc] + def __rrshift__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[int8]: ... # type: ignore[misc] @overload - def __rrshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rrshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __rrshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... + def __rrshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... @overload def __rrshift__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2458,11 +2459,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __and__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __and__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[bool_]: ... # type: ignore[misc] + def __and__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[bool_]: ... # type: ignore[misc] @overload - def __and__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __and__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __and__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... + def __and__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... @overload def __and__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2476,11 +2477,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __rand__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __rand__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[bool_]: ... # type: ignore[misc] + def __rand__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[bool_]: ... # type: ignore[misc] @overload - def __rand__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rand__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __rand__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... + def __rand__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... @overload def __rand__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2494,11 +2495,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __xor__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __xor__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[bool_]: ... # type: ignore[misc] + def __xor__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[bool_]: ... # type: ignore[misc] @overload - def __xor__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __xor__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __xor__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... + def __xor__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... @overload def __xor__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2512,11 +2513,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __rxor__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __rxor__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[bool_]: ... # type: ignore[misc] + def __rxor__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[bool_]: ... # type: ignore[misc] @overload - def __rxor__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rxor__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __rxor__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... + def __rxor__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... @overload def __rxor__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2530,11 +2531,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __or__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __or__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[bool_]: ... # type: ignore[misc] + def __or__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[bool_]: ... # type: ignore[misc] @overload - def __or__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __or__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __or__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... + def __or__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... @overload def __or__(self: _ArrayND[object_], other: Any) -> Any: ... @overload @@ -2548,11 +2549,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]): @overload def __ror__(self: _ArrayND[Any], other: _NestedSequence[Union[str, bytes]]) -> NoReturn: ... @overload - def __ror__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayOrScalar[bool_]: ... # type: ignore[misc] + def __ror__(self: _ArrayND[bool_], other: _ArrayLikeBool_co) -> _ArrayND[bool_]: ... # type: ignore[misc] @overload - def __ror__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayOrScalar[unsignedinteger[Any]]: ... # type: ignore[misc] + def __ror__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co) -> _ArrayND[unsignedinteger[Any]]: ... # type: ignore[misc] @overload - def __ror__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayOrScalar[signedinteger[Any]]: ... + def __ror__(self: _ArrayInt_co, other: _ArrayLikeInt_co) -> _ArrayND[signedinteger[Any]]: ... @overload def __ror__(self: _ArrayND[object_], other: Any) -> Any: ... @overload diff --git a/numpy/core/einsumfunc.pyi b/numpy/core/einsumfunc.pyi index b33aff29f..2457e8719 100644 --- a/numpy/core/einsumfunc.pyi +++ b/numpy/core/einsumfunc.pyi @@ -13,7 +13,6 @@ from numpy import ( _OrderKACF, ) from numpy.typing import ( - _ArrayOrScalar, _ArrayLikeBool_co, _ArrayLikeUInt_co, _ArrayLikeInt_co, @@ -46,6 +45,11 @@ _CastingUnsafe = Literal["unsafe"] __all__: List[str] # TODO: Properly handle the `casting`-based combinatorics +# TODO: We need to evaluate the content `__subscripts` in order +# to identify whether or an array or scalar is returned. At a cursory +# glance this seems like something that can quite easilly be done with +# a mypy plugin. +# Something like `is_scalar = bool(__subscripts.partition("->")[-1])` @overload def einsum( __subscripts: str, @@ -55,7 +59,7 @@ def einsum( order: _OrderKACF = ..., casting: _CastingSafe = ..., optimize: _OptimizeKind = ..., -) -> _ArrayOrScalar[bool_]: ... +) -> Any: ... @overload def einsum( __subscripts: str, @@ -65,7 +69,7 @@ def einsum( order: _OrderKACF = ..., casting: _CastingSafe = ..., optimize: _OptimizeKind = ..., -) -> _ArrayOrScalar[unsignedinteger[Any]]: ... +) -> Any: ... @overload def einsum( __subscripts: str, @@ -75,7 +79,7 @@ def einsum( order: _OrderKACF = ..., casting: _CastingSafe = ..., optimize: _OptimizeKind = ..., -) -> _ArrayOrScalar[signedinteger[Any]]: ... +) -> Any: ... @overload def einsum( __subscripts: str, @@ -85,7 +89,7 @@ def einsum( order: _OrderKACF = ..., casting: _CastingSafe = ..., optimize: _OptimizeKind = ..., -) -> _ArrayOrScalar[floating[Any]]: ... +) -> Any: ... @overload def einsum( __subscripts: str, @@ -95,7 +99,7 @@ def einsum( order: _OrderKACF = ..., casting: _CastingSafe = ..., optimize: _OptimizeKind = ..., -) -> _ArrayOrScalar[complexfloating[Any, Any]]: ... +) -> Any: ... @overload def einsum( __subscripts: str, @@ -105,7 +109,7 @@ def einsum( out: None = ..., order: _OrderKACF = ..., optimize: _OptimizeKind = ..., -) -> _ArrayOrScalar[Any]: ... +) -> Any: ... @overload def einsum( __subscripts: str, diff --git a/numpy/core/fromnumeric.pyi b/numpy/core/fromnumeric.pyi index fc7f28a59..26a43c1a0 100644 --- a/numpy/core/fromnumeric.pyi +++ b/numpy/core/fromnumeric.pyi @@ -23,7 +23,6 @@ from numpy.typing import ( ArrayLike, _ShapeLike, _Shape, - _IntLike_co, _NumberLike_co, ) @@ -42,11 +41,7 @@ _ScalarBuiltin = Union[str, bytes, dt.date, dt.timedelta, bool, int, float, comp _Scalar = Union[_ScalarBuiltin, _ScalarNumpy] # Integers and booleans can generally be used interchangeably -_ScalarIntOrBool = TypeVar("_ScalarIntOrBool", bound=Union[integer, bool_]) _ScalarGeneric = TypeVar("_ScalarGeneric", bound=generic) -_ScalarGenericDT = TypeVar( - "_ScalarGenericDT", bound=Union[dt.datetime, dt.timedelta, generic] -) _Number = TypeVar("_Number", bound=number) @@ -55,67 +50,51 @@ _Number = TypeVar("_Number", bound=number) # 2. A scalar comes in; a generic comes out # 3. An array-like object comes in; some keyword ensures that a generic comes out # 4. An array-like object comes in; an ndarray or generic comes out -@overload -def take( - a: _ScalarGenericDT, - indices: int, - axis: Optional[int] = ..., - out: Optional[ndarray] = ..., - mode: _ModeKind = ..., -) -> _ScalarGenericDT: ... -@overload -def take( - a: _Scalar, - indices: int, - axis: Optional[int] = ..., - out: Optional[ndarray] = ..., - mode: _ModeKind = ..., -) -> _ScalarNumpy: ... -@overload -def take( - a: ArrayLike, - indices: int, - axis: Optional[int] = ..., - out: Optional[ndarray] = ..., - mode: _ModeKind = ..., -) -> _ScalarNumpy: ... -@overload def take( a: ArrayLike, indices: _ArrayLikeIntOrBool, axis: Optional[int] = ..., out: Optional[ndarray] = ..., mode: _ModeKind = ..., -) -> Union[_ScalarNumpy, ndarray]: ... -def reshape(a: ArrayLike, newshape: _ShapeLike, order: _OrderACF = ...) -> ndarray: ... -@overload -def choose( - a: _ScalarIntOrBool, - choices: ArrayLike, - out: Optional[ndarray] = ..., - mode: _ModeKind = ..., -) -> _ScalarIntOrBool: ... -@overload -def choose( - a: _IntLike_co, choices: ArrayLike, out: Optional[ndarray] = ..., mode: _ModeKind = ... -) -> Union[integer, bool_]: ... -@overload +) -> Any: ... + +def reshape( + a: ArrayLike, + newshape: _ShapeLike, + order: _OrderACF = ..., +) -> ndarray: ... + def choose( a: _ArrayLikeIntOrBool, choices: ArrayLike, out: Optional[ndarray] = ..., mode: _ModeKind = ..., -) -> ndarray: ... +) -> Any: ... + def repeat( - a: ArrayLike, repeats: _ArrayLikeIntOrBool, axis: Optional[int] = ... + a: ArrayLike, + repeats: _ArrayLikeIntOrBool, + axis: Optional[int] = ..., ) -> ndarray: ... + def put( - a: ndarray, ind: _ArrayLikeIntOrBool, v: ArrayLike, mode: _ModeKind = ... + a: ndarray, + ind: _ArrayLikeIntOrBool, + v: ArrayLike, + mode: _ModeKind = ..., ) -> None: ... -def swapaxes(a: ArrayLike, axis1: int, axis2: int) -> ndarray: ... + +def swapaxes( + a: ArrayLike, + axis1: int, + axis2: int, +) -> ndarray: ... + def transpose( - a: ArrayLike, axes: Union[None, Sequence[int], ndarray] = ... + a: ArrayLike, + axes: Union[None, Sequence[int], ndarray] = ... ) -> ndarray: ... + def partition( a: ArrayLike, kth: _ArrayLikeIntOrBool, @@ -123,54 +102,55 @@ def partition( kind: _PartitionKind = ..., order: Union[None, str, Sequence[str]] = ..., ) -> ndarray: ... -@overload -def argpartition( - a: generic, - kth: _ArrayLikeIntOrBool, - axis: Optional[int] = ..., - kind: _PartitionKind = ..., - order: Union[None, str, Sequence[str]] = ..., -) -> intp: ... -@overload -def argpartition( - a: _ScalarBuiltin, - kth: _ArrayLikeIntOrBool, - axis: Optional[int] = ..., - kind: _PartitionKind = ..., - order: Union[None, str, Sequence[str]] = ..., -) -> ndarray: ... -@overload + def argpartition( a: ArrayLike, kth: _ArrayLikeIntOrBool, axis: Optional[int] = ..., kind: _PartitionKind = ..., order: Union[None, str, Sequence[str]] = ..., -) -> ndarray: ... +) -> Any: ... + def sort( a: ArrayLike, axis: Optional[int] = ..., kind: Optional[_SortKind] = ..., order: Union[None, str, Sequence[str]] = ..., ) -> ndarray: ... + def argsort( a: ArrayLike, axis: Optional[int] = ..., kind: Optional[_SortKind] = ..., order: Union[None, str, Sequence[str]] = ..., ) -> ndarray: ... + @overload -def argmax(a: ArrayLike, axis: None = ..., out: Optional[ndarray] = ...) -> intp: ... +def argmax( + a: ArrayLike, + axis: None = ..., + out: Optional[ndarray] = ..., +) -> intp: ... @overload def argmax( - a: ArrayLike, axis: int = ..., out: Optional[ndarray] = ... -) -> Union[ndarray, intp]: ... + a: ArrayLike, + axis: Optional[int] = ..., + out: Optional[ndarray] = ..., +) -> Any: ... + @overload -def argmin(a: ArrayLike, axis: None = ..., out: Optional[ndarray] = ...) -> intp: ... +def argmin( + a: ArrayLike, + axis: None = ..., + out: Optional[ndarray] = ..., +) -> intp: ... @overload def argmin( - a: ArrayLike, axis: int = ..., out: Optional[ndarray] = ... -) -> Union[ndarray, intp]: ... + a: ArrayLike, + axis: Optional[int] = ..., + out: Optional[ndarray] = ..., +) -> Any: ... + @overload def searchsorted( a: ArrayLike, @@ -185,14 +165,30 @@ def searchsorted( side: _SortSide = ..., sorter: Optional[_ArrayLikeIntOrBool] = ..., # 1D int array ) -> ndarray: ... -def resize(a: ArrayLike, new_shape: _ShapeLike) -> ndarray: ... + +def resize( + a: ArrayLike, + new_shape: _ShapeLike, +) -> ndarray: ... + @overload -def squeeze(a: _ScalarGeneric, axis: Optional[_ShapeLike] = ...) -> _ScalarGeneric: ... +def squeeze( + a: _ScalarGeneric, + axis: Optional[_ShapeLike] = ..., +) -> _ScalarGeneric: ... @overload -def squeeze(a: ArrayLike, axis: Optional[_ShapeLike] = ...) -> ndarray: ... +def squeeze( + a: ArrayLike, + axis: Optional[_ShapeLike] = ..., +) -> ndarray: ... + def diagonal( - a: ArrayLike, offset: int = ..., axis1: int = ..., axis2: int = ... # >= 2D array + a: ArrayLike, + offset: int = ..., + axis1: int = ..., + axis2: int = ..., # >= 2D array ) -> ndarray: ... + def trace( a: ArrayLike, # >= 2D array offset: int = ..., @@ -200,32 +196,21 @@ def trace( axis2: int = ..., dtype: DTypeLike = ..., out: Optional[ndarray] = ..., -) -> Union[number, ndarray]: ... +) -> Any: ... + def ravel(a: ArrayLike, order: _OrderKACF = ...) -> ndarray: ... + def nonzero(a: ArrayLike) -> Tuple[ndarray, ...]: ... + def shape(a: ArrayLike) -> _Shape: ... + def compress( condition: ArrayLike, # 1D bool array a: ArrayLike, axis: Optional[int] = ..., out: Optional[ndarray] = ..., ) -> ndarray: ... -@overload -def clip( - a: _Number, - a_min: ArrayLike, - a_max: Optional[ArrayLike], - out: Optional[ndarray] = ..., - **kwargs: Any, -) -> _Number: ... -@overload -def clip( - a: _Number, - a_min: None, - a_max: ArrayLike, - out: Optional[ndarray] = ..., - **kwargs: Any, -) -> _Number: ... + @overload def clip( a: ArrayLike, @@ -233,7 +218,7 @@ def clip( a_max: Optional[ArrayLike], out: Optional[ndarray] = ..., **kwargs: Any, -) -> Union[number, ndarray]: ... +) -> Any: ... @overload def clip( a: ArrayLike, @@ -241,18 +226,8 @@ def clip( a_max: ArrayLike, out: Optional[ndarray] = ..., **kwargs: Any, -) -> Union[number, ndarray]: ... -@overload -def sum( - a: _Number, - axis: Optional[_ShapeLike] = ..., - dtype: DTypeLike = ..., - out: Optional[ndarray] = ..., - keepdims: bool = ..., - initial: _NumberLike_co = ..., - where: _ArrayLikeBool = ..., -) -> _Number: ... -@overload +) -> Any: ... + def sum( a: ArrayLike, axis: _ShapeLike = ..., @@ -261,12 +236,13 @@ def sum( keepdims: bool = ..., initial: _NumberLike_co = ..., where: _ArrayLikeBool = ..., -) -> Union[number, ndarray]: ... +) -> Any: ... + @overload def all( a: ArrayLike, axis: None = ..., - out: Optional[ndarray] = ..., + out: None = ..., keepdims: Literal[False] = ..., ) -> bool_: ... @overload @@ -275,12 +251,13 @@ def all( axis: Optional[_ShapeLike] = ..., out: Optional[ndarray] = ..., keepdims: bool = ..., -) -> Union[bool_, ndarray]: ... +) -> Any: ... + @overload def any( a: ArrayLike, axis: None = ..., - out: Optional[ndarray] = ..., + out: None = ..., keepdims: Literal[False] = ..., ) -> bool_: ... @overload @@ -289,53 +266,22 @@ def any( axis: Optional[_ShapeLike] = ..., out: Optional[ndarray] = ..., keepdims: bool = ..., -) -> Union[bool_, ndarray]: ... +) -> Any: ... + def cumsum( a: ArrayLike, axis: Optional[int] = ..., dtype: DTypeLike = ..., out: Optional[ndarray] = ..., ) -> ndarray: ... -@overload -def ptp( - a: _Number, - axis: Optional[_ShapeLike] = ..., - out: Optional[ndarray] = ..., - keepdims: bool = ..., -) -> _Number: ... -@overload -def ptp( - a: ArrayLike, - axis: None = ..., - out: Optional[ndarray] = ..., - keepdims: Literal[False] = ..., -) -> number: ... -@overload + def ptp( a: ArrayLike, axis: Optional[_ShapeLike] = ..., out: Optional[ndarray] = ..., keepdims: bool = ..., -) -> Union[number, ndarray]: ... -@overload -def amax( - a: _Number, - axis: Optional[_ShapeLike] = ..., - out: Optional[ndarray] = ..., - keepdims: bool = ..., - initial: _NumberLike_co = ..., - where: _ArrayLikeBool = ..., -) -> _Number: ... -@overload -def amax( - a: ArrayLike, - axis: None = ..., - out: Optional[ndarray] = ..., - keepdims: Literal[False] = ..., - initial: _NumberLike_co = ..., - where: _ArrayLikeBool = ..., -) -> number: ... -@overload +) -> Any: ... + def amax( a: ArrayLike, axis: Optional[_ShapeLike] = ..., @@ -343,26 +289,8 @@ def amax( keepdims: bool = ..., initial: _NumberLike_co = ..., where: _ArrayLikeBool = ..., -) -> Union[number, ndarray]: ... -@overload -def amin( - a: _Number, - axis: Optional[_ShapeLike] = ..., - out: Optional[ndarray] = ..., - keepdims: bool = ..., - initial: _NumberLike_co = ..., - where: _ArrayLikeBool = ..., -) -> _Number: ... -@overload -def amin( - a: ArrayLike, - axis: None = ..., - out: Optional[ndarray] = ..., - keepdims: Literal[False] = ..., - initial: _NumberLike_co = ..., - where: _ArrayLikeBool = ..., -) -> number: ... -@overload +) -> Any: ... + def amin( a: ArrayLike, axis: Optional[_ShapeLike] = ..., @@ -370,7 +298,7 @@ def amin( keepdims: bool = ..., initial: _NumberLike_co = ..., where: _ArrayLikeBool = ..., -) -> Union[number, ndarray]: ... +) -> Any: ... # TODO: `np.prod()``: For object arrays `initial` does not necessarily # have to be a numerical scalar. @@ -379,27 +307,6 @@ def amin( # Note that the same situation holds for all wrappers around # `np.ufunc.reduce`, e.g. `np.sum()` (`.__add__()`). -@overload -def prod( - a: _Number, - axis: Optional[_ShapeLike] = ..., - dtype: DTypeLike = ..., - out: None = ..., - keepdims: bool = ..., - initial: _NumberLike_co = ..., - where: _ArrayLikeBool = ..., -) -> _Number: ... -@overload -def prod( - a: ArrayLike, - axis: None = ..., - dtype: DTypeLike = ..., - out: None = ..., - keepdims: Literal[False] = ..., - initial: _NumberLike_co = ..., - where: _ArrayLikeBool = ..., -) -> number: ... -@overload def prod( a: ArrayLike, axis: Optional[_ShapeLike] = ..., @@ -408,53 +315,33 @@ def prod( keepdims: bool = ..., initial: _NumberLike_co = ..., where: _ArrayLikeBool = ..., -) -> Union[number, ndarray]: ... +) -> Any: ... + def cumprod( a: ArrayLike, axis: Optional[int] = ..., dtype: DTypeLike = ..., out: Optional[ndarray] = ..., ) -> ndarray: ... + def ndim(a: ArrayLike) -> int: ... + def size(a: ArrayLike, axis: Optional[int] = ...) -> int: ... -@overload -def around( - a: _Number, decimals: int = ..., out: Optional[ndarray] = ... -) -> _Number: ... -@overload -def around( - a: _NumberLike_co, decimals: int = ..., out: Optional[ndarray] = ... -) -> number: ... -@overload + def around( - a: ArrayLike, decimals: int = ..., out: Optional[ndarray] = ... -) -> ndarray: ... -@overload -def mean( a: ArrayLike, - axis: None = ..., - dtype: DTypeLike = ..., - out: None = ..., - keepdims: Literal[False] = ..., -) -> number: ... -@overload + decimals: int = ..., + out: Optional[ndarray] = ..., +) -> Any: ... + def mean( a: ArrayLike, axis: Optional[_ShapeLike] = ..., dtype: DTypeLike = ..., out: Optional[ndarray] = ..., keepdims: bool = ..., -) -> Union[number, ndarray]: ... -@overload -def std( - a: ArrayLike, - axis: None = ..., - dtype: DTypeLike = ..., - out: None = ..., - ddof: int = ..., - keepdims: Literal[False] = ..., -) -> number: ... -@overload +) -> Any: ... + def std( a: ArrayLike, axis: Optional[_ShapeLike] = ..., @@ -462,17 +349,8 @@ def std( out: Optional[ndarray] = ..., ddof: int = ..., keepdims: bool = ..., -) -> Union[number, ndarray]: ... -@overload -def var( - a: ArrayLike, - axis: None = ..., - dtype: DTypeLike = ..., - out: None = ..., - ddof: int = ..., - keepdims: Literal[False] = ..., -) -> number: ... -@overload +) -> Any: ... + def var( a: ArrayLike, axis: Optional[_ShapeLike] = ..., @@ -480,4 +358,4 @@ def var( out: Optional[ndarray] = ..., ddof: int = ..., keepdims: bool = ..., -) -> Union[number, ndarray]: ... +) -> Any: ... diff --git a/numpy/core/function_base.pyi b/numpy/core/function_base.pyi index d4543f281..b5d6ca6ab 100644 --- a/numpy/core/function_base.pyi +++ b/numpy/core/function_base.pyi @@ -1,7 +1,7 @@ import sys from typing import overload, Tuple, Union, Sequence, Any -from numpy import ndarray, inexact +from numpy import ndarray from numpy.typing import ArrayLike, DTypeLike, _SupportsArray, _NumberLike_co if sys.version_info >= (3, 8): @@ -33,7 +33,8 @@ def linspace( retstep: Literal[True] = ..., dtype: DTypeLike = ..., axis: SupportsIndex = ..., -) -> Tuple[ndarray, inexact]: ... +) -> Tuple[ndarray, Any]: ... + def logspace( start: _ArrayLikeNumber, stop: _ArrayLikeNumber, @@ -43,6 +44,7 @@ def logspace( dtype: DTypeLike = ..., axis: SupportsIndex = ..., ) -> ndarray: ... + def geomspace( start: _ArrayLikeNumber, stop: _ArrayLikeNumber, diff --git a/numpy/core/numeric.pyi b/numpy/core/numeric.pyi index d91cb31c2..6b9ef4b20 100644 --- a/numpy/core/numeric.pyi +++ b/numpy/core/numeric.pyi @@ -41,6 +41,7 @@ def zeros_like( subok: bool = ..., shape: Optional[_ShapeLike] = ..., ) -> ndarray: ... + def ones( shape: _ShapeLike, dtype: DTypeLike = ..., @@ -48,6 +49,7 @@ def ones( *, like: ArrayLike = ..., ) -> ndarray: ... + @overload def ones_like( a: _ArrayType, @@ -64,6 +66,7 @@ def ones_like( subok: bool = ..., shape: Optional[_ShapeLike] = ..., ) -> ndarray: ... + @overload def empty_like( a: _ArrayType, @@ -80,6 +83,7 @@ def empty_like( subok: bool = ..., shape: Optional[_ShapeLike] = ..., ) -> ndarray: ... + def full( shape: _ShapeLike, fill_value: Any, @@ -88,6 +92,7 @@ def full( *, like: ArrayLike = ..., ) -> ndarray: ... + @overload def full_like( a: _ArrayType, @@ -106,39 +111,73 @@ def full_like( subok: bool = ..., shape: Optional[_ShapeLike] = ..., ) -> ndarray: ... + @overload def count_nonzero( - a: ArrayLike, axis: None = ..., *, keepdims: Literal[False] = ... + a: ArrayLike, + axis: None = ..., + *, + keepdims: Literal[False] = ..., ) -> int: ... @overload def count_nonzero( - a: ArrayLike, axis: _ShapeLike = ..., *, keepdims: bool = ... -) -> Union[signedinteger[Any], ndarray]: ... # TODO: np.intp + a: ArrayLike, + axis: _ShapeLike = ..., + *, + keepdims: bool = ..., +) -> Any: ... # TODO: np.intp or ndarray[np.intp] + def isfortran(a: Union[ndarray, generic]) -> bool: ... + def argwhere(a: ArrayLike) -> ndarray: ... + def flatnonzero(a: ArrayLike) -> ndarray: ... -def correlate(a: ArrayLike, v: ArrayLike, mode: _CorrelateMode = ...) -> ndarray: ... -def convolve(a: ArrayLike, v: ArrayLike, mode: _CorrelateMode = ...) -> ndarray: ... + +def correlate( + a: ArrayLike, + v: ArrayLike, + mode: _CorrelateMode = ..., +) -> ndarray: ... + +def convolve( + a: ArrayLike, + v: ArrayLike, + mode: _CorrelateMode = ..., +) -> ndarray: ... + @overload -def outer(a: ArrayLike, b: ArrayLike, out: None = ...) -> ndarray: ... +def outer( + a: ArrayLike, + b: ArrayLike, + out: None = ..., +) -> ndarray: ... @overload -def outer(a: ArrayLike, b: ArrayLike, out: _ArrayType = ...) -> _ArrayType: ... +def outer( + a: ArrayLike, + b: ArrayLike, + out: _ArrayType = ..., +) -> _ArrayType: ... + def tensordot( a: ArrayLike, b: ArrayLike, axes: Union[int, Tuple[_ShapeLike, _ShapeLike]] = ..., ) -> ndarray: ... + def roll( a: ArrayLike, shift: _ShapeLike, axis: Optional[_ShapeLike] = ..., ) -> ndarray: ... + def rollaxis(a: ndarray, axis: int, start: int = ...) -> ndarray: ... + def moveaxis( a: ndarray, source: _ShapeLike, destination: _ShapeLike, ) -> ndarray: ... + def cross( a: ArrayLike, b: ArrayLike, @@ -147,6 +186,7 @@ def cross( axisc: int = ..., axis: Optional[int] = ..., ) -> ndarray: ... + @overload def indices( dimensions: Sequence[int], @@ -159,6 +199,7 @@ def indices( dtype: DTypeLike = ..., sparse: Literal[True] = ..., ) -> Tuple[ndarray, ...]: ... + def fromfunction( function: Callable[..., _T], shape: Sequence[int], @@ -167,10 +208,20 @@ def fromfunction( like: ArrayLike = ..., **kwargs: Any, ) -> _T: ... + def isscalar(element: Any) -> bool: ... + def binary_repr(num: int, width: Optional[int] = ...) -> str: ... + def base_repr(number: int, base: int = ..., padding: int = ...) -> str: ... -def identity(n: int, dtype: DTypeLike = ..., *, like: ArrayLike = ...) -> ndarray: ... + +def identity( + n: int, + dtype: DTypeLike = ..., + *, + like: ArrayLike = ..., +) -> ndarray: ... + def allclose( a: ArrayLike, b: ArrayLike, @@ -178,12 +229,15 @@ def allclose( atol: float = ..., equal_nan: bool = ..., ) -> bool: ... + def isclose( a: ArrayLike, b: ArrayLike, rtol: float = ..., atol: float = ..., equal_nan: bool = ..., -) -> Union[bool_, ndarray]: ... +) -> Any: ... + def array_equal(a1: ArrayLike, a2: ArrayLike) -> bool: ... + def array_equiv(a1: ArrayLike, a2: ArrayLike) -> bool: ... diff --git a/numpy/core/setup.py b/numpy/core/setup.py index df405bcaf..d1229ee8f 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -405,11 +405,6 @@ def configuration(parent_package='',top_path=None): from numpy.distutils.system_info import (get_info, blas_opt_info, lapack_opt_info) - # Accelerate is buggy, disallow it. See also numpy/linalg/setup.py - for opt_order in (blas_opt_info.blas_order, lapack_opt_info.lapack_order): - if 'accelerate' in opt_order: - opt_order.remove('accelerate') - config = Configuration('core', parent_package, top_path) local_dir = config.local_path codegen_dir = join(local_dir, 'code_generators') diff --git a/numpy/core/src/common/lowlevel_strided_loops.h b/numpy/core/src/common/lowlevel_strided_loops.h index 1255e51dd..3df054b40 100644 --- a/numpy/core/src/common/lowlevel_strided_loops.h +++ b/numpy/core/src/common/lowlevel_strided_loops.h @@ -647,25 +647,6 @@ npy_bswap8_unaligned(char * x) * // Create iterator, etc... * } * - * Here is example code for a pair of arrays: - * - * if (PyArray_TRIVIALLY_ITERABLE_PAIR(a1, a2)) { - * char *data1, *data2; - * npy_intp count, stride1, stride2; - * - * PyArray_PREPARE_TRIVIAL_PAIR_ITERATION(a1, a2, count, - * data1, data2, stride1, stride2); - * - * while (count--) { - * // Use the data1 and data2 pointers - * - * data1 += stride1; - * data2 += stride2; - * } - * } - * else { - * // Create iterator, etc... - * } */ /* @@ -776,16 +757,6 @@ PyArray_EQUIVALENTLY_ITERABLE_OVERLAP_OK(PyArrayObject *arr1, PyArrayObject *arr PyArray_STRIDE(arr, 0) : \ PyArray_ITEMSIZE(arr))); -#define PyArray_TRIVIALLY_ITERABLE_PAIR(arr1, arr2, arr1_read, arr2_read) ( \ - PyArray_TRIVIALLY_ITERABLE(arr1) && \ - (PyArray_NDIM(arr2) == 0 || \ - PyArray_EQUIVALENTLY_ITERABLE_BASE(arr1, arr2) || \ - (PyArray_NDIM(arr1) == 0 && \ - PyArray_TRIVIALLY_ITERABLE(arr2) \ - ) \ - ) && \ - PyArray_EQUIVALENTLY_ITERABLE_OVERLAP_OK(arr1, arr2, arr1_read, arr2_read) \ - ) #define PyArray_PREPARE_TRIVIAL_PAIR_ITERATION(arr1, arr2, \ count, \ data1, data2, \ @@ -799,45 +770,4 @@ PyArray_EQUIVALENTLY_ITERABLE_OVERLAP_OK(PyArrayObject *arr1, PyArrayObject *arr stride2 = PyArray_TRIVIAL_PAIR_ITERATION_STRIDE(size2, arr2); \ } -#define PyArray_TRIVIALLY_ITERABLE_TRIPLE(arr1, arr2, arr3, arr1_read, arr2_read, arr3_read) ( \ - PyArray_TRIVIALLY_ITERABLE(arr1) && \ - ((PyArray_NDIM(arr2) == 0 && \ - (PyArray_NDIM(arr3) == 0 || \ - PyArray_EQUIVALENTLY_ITERABLE_BASE(arr1, arr3) \ - ) \ - ) || \ - (PyArray_EQUIVALENTLY_ITERABLE_BASE(arr1, arr2) && \ - (PyArray_NDIM(arr3) == 0 || \ - PyArray_EQUIVALENTLY_ITERABLE_BASE(arr1, arr3) \ - ) \ - ) || \ - (PyArray_NDIM(arr1) == 0 && \ - PyArray_TRIVIALLY_ITERABLE(arr2) && \ - (PyArray_NDIM(arr3) == 0 || \ - PyArray_EQUIVALENTLY_ITERABLE_BASE(arr2, arr3) \ - ) \ - ) \ - ) && \ - PyArray_EQUIVALENTLY_ITERABLE_OVERLAP_OK(arr1, arr2, arr1_read, arr2_read) && \ - PyArray_EQUIVALENTLY_ITERABLE_OVERLAP_OK(arr1, arr3, arr1_read, arr3_read) && \ - PyArray_EQUIVALENTLY_ITERABLE_OVERLAP_OK(arr2, arr3, arr2_read, arr3_read) \ - ) - -#define PyArray_PREPARE_TRIVIAL_TRIPLE_ITERATION(arr1, arr2, arr3, \ - count, \ - data1, data2, data3, \ - stride1, stride2, stride3) { \ - npy_intp size1 = PyArray_SIZE(arr1); \ - npy_intp size2 = PyArray_SIZE(arr2); \ - npy_intp size3 = PyArray_SIZE(arr3); \ - count = ((size1 > size2) || size1 == 0) ? size1 : size2; \ - count = ((size3 > count) || size3 == 0) ? size3 : count; \ - data1 = PyArray_BYTES(arr1); \ - data2 = PyArray_BYTES(arr2); \ - data3 = PyArray_BYTES(arr3); \ - stride1 = PyArray_TRIVIAL_PAIR_ITERATION_STRIDE(size1, arr1); \ - stride2 = PyArray_TRIVIAL_PAIR_ITERATION_STRIDE(size2, arr2); \ - stride3 = PyArray_TRIVIAL_PAIR_ITERATION_STRIDE(size3, arr3); \ - } - #endif diff --git a/numpy/core/src/common/npy_pycompat.h b/numpy/core/src/common/npy_pycompat.h index aa0b5c122..9e94a9710 100644 --- a/numpy/core/src/common/npy_pycompat.h +++ b/numpy/core/src/common/npy_pycompat.h @@ -3,4 +3,20 @@ #include "numpy/npy_3kcompat.h" + +/* + * In Python 3.10a7 (or b1), python started using the identity for the hash + * when a value is NaN. See https://bugs.python.org/issue43475 + */ +#if PY_VERSION_HEX > 0x030a00a6 +#define Npy_HashDouble _Py_HashDouble +#else +static NPY_INLINE Py_hash_t +Npy_HashDouble(PyObject *NPY_UNUSED(identity), double val) +{ + return _Py_HashDouble(val); +} +#endif + + #endif /* _NPY_COMPAT_H_ */ diff --git a/numpy/core/src/multiarray/scalartypes.c.src b/numpy/core/src/multiarray/scalartypes.c.src index a001500b0..9930f7791 100644 --- a/numpy/core/src/multiarray/scalartypes.c.src +++ b/numpy/core/src/multiarray/scalartypes.c.src @@ -3172,7 +3172,7 @@ static npy_hash_t static npy_hash_t @lname@_arrtype_hash(PyObject *obj) { - return _Py_HashDouble((double) PyArrayScalar_VAL(obj, @name@)); + return Npy_HashDouble(obj, (double)PyArrayScalar_VAL(obj, @name@)); } /* borrowed from complex_hash */ @@ -3180,14 +3180,14 @@ static npy_hash_t c@lname@_arrtype_hash(PyObject *obj) { npy_hash_t hashreal, hashimag, combined; - hashreal = _Py_HashDouble((double) - PyArrayScalar_VAL(obj, C@name@).real); + hashreal = Npy_HashDouble( + obj, (double)PyArrayScalar_VAL(obj, C@name@).real); if (hashreal == -1) { return -1; } - hashimag = _Py_HashDouble((double) - PyArrayScalar_VAL(obj, C@name@).imag); + hashimag = Npy_HashDouble( + obj, (double)PyArrayScalar_VAL(obj, C@name@).imag); if (hashimag == -1) { return -1; } @@ -3202,7 +3202,8 @@ c@lname@_arrtype_hash(PyObject *obj) static npy_hash_t half_arrtype_hash(PyObject *obj) { - return _Py_HashDouble(npy_half_to_double(PyArrayScalar_VAL(obj, Half))); + return Npy_HashDouble( + obj, npy_half_to_double(PyArrayScalar_VAL(obj, Half))); } static npy_hash_t diff --git a/numpy/core/src/umath/loops_exponent_log.dispatch.c.src b/numpy/core/src/umath/loops_exponent_log.dispatch.c.src index 1dc24b226..41e0bf37b 100644 --- a/numpy/core/src/umath/loops_exponent_log.dispatch.c.src +++ b/numpy/core/src/umath/loops_exponent_log.dispatch.c.src @@ -465,6 +465,7 @@ simd_exp_FLOAT(npy_float * op, @mask@ xmax_mask, xmin_mask, nan_mask, inf_mask; @mask@ overflow_mask = @isa@_get_partial_load_mask_ps(0, num_lanes); + @mask@ underflow_mask = @isa@_get_partial_load_mask_ps(0, num_lanes); @mask@ load_mask = @isa@_get_full_load_mask_ps(); npy_intp num_remaining_elements = array_size; @@ -491,6 +492,7 @@ simd_exp_FLOAT(npy_float * op, inf_mask = _mm@vsize@_cmp_ps@vsub@(x, inf, _CMP_EQ_OQ); overflow_mask = @or_masks@(overflow_mask, @xor_masks@(xmax_mask, inf_mask)); + underflow_mask = @or_masks@(underflow_mask, xmin_mask); x = @isa@_set_masked_lanes_ps(x, zeros_f, @or_masks@( @or_masks@(nan_mask, xmin_mask), xmax_mask)); @@ -539,6 +541,10 @@ simd_exp_FLOAT(npy_float * op, if (@mask_to_int@(overflow_mask)) { npy_set_floatstatus_overflow(); } + + if (@mask_to_int@(underflow_mask)) { + npy_set_floatstatus_underflow(); + } } /* @@ -740,6 +746,7 @@ AVX512F_exp_DOUBLE(npy_double * op, __m512d mTable_tail_3 = _mm512_loadu_pd(&(EXP_Table_tail[8*3])); __mmask8 overflow_mask = avx512_get_partial_load_mask_pd(0, num_lanes); + __mmask8 underflow_mask = avx512_get_partial_load_mask_pd(0, num_lanes); __mmask8 load_mask = avx512_get_full_load_mask_pd(); __mmask8 xmin_mask, xmax_mask, inf_mask, nan_mask, nearzero_mask; @@ -769,6 +776,7 @@ AVX512F_exp_DOUBLE(npy_double * op, nearzero_mask = _mm512_kxor(nearzero_mask, nan_mask); overflow_mask = _mm512_kor(overflow_mask, _mm512_kxor(xmax_mask, inf_mask)); + underflow_mask = _mm512_kor(underflow_mask, xmin_mask); x = avx512_set_masked_lanes_pd(x, zeros_d, _mm512_kor(_mm512_kor(nan_mask, xmin_mask), _mm512_kor(xmax_mask, nearzero_mask))); @@ -828,6 +836,10 @@ AVX512F_exp_DOUBLE(npy_double * op, if (overflow_mask) { npy_set_floatstatus_overflow(); } + + if (underflow_mask) { + npy_set_floatstatus_underflow(); + } } /* * Vectorized implementation of log double using AVX512 diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c index f17dd1e61..7dffb482f 100644 --- a/numpy/core/src/umath/ufunc_object.c +++ b/numpy/core/src/umath/ufunc_object.c @@ -1033,65 +1033,6 @@ check_for_trivial_loop(PyUFuncObject *ufunc, return 1; } -static void -trivial_two_operand_loop(PyArrayObject **op, - PyUFuncGenericFunction innerloop, - void *innerloopdata) -{ - char *data[2]; - npy_intp count[2], stride[2]; - int needs_api; - NPY_BEGIN_THREADS_DEF; - - needs_api = PyDataType_REFCHK(PyArray_DESCR(op[0])) || - PyDataType_REFCHK(PyArray_DESCR(op[1])); - - PyArray_PREPARE_TRIVIAL_PAIR_ITERATION(op[0], op[1], - count[0], - data[0], data[1], - stride[0], stride[1]); - count[1] = count[0]; - NPY_UF_DBG_PRINT1("two operand loop count %d\n", (int)count[0]); - - if (!needs_api) { - NPY_BEGIN_THREADS_THRESHOLDED(count[0]); - } - - innerloop(data, count, stride, innerloopdata); - - NPY_END_THREADS; -} - -static void -trivial_three_operand_loop(PyArrayObject **op, - PyUFuncGenericFunction innerloop, - void *innerloopdata) -{ - char *data[3]; - npy_intp count[3], stride[3]; - int needs_api; - NPY_BEGIN_THREADS_DEF; - - needs_api = PyDataType_REFCHK(PyArray_DESCR(op[0])) || - PyDataType_REFCHK(PyArray_DESCR(op[1])) || - PyDataType_REFCHK(PyArray_DESCR(op[2])); - - PyArray_PREPARE_TRIVIAL_TRIPLE_ITERATION(op[0], op[1], op[2], - count[0], - data[0], data[1], data[2], - stride[0], stride[1], stride[2]); - count[1] = count[0]; - count[2] = count[0]; - NPY_UF_DBG_PRINT1("three operand loop count %d\n", (int)count[0]); - - if (!needs_api) { - NPY_BEGIN_THREADS_THRESHOLDED(count[0]); - } - - innerloop(data, count, stride, innerloopdata); - - NPY_END_THREADS; -} /* * Calls the given __array_prepare__ function on the operand *op, @@ -1165,6 +1106,151 @@ prepare_ufunc_output(PyUFuncObject *ufunc, return 0; } + +/* + * Check whether a trivial loop is possible and call the innerloop if it is. + * A trivial loop is defined as one where a single strided inner-loop call + * is possible. + * + * This function only supports a single output (due to the overlap check). + * It always accepts 0-D arrays and will broadcast them. The function + * cannot broadcast any other array (as it requires a single stride). + * The function accepts all 1-D arrays, and N-D arrays that are either all + * C- or all F-contiguous. + * + * Returns -2 if a trivial loop is not possible, 0 on success and -1 on error. + */ +static NPY_INLINE int +try_trivial_single_output_loop(PyUFuncObject *ufunc, + PyArrayObject *op[], PyArray_Descr *dtypes[], + NPY_ORDER order, PyObject *arr_prep[], ufunc_full_args full_args, + PyUFuncGenericFunction innerloop, void *innerloopdata) +{ + int nin = ufunc->nin; + int nop = nin + 1; + assert(ufunc->nout == 1); + + /* The order of all N-D contiguous operands, can be fixed by `order` */ + int operation_order = 0; + if (order == NPY_CORDER) { + operation_order = NPY_ARRAY_C_CONTIGUOUS; + } + else if (order == NPY_FORTRANORDER) { + operation_order = NPY_ARRAY_F_CONTIGUOUS; + } + + int operation_ndim = 0; + npy_intp *operation_shape = NULL; + npy_intp fixed_strides[NPY_MAXARGS]; + + for (int iop = 0; iop < nop; iop++) { + if (op[iop] == NULL) { + /* The out argument may be NULL (and only that one); fill later */ + assert(iop == nin); + continue; + } + + int op_ndim = PyArray_NDIM(op[iop]); + + /* Special case 0-D since we can handle broadcasting using a 0-stride */ + if (op_ndim == 0) { + fixed_strides[iop] = 0; + continue; + } + + /* First non 0-D op: fix dimensions, shape (order is fixed later) */ + if (operation_ndim == 0) { + operation_ndim = op_ndim; + operation_shape = PyArray_SHAPE(op[iop]); + } + else if (op_ndim != operation_ndim) { + return -2; /* dimension mismatch (except 0-d ops) */ + } + else if (!PyArray_CompareLists( + operation_shape, PyArray_DIMS(op[iop]), op_ndim)) { + return -2; /* shape mismatch */ + } + + if (op_ndim == 1) { + fixed_strides[iop] = PyArray_STRIDES(op[iop])[0]; + } + else { + fixed_strides[iop] = PyArray_ITEMSIZE(op[iop]); /* contiguous */ + + /* This op must match the operation order (and be contiguous) */ + int op_order = (PyArray_FLAGS(op[iop]) & + (NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_F_CONTIGUOUS)); + if (op_order == 0) { + return -2; /* N-dimensional op must be contiguous */ + } + else if (operation_order == 0) { + operation_order = op_order; /* op fixes order */ + } + else if (operation_order != op_order) { + return -2; + } + } + } + + if (op[nin] == NULL) { + Py_INCREF(dtypes[nin]); + op[nin] = (PyArrayObject *) PyArray_NewFromDescr(&PyArray_Type, + dtypes[nin], operation_ndim, operation_shape, + NULL, NULL, operation_order==NPY_ARRAY_F_CONTIGUOUS, NULL); + if (op[nin] == NULL) { + return -1; + } + fixed_strides[nin] = dtypes[nin]->elsize; + } + else { + /* If any input overlaps with the output, we use the full path. */ + for (int iop = 0; iop < nin; iop++) { + if (!PyArray_EQUIVALENTLY_ITERABLE_OVERLAP_OK( + op[iop], op[nin], + PyArray_TRIVIALLY_ITERABLE_OP_READ, + PyArray_TRIVIALLY_ITERABLE_OP_NOREAD)) { + return -2; + } + } + /* Check self-overlap (non 1-D are contiguous, perfect overlap is OK) */ + if (operation_ndim == 1 && + PyArray_STRIDES(op[nin])[0] < PyArray_ITEMSIZE(op[nin]) && + PyArray_STRIDES(op[nin])[0] != 0) { + return -2; + } + } + + /* Call the __prepare_array__ if necessary */ + if (prepare_ufunc_output(ufunc, &op[nin], + arr_prep[0], full_args, 0) < 0) { + return -1; + } + + /* + * We can use the trivial (single inner-loop call) optimization + * and `fixed_strides` holds the strides for that call. + */ + char *data[NPY_MAXARGS]; + npy_intp count = PyArray_MultiplyList(operation_shape, operation_ndim); + int needs_api = 0; + NPY_BEGIN_THREADS_DEF; + + for (int iop = 0; iop < nop; iop++) { + data[iop] = PyArray_BYTES(op[iop]); + needs_api |= PyDataType_REFCHK(dtypes[iop]); + } + + if (!needs_api) { + NPY_BEGIN_THREADS_THRESHOLDED(count); + } + + innerloop(data, &count, fixed_strides, innerloopdata); + + NPY_END_THREADS; + return 0; +} + + static int iterator_loop(PyUFuncObject *ufunc, PyArrayObject **op, @@ -1325,7 +1411,6 @@ execute_legacy_ufunc_loop(PyUFuncObject *ufunc, ufunc_full_args full_args, npy_uint32 *op_flags) { - npy_intp nin = ufunc->nin, nout = ufunc->nout; PyUFuncGenericFunction innerloop; void *innerloopdata; int needs_api = 0; @@ -1336,113 +1421,12 @@ execute_legacy_ufunc_loop(PyUFuncObject *ufunc, } /* First check for the trivial cases that don't need an iterator */ - if (trivial_loop_ok) { - if (nin == 1 && nout == 1) { - if (op[1] == NULL && - (order == NPY_ANYORDER || order == NPY_KEEPORDER) && - PyArray_TRIVIALLY_ITERABLE(op[0])) { - Py_INCREF(dtypes[1]); - op[1] = (PyArrayObject *)PyArray_NewFromDescr(&PyArray_Type, - dtypes[1], - PyArray_NDIM(op[0]), - PyArray_DIMS(op[0]), - NULL, NULL, - PyArray_ISFORTRAN(op[0]) ? - NPY_ARRAY_F_CONTIGUOUS : 0, - NULL); - if (op[1] == NULL) { - return -1; - } - - /* Call the __prepare_array__ if necessary */ - if (prepare_ufunc_output(ufunc, &op[1], - arr_prep[0], full_args, 0) < 0) { - return -1; - } - - NPY_UF_DBG_PRINT("trivial 1 input with allocated output\n"); - trivial_two_operand_loop(op, innerloop, innerloopdata); - - return 0; - } - else if (op[1] != NULL && - PyArray_NDIM(op[1]) >= PyArray_NDIM(op[0]) && - PyArray_TRIVIALLY_ITERABLE_PAIR(op[0], op[1], - PyArray_TRIVIALLY_ITERABLE_OP_READ, - PyArray_TRIVIALLY_ITERABLE_OP_NOREAD)) { - - /* Call the __prepare_array__ if necessary */ - if (prepare_ufunc_output(ufunc, &op[1], - arr_prep[0], full_args, 0) < 0) { - return -1; - } - - NPY_UF_DBG_PRINT("trivial 1 input\n"); - trivial_two_operand_loop(op, innerloop, innerloopdata); - - return 0; - } - } - else if (nin == 2 && nout == 1) { - if (op[2] == NULL && - (order == NPY_ANYORDER || order == NPY_KEEPORDER) && - PyArray_TRIVIALLY_ITERABLE_PAIR(op[0], op[1], - PyArray_TRIVIALLY_ITERABLE_OP_READ, - PyArray_TRIVIALLY_ITERABLE_OP_READ)) { - PyArrayObject *tmp; - /* - * Have to choose the input with more dimensions to clone, as - * one of them could be a scalar. - */ - if (PyArray_NDIM(op[0]) >= PyArray_NDIM(op[1])) { - tmp = op[0]; - } - else { - tmp = op[1]; - } - Py_INCREF(dtypes[2]); - op[2] = (PyArrayObject *)PyArray_NewFromDescr(&PyArray_Type, - dtypes[2], - PyArray_NDIM(tmp), - PyArray_DIMS(tmp), - NULL, NULL, - PyArray_ISFORTRAN(tmp) ? - NPY_ARRAY_F_CONTIGUOUS : 0, - NULL); - if (op[2] == NULL) { - return -1; - } - - /* Call the __prepare_array__ if necessary */ - if (prepare_ufunc_output(ufunc, &op[2], - arr_prep[0], full_args, 0) < 0) { - return -1; - } - - NPY_UF_DBG_PRINT("trivial 2 input with allocated output\n"); - trivial_three_operand_loop(op, innerloop, innerloopdata); - - return 0; - } - else if (op[2] != NULL && - PyArray_NDIM(op[2]) >= PyArray_NDIM(op[0]) && - PyArray_NDIM(op[2]) >= PyArray_NDIM(op[1]) && - PyArray_TRIVIALLY_ITERABLE_TRIPLE(op[0], op[1], op[2], - PyArray_TRIVIALLY_ITERABLE_OP_READ, - PyArray_TRIVIALLY_ITERABLE_OP_READ, - PyArray_TRIVIALLY_ITERABLE_OP_NOREAD)) { - - /* Call the __prepare_array__ if necessary */ - if (prepare_ufunc_output(ufunc, &op[2], - arr_prep[0], full_args, 0) < 0) { - return -1; - } - - NPY_UF_DBG_PRINT("trivial 2 input\n"); - trivial_three_operand_loop(op, innerloop, innerloopdata); - - return 0; - } + if (trivial_loop_ok && ufunc->nout == 1) { + int fast_path_result = try_trivial_single_output_loop(ufunc, + op, dtypes, order, arr_prep, full_args, + innerloop, innerloopdata); + if (fast_path_result != -2) { + return fast_path_result; } } @@ -1450,7 +1434,6 @@ execute_legacy_ufunc_loop(PyUFuncObject *ufunc, * If no trivial loop matched, an iterator is required to * resolve broadcasting, etc */ - NPY_UF_DBG_PRINT("iterator loop\n"); if (iterator_loop(ufunc, op, dtypes, order, buffersize, arr_prep, full_args, @@ -2457,7 +2440,7 @@ PyUFunc_GeneralizedFunctionInternal(PyUFuncObject *ufunc, PyArrayObject **op, /* Fill in any allocated outputs */ { PyArrayObject **operands = NpyIter_GetOperandArray(iter); - for (i = 0; i < nop; ++i) { + for (i = nin; i < nop; ++i) { if (op[i] == NULL) { op[i] = operands[i]; Py_INCREF(op[i]); @@ -2592,34 +2575,6 @@ PyUFunc_GeneralizedFunctionInternal(PyUFuncObject *ufunc, PyArrayObject **op, if (!needs_api && !NpyIter_IterationNeedsAPI(iter)) { NPY_END_THREADS; } - } else { - /** - * For each output operand, check if it has non-zero size, - * and assign the identity if it does. For example, a dot - * product of two zero-length arrays will be a scalar, - * which has size one. - */ - npy_bool reorderable; - PyObject *identity = _get_identity(ufunc, &reorderable); - if (identity == NULL) { - retval = -1; - goto fail; - } - - for (i = nin; i < nop; ++i) { - if (PyArray_SIZE(op[i]) != 0) { - if (identity == Py_None) { - PyErr_Format(PyExc_ValueError, - "ufunc %s ", - ufunc_name); - Py_DECREF(identity); - retval = -1; - goto fail; - } - PyArray_FillWithScalar(op[i], identity); - } - } - Py_DECREF(identity); } /* Check whether any errors occurred during the loop */ diff --git a/numpy/core/src/umath/ufunc_type_resolution.c b/numpy/core/src/umath/ufunc_type_resolution.c index 465deb87b..a3f97a8f3 100644 --- a/numpy/core/src/umath/ufunc_type_resolution.c +++ b/numpy/core/src/umath/ufunc_type_resolution.c @@ -540,7 +540,12 @@ PyUFunc_SimpleUniformOperationTypeResolver( out_dtypes[iop] = PyArray_DESCR(operands[iop]); Py_INCREF(out_dtypes[iop]); } - return raise_no_loop_found_error(ufunc, out_dtypes); + raise_no_loop_found_error(ufunc, out_dtypes); + for (iop = 0; iop < ufunc->nin; iop++) { + Py_DECREF(out_dtypes[iop]); + out_dtypes[iop] = NULL; + } + return -1; } out_dtypes[0] = PyArray_ResultType(ufunc->nin, operands, 0, NULL); } diff --git a/numpy/core/tests/test_mem_overlap.py b/numpy/core/tests/test_mem_overlap.py index 675613de4..24bdf477f 100644 --- a/numpy/core/tests/test_mem_overlap.py +++ b/numpy/core/tests/test_mem_overlap.py @@ -666,6 +666,11 @@ class TestUFunc: def test_unary_ufunc_call_fuzz(self): self.check_unary_fuzz(np.invert, None, np.int16) + @pytest.mark.slow + def test_unary_ufunc_call_complex_fuzz(self): + # Complex typically has a smaller alignment than itemsize + self.check_unary_fuzz(np.negative, None, np.complex128, count=500) + def test_binary_ufunc_accumulate_fuzz(self): def get_out_axis_size(a, b, axis): if axis is None: @@ -792,7 +797,7 @@ class TestUFunc: check(np.add, a, ind, a[25:75]) def test_unary_ufunc_1d_manual(self): - # Exercise branches in PyArray_EQUIVALENTLY_ITERABLE + # Exercise ufunc fast-paths (that avoid creation of an `np.nditer`) def check(a, b): a_orig = a.copy() diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index 2dea5518c..b355c4618 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -6212,6 +6212,71 @@ class TestDot: assert_equal(np.dot(b, a), res) assert_equal(np.dot(b, b), res) + def test_accelerate_framework_sgemv_fix(self): + + def aligned_array(shape, align, dtype, order='C'): + d = dtype(0) + N = np.prod(shape) + tmp = np.zeros(N * d.nbytes + align, dtype=np.uint8) + address = tmp.__array_interface__["data"][0] + for offset in range(align): + if (address + offset) % align == 0: + break + tmp = tmp[offset:offset+N*d.nbytes].view(dtype=dtype) + return tmp.reshape(shape, order=order) + + def as_aligned(arr, align, dtype, order='C'): + aligned = aligned_array(arr.shape, align, dtype, order) + aligned[:] = arr[:] + return aligned + + def assert_dot_close(A, X, desired): + assert_allclose(np.dot(A, X), desired, rtol=1e-5, atol=1e-7) + + m = aligned_array(100, 15, np.float32) + s = aligned_array((100, 100), 15, np.float32) + np.dot(s, m) # this will always segfault if the bug is present + + testdata = itertools.product((15, 32), (10000,), (200, 89), ('C', 'F')) + for align, m, n, a_order in testdata: + # Calculation in double precision + A_d = np.random.rand(m, n) + X_d = np.random.rand(n) + desired = np.dot(A_d, X_d) + # Calculation with aligned single precision + A_f = as_aligned(A_d, align, np.float32, order=a_order) + X_f = as_aligned(X_d, align, np.float32) + assert_dot_close(A_f, X_f, desired) + # Strided A rows + A_d_2 = A_d[::2] + desired = np.dot(A_d_2, X_d) + A_f_2 = A_f[::2] + assert_dot_close(A_f_2, X_f, desired) + # Strided A columns, strided X vector + A_d_22 = A_d_2[:, ::2] + X_d_2 = X_d[::2] + desired = np.dot(A_d_22, X_d_2) + A_f_22 = A_f_2[:, ::2] + X_f_2 = X_f[::2] + assert_dot_close(A_f_22, X_f_2, desired) + # Check the strides are as expected + if a_order == 'F': + assert_equal(A_f_22.strides, (8, 8 * m)) + else: + assert_equal(A_f_22.strides, (8 * n, 8)) + assert_equal(X_f_2.strides, (8,)) + # Strides in A rows + cols only + X_f_2c = as_aligned(X_f_2, align, np.float32) + assert_dot_close(A_f_22, X_f_2c, desired) + # Strides just in A cols + A_d_12 = A_d[:, ::2] + desired = np.dot(A_d_12, X_d_2) + A_f_12 = A_f[:, ::2] + assert_dot_close(A_f_12, X_f_2c, desired) + # Strides in A cols and X + assert_dot_close(A_f_12, X_f_2, desired) + + class MatmulCommon: """Common tests for '@' operator and numpy.matmul. @@ -6464,6 +6529,16 @@ class TestMatmul(MatmulCommon): c = c.astype(tgt.dtype) assert_array_equal(c, tgt) + def test_empty_out(self): + # Check that the output cannot be broadcast, so that it cannot be + # size zero when the outer dimensions (iterator size) has size zero. + arr = np.ones((0, 1, 1)) + out = np.ones((1, 1, 1)) + assert self.matmul(arr, arr).shape == (0, 1, 1) + + with pytest.raises(ValueError, match=r"non-broadcastable"): + self.matmul(arr, arr, out=out) + def test_out_contiguous(self): a = np.ones((5, 2), dtype=float) b = np.array([[1, 3], [5, 7]], dtype=float) diff --git a/numpy/core/tests/test_scalarmath.py b/numpy/core/tests/test_scalarmath.py index d91b4a391..09a734284 100644 --- a/numpy/core/tests/test_scalarmath.py +++ b/numpy/core/tests/test_scalarmath.py @@ -712,6 +712,40 @@ class TestBitShifts: assert_equal(res_arr, res_scl) +class TestHash: + @pytest.mark.parametrize("type_code", np.typecodes['AllInteger']) + def test_integer_hashes(self, type_code): + scalar = np.dtype(type_code).type + for i in range(128): + assert hash(i) == hash(scalar(i)) + + @pytest.mark.parametrize("type_code", np.typecodes['AllFloat']) + def test_float_and_complex_hashes(self, type_code): + scalar = np.dtype(type_code).type + for val in [np.pi, np.inf, 3, 6.]: + numpy_val = scalar(val) + # Cast back to Python, in case the NumPy scalar has less precision + if numpy_val.dtype.kind == 'c': + val = complex(numpy_val) + else: + val = float(numpy_val) + assert val == numpy_val + print(repr(numpy_val), repr(val)) + assert hash(val) == hash(numpy_val) + + if hash(float(np.nan)) != hash(float(np.nan)): + # If Python distinguises different NaNs we do so too (gh-18833) + assert hash(scalar(np.nan)) != hash(scalar(np.nan)) + + @pytest.mark.parametrize("type_code", np.typecodes['Complex']) + def test_complex_hashes(self, type_code): + # Test some complex valued hashes specifically: + scalar = np.dtype(type_code).type + for val in [np.pi+1j, np.inf-3j, 3j, 6.+1j]: + numpy_val = scalar(val) + assert hash(complex(numpy_val)) == hash(numpy_val) + + @contextlib.contextmanager def recursionlimit(n): o = sys.getrecursionlimit() diff --git a/numpy/core/tests/test_ufunc.py b/numpy/core/tests/test_ufunc.py index c13865ce4..64ecb3780 100644 --- a/numpy/core/tests/test_ufunc.py +++ b/numpy/core/tests/test_ufunc.py @@ -175,7 +175,7 @@ class TestUfuncGenericLoops: ufunc(obj_arr) else: res_obj = ufunc(obj_arr) - assert_array_equal(res_num.astype("O"), res_obj) + assert_array_almost_equal(res_num.astype("O"), res_obj) def _pickleable_module_global(): diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py index 75e1c99d3..572e736a0 100644 --- a/numpy/core/tests/test_umath.py +++ b/numpy/core/tests/test_umath.py @@ -919,6 +919,12 @@ class TestSpecialFloats: assert_raises(FloatingPointError, np.exp, np.float64(800.)) assert_raises(FloatingPointError, np.exp, np.float64(1E19)) + with np.errstate(under='raise'): + assert_raises(FloatingPointError, np.exp, np.float32(-1000.)) + assert_raises(FloatingPointError, np.exp, np.float32(-1E19)) + assert_raises(FloatingPointError, np.exp, np.float64(-1000.)) + assert_raises(FloatingPointError, np.exp, np.float64(-1E19)) + def test_log_values(self): with np.errstate(all='ignore'): x = [np.nan, np.nan, np.inf, np.nan, -np.inf, np.nan] diff --git a/numpy/distutils/ccompiler_opt.py b/numpy/distutils/ccompiler_opt.py index aea9835c7..316d3a338 100644 --- a/numpy/distutils/ccompiler_opt.py +++ b/numpy/distutils/ccompiler_opt.py @@ -747,12 +747,14 @@ class _Cache: self.cache_me = {} self.cache_private = set() self.cache_infile = False + self._cache_path = None if self.conf_nocache: self.dist_log("cache is disabled by `Config`") return - chash = self.cache_hash(*factors, *self.conf_cache_factors) + self._cache_hash = self.cache_hash(*factors, *self.conf_cache_factors) + self._cache_path = cache_path if cache_path: if os.path.exists(cache_path): self.dist_log("load cache from file ->", cache_path) @@ -765,7 +767,7 @@ class _Cache: elif not hasattr(cache_mod, "hash") or \ not hasattr(cache_mod, "data"): self.dist_log("invalid cache file", stderr=True) - elif chash == cache_mod.hash: + elif self._cache_hash == cache_mod.hash: self.dist_log("hit the file cache") for attr, val in cache_mod.data.items(): setattr(self, attr, val) @@ -773,10 +775,8 @@ class _Cache: else: self.dist_log("miss the file cache") - atexit.register(self._cache_write, cache_path, chash) - if not self.cache_infile: - other_cache = _share_cache.get(chash) + other_cache = _share_cache.get(self._cache_hash) if other_cache: self.dist_log("hit the memory cache") for attr, val in other_cache.__dict__.items(): @@ -785,32 +785,41 @@ class _Cache: continue setattr(self, attr, val) - _share_cache[chash] = self + _share_cache[self._cache_hash] = self + atexit.register(self.cache_flush) def __del__(self): - # TODO: remove the cache form share on del - pass + for h, o in _share_cache.items(): + if o == self: + _share_cache.pop(h) + break - def _cache_write(self, cache_path, cache_hash): + def cache_flush(self): + """ + Force update the cache. + """ + if not self._cache_path: + return # TODO: don't write if the cache doesn't change - self.dist_log("write cache to path ->", cache_path) - for attr in list(self.__dict__.keys()): + self.dist_log("write cache to path ->", self._cache_path) + cdict = self.__dict__.copy() + for attr in self.__dict__.keys(): if re.match(self._cache_ignore, attr): - self.__dict__.pop(attr) + cdict.pop(attr) - d = os.path.dirname(cache_path) + d = os.path.dirname(self._cache_path) if not os.path.exists(d): os.makedirs(d) - repr_dict = pprint.pformat(self.__dict__, compact=True) - with open(cache_path, "w") as f: + repr_dict = pprint.pformat(cdict, compact=True) + with open(self._cache_path, "w") as f: f.write(textwrap.dedent("""\ # AUTOGENERATED DON'T EDIT # Please make changes to the code generator \ (distutils/ccompiler_opt.py) hash = {} data = \\ - """).format(cache_hash)) + """).format(self._cache_hash)) f.write(repr_dict) def cache_hash(self, *factors): diff --git a/numpy/distutils/command/build_clib.py b/numpy/distutils/command/build_clib.py index e1f15d465..0e31a7dee 100644 --- a/numpy/distutils/command/build_clib.py +++ b/numpy/distutils/command/build_clib.py @@ -123,15 +123,20 @@ class build_clib(old_build_clib): opt_cache_path = os.path.abspath( os.path.join(self.build_temp, 'ccompiler_opt_cache_clib.py') ) + if hasattr(self, "compiler_opt"): + # By default `CCompilerOpt` update the cache at the exit of + # the process, which may lead to duplicate building + # (see build_extension()/force_rebuild) if run() called + # multiple times within the same os process/thread without + # giving the chance the previous instances of `CCompilerOpt` + # to update the cache. + self.compiler_opt.cache_flush() + self.compiler_opt = new_ccompiler_opt( compiler=self.compiler, dispatch_hpath=dispatch_hpath, cpu_baseline=self.cpu_baseline, cpu_dispatch=self.cpu_dispatch, cache_path=opt_cache_path ) - if not self.compiler_opt.is_cached(): - log.info("Detected changes on compiler optimizations, force rebuilding") - self.force = True - def report(copt): log.info("\n########### CLIB COMPILER OPTIMIZATION ###########") log.info(copt.report(full=True)) @@ -212,7 +217,12 @@ class build_clib(old_build_clib): lib_file = compiler.library_filename(lib_name, output_dir=self.build_clib) depends = sources + build_info.get('depends', []) - if not (self.force or newer_group(depends, lib_file, 'newer')): + + force_rebuild = self.force + if not self.disable_optimization and not self.compiler_opt.is_cached(): + log.debug("Detected changes on compiler optimizations") + force_rebuild = True + if not (force_rebuild or newer_group(depends, lib_file, 'newer')): log.debug("skipping '%s' library (up-to-date)", lib_name) return else: diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py index ca29ad4c0..84ec8aa2c 100644 --- a/numpy/distutils/command/build_ext.py +++ b/numpy/distutils/command/build_ext.py @@ -151,15 +151,20 @@ class build_ext (old_build_ext): opt_cache_path = os.path.abspath( os.path.join(self.build_temp, 'ccompiler_opt_cache_ext.py') ) + if hasattr(self, "compiler_opt"): + # By default `CCompilerOpt` update the cache at the exit of + # the process, which may lead to duplicate building + # (see build_extension()/force_rebuild) if run() called + # multiple times within the same os process/thread without + # giving the chance the previous instances of `CCompilerOpt` + # to update the cache. + self.compiler_opt.cache_flush() + self.compiler_opt = new_ccompiler_opt( compiler=self.compiler, dispatch_hpath=dispatch_hpath, cpu_baseline=self.cpu_baseline, cpu_dispatch=self.cpu_dispatch, cache_path=opt_cache_path ) - if not self.compiler_opt.is_cached(): - log.info("Detected changes on compiler optimizations, force rebuilding") - self.force = True - def report(copt): log.info("\n########### EXT COMPILER OPTIMIZATION ###########") log.info(copt.report(full=True)) @@ -360,7 +365,11 @@ class build_ext (old_build_ext): self.get_ext_filename(fullname)) depends = sources + ext.depends - if not (self.force or newer_group(depends, ext_filename, 'newer')): + force_rebuild = self.force + if not self.disable_optimization and not self.compiler_opt.is_cached(): + log.debug("Detected changes on compiler optimizations") + force_rebuild = True + if not (force_rebuild or newer_group(depends, ext_filename, 'newer')): log.debug("skipping '%s' extension (up-to-date)", ext.name) return else: diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py index 85a0c9321..82e864a5c 100644 --- a/numpy/distutils/system_info.py +++ b/numpy/distutils/system_info.py @@ -375,22 +375,6 @@ default_src_dirs = [_m for _m in default_src_dirs if os.path.isdir(_m)] so_ext = get_shared_lib_extension() -def is_symlink_to_accelerate(filename): - accelpath = '/System/Library/Frameworks/Accelerate.framework' - return (sys.platform == 'darwin' and os.path.islink(filename) and - os.path.realpath(filename).startswith(accelpath)) - - -_accel_msg = ( - 'Found {filename}, but that file is a symbolic link to the ' - 'MacOS Accelerate framework, which is not supported by NumPy. ' - 'You must configure the build to use a different optimized library, ' - 'or disable the use of optimized BLAS and LAPACK by setting the ' - 'environment variables NPY_BLAS_ORDER="" and NPY_LAPACK_ORDER="" ' - 'before building NumPy.' -) - - def get_standard_file(fname): """Returns a list of files named 'fname' from 1) System-wide directory (directory-location of this module) @@ -539,6 +523,7 @@ def get_info(name, notfound_action=0): 'blis': blis_info, # use blas_opt instead 'lapack_mkl': lapack_mkl_info, # use lapack_opt instead 'blas_mkl': blas_mkl_info, # use blas_opt instead + 'accelerate': accelerate_info, # use blas_opt instead 'openblas64_': openblas64__info, 'openblas64__lapack': openblas64__lapack_info, 'openblas_ilp64': openblas_ilp64_info, @@ -1029,9 +1014,6 @@ class system_info: for prefix in lib_prefixes: p = self.combine_paths(lib_dir, prefix + lib + ext) if p: - # p[0] is the full path to the binary library file. - if is_symlink_to_accelerate(p[0]): - raise RuntimeError(_accel_msg.format(filename=p[0])) break if p: assert len(p) == 1 @@ -1766,8 +1748,10 @@ def get_atlas_version(**config): class lapack_opt_info(system_info): notfounderror = LapackNotFoundError + # List of all known LAPACK libraries, in the default order - lapack_order = ['mkl', 'openblas', 'flame', 'atlas', 'lapack'] + lapack_order = ['mkl', 'openblas', 'flame', + 'accelerate', 'atlas', 'lapack'] order_env_var_name = 'NPY_LAPACK_ORDER' def _calc_info_mkl(self): @@ -1942,7 +1926,9 @@ class lapack64__opt_info(lapack_ilp64_opt_info): class blas_opt_info(system_info): notfounderror = BlasNotFoundError # List of all known BLAS libraries, in the default order - blas_order = ['mkl', 'blis', 'openblas', 'atlas', 'blas'] + + blas_order = ['mkl', 'blis', 'openblas', + 'accelerate', 'atlas', 'blas'] order_env_var_name = 'NPY_BLAS_ORDER' def _calc_info_mkl(self): diff --git a/numpy/f2py/cfuncs.py b/numpy/f2py/cfuncs.py index 974062f26..f403a66b5 100644 --- a/numpy/f2py/cfuncs.py +++ b/numpy/f2py/cfuncs.py @@ -545,7 +545,9 @@ cppmacros['OLDPYNUM'] = """\ """ cppmacros["F2PY_THREAD_LOCAL_DECL"] = """\ #ifndef F2PY_THREAD_LOCAL_DECL -#if defined(_MSC_VER) +#if defined(_MSC_VER) \\ + || defined(_WIN32) || defined(_WIN64) \\ + || defined(__MINGW32__) || defined(__MINGW64__) #define F2PY_THREAD_LOCAL_DECL __declspec(thread) #elif defined(__STDC_VERSION__) \\ && (__STDC_VERSION__ >= 201112L) \\ diff --git a/numpy/lib/index_tricks.pyi b/numpy/lib/index_tricks.pyi index 3e5bc1adb..e486fe8f2 100644 --- a/numpy/lib/index_tricks.pyi +++ b/numpy/lib/index_tricks.pyi @@ -17,6 +17,7 @@ from numpy import ( ndindex as ndindex, ndarray, dtype, + integer, str_, bytes_, bool_, @@ -33,7 +34,6 @@ from numpy.typing import ( _NestedSequence, _RecursiveSequence, _ArrayND, - _ArrayOrScalar, _ArrayLikeInt, # DTypes @@ -57,18 +57,33 @@ _ArrayType = TypeVar("_ArrayType", bound=ndarray[Any, Any]) __all__: List[str] +@overload +def unravel_index( # type: ignore[misc] + indices: Union[int, integer[Any]], + shape: _ShapeLike, + order: _OrderCF = ... +) -> Tuple[intp, ...]: ... +@overload def unravel_index( indices: _ArrayLikeInt, shape: _ShapeLike, order: _OrderCF = ... -) -> Tuple[_ArrayOrScalar[intp], ...]: ... +) -> Tuple[_ArrayND[intp], ...]: ... +@overload +def ravel_multi_index( # type: ignore[misc] + multi_index: Sequence[Union[int, integer[Any]]], + dims: _ShapeLike, + mode: Union[_ModeKind, Tuple[_ModeKind, ...]] = ..., + order: _OrderCF = ... +) -> intp: ... +@overload def ravel_multi_index( - multi_index: ArrayLike, + multi_index: Sequence[_ArrayLikeInt], dims: _ShapeLike, mode: Union[_ModeKind, Tuple[_ModeKind, ...]] = ..., order: _OrderCF = ... -) -> _ArrayOrScalar[intp]: ... +) -> _ArrayND[intp]: ... @overload def ix_(*args: _NestedSequence[_SupportsDType[_DType]]) -> Tuple[ndarray[Any, _DType], ...]: ... diff --git a/numpy/lib/type_check.py b/numpy/lib/type_check.py index 2a2982ab3..383fbda3c 100644 --- a/numpy/lib/type_check.py +++ b/numpy/lib/type_check.py @@ -262,6 +262,10 @@ def isreal(x): out : ndarray, bool Boolean array of same shape as `x`. + Notes + ----- + `isreal` may behave unexpectedly for string or object arrays (see examples) + See Also -------- iscomplex @@ -269,8 +273,28 @@ def isreal(x): Examples -------- - >>> np.isreal([1+1j, 1+0j, 4.5, 3, 2, 2j]) + >>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex) + >>> np.isreal(a) array([False, True, True, True, True, False]) + + The function does not work on string arrays. + + >>> a = np.array([2j, "a"], dtype="U") + >>> np.isreal(a) # Warns about non-elementwise comparison + False + + Returns True for all elements in input array of ``dtype=object`` even if + any of the elements is complex. + + >>> a = np.array([1, "2", 3+4j], dtype=object) + >>> np.isreal(a) + array([ True, True, True]) + + isreal should not be used with object arrays + + >>> a = np.array([1+2j, 2+1j], dtype=object) + >>> np.isreal(a) + array([ True, True]) """ return imag(x) == 0 diff --git a/numpy/lib/ufunclike.pyi b/numpy/lib/ufunclike.pyi index 3443fa7ae..e97383af8 100644 --- a/numpy/lib/ufunclike.pyi +++ b/numpy/lib/ufunclike.pyi @@ -1,10 +1,11 @@ from typing import Any, overload, TypeVar, List, Union -from numpy import floating, bool_, ndarray +from numpy import floating, bool_, object_, ndarray from numpy.typing import ( + _ArrayND, + _FloatLike_co, _ArrayLikeFloat_co, _ArrayLikeObject_co, - _ArrayOrScalar, ) _ArrayType = TypeVar("_ArrayType", bound=ndarray[Any, Any]) @@ -12,15 +13,20 @@ _ArrayType = TypeVar("_ArrayType", bound=ndarray[Any, Any]) __all__: List[str] @overload +def fix( # type: ignore[misc] + x: _FloatLike_co, + out: None = ..., +) -> floating[Any]: ... +@overload def fix( x: _ArrayLikeFloat_co, out: None = ..., -) -> _ArrayOrScalar[floating[Any]]: ... +) -> _ArrayND[floating[Any]]: ... @overload def fix( x: _ArrayLikeObject_co, out: None = ..., -) -> Any: ... +) -> _ArrayND[object_]: ... @overload def fix( x: Union[_ArrayLikeFloat_co, _ArrayLikeObject_co], @@ -28,10 +34,15 @@ def fix( ) -> _ArrayType: ... @overload +def isposinf( # type: ignore[misc] + x: _FloatLike_co, + out: None = ..., +) -> bool_: ... +@overload def isposinf( x: _ArrayLikeFloat_co, out: None = ..., -) -> _ArrayOrScalar[bool_]: ... +) -> _ArrayND[bool_]: ... @overload def isposinf( x: _ArrayLikeFloat_co, @@ -39,10 +50,15 @@ def isposinf( ) -> _ArrayType: ... @overload +def isneginf( # type: ignore[misc] + x: _FloatLike_co, + out: None = ..., +) -> bool_: ... +@overload def isneginf( x: _ArrayLikeFloat_co, out: None = ..., -) -> _ArrayOrScalar[bool_]: ... +) -> _ArrayND[bool_]: ... @overload def isneginf( x: _ArrayLikeFloat_co, diff --git a/numpy/lib/utils.pyi b/numpy/lib/utils.pyi index 5a1594149..0518655c6 100644 --- a/numpy/lib/utils.pyi +++ b/numpy/lib/utils.pyi @@ -1,4 +1,19 @@ -from typing import List +import sys +from ast import AST +from typing import ( + Any, + Callable, + List, + Mapping, + Optional, + overload, + Sequence, + Tuple, + TypeVar, + Union, +) + +from numpy import ndarray, generic from numpy.core.numerictypes import ( issubclass_ as issubclass_, @@ -6,14 +21,79 @@ from numpy.core.numerictypes import ( issubsctype as issubsctype, ) +if sys.version_info >= (3, 8): + from typing import Protocol +else: + from typing_extensions import Protocol + +_T_contra = TypeVar("_T_contra", contravariant=True) +_FuncType = TypeVar("_FuncType", bound=Callable[..., Any]) + +# A file-like object opened in `w` mode +class _SupportsWrite(Protocol[_T_contra]): + def write(self, __s: _T_contra) -> Any: ... + __all__: List[str] -def get_include(): ... -def deprecate(*args, **kwargs): ... -def deprecate_with_doc(msg): ... -def byte_bounds(a): ... -def who(vardict=...): ... -def info(object=..., maxwidth=..., output=..., toplevel=...): ... -def source(object, output=...): ... -def lookfor(what, module=..., import_modules=..., regenerate=..., output=...): ... -def safe_eval(source): ... +class _Deprecate: + old_name: Optional[str] + new_name: Optional[str] + message: Optional[str] + def __init__( + self, + old_name: Optional[str] = ..., + new_name: Optional[str] = ..., + message: Optional[str] = ..., + ) -> None: ... + # NOTE: `__call__` can in principle take arbitrary `*args` and `**kwargs`, + # even though they aren't used for anything + def __call__(self, func: _FuncType) -> _FuncType: ... + +def get_include() -> str: ... + +@overload +def deprecate( + *, + old_name: Optional[str] = ..., + new_name: Optional[str] = ..., + message: Optional[str] = ..., +) -> _Deprecate: ... +@overload +def deprecate( + __func: _FuncType, + old_name: Optional[str] = ..., + new_name: Optional[str] = ..., + message: Optional[str] = ..., +) -> _FuncType: ... + +def deprecate_with_doc(msg: Optional[str]) -> _Deprecate: ... + +# NOTE: In practice `byte_bounds` can (potentially) take any object +# implementing the `__array_interface__` protocol. The caveat is +# that certain keys, marked as optional in the spec, must be present for +# `byte_bounds`. This concerns `"strides"` and `"data"`. +def byte_bounds(a: Union[generic, ndarray[Any, Any]]) -> Tuple[int, int]: ... + +def who(vardict: Optional[Mapping[str, ndarray[Any, Any]]] = ...) -> None: ... + +def info( + object: object = ..., + maxwidth: int = ..., + output: Optional[_SupportsWrite[str]] = ..., + toplevel: str = ..., +) -> None: ... + +def source( + object: object, + output: Optional[_SupportsWrite[str]] = ..., +) -> None: ... + +def lookfor( + what: str, + module: Union[None, str, Sequence[str]] = ..., + import_modules: bool = ..., + regenerate: bool = ..., + output: Optional[_SupportsWrite[str]] =..., +) -> None: ... + +def safe_eval(source: Union[str, AST]) -> Any: ... diff --git a/numpy/linalg/setup.py b/numpy/linalg/setup.py index 5c9f2a4cb..e2944f38c 100644 --- a/numpy/linalg/setup.py +++ b/numpy/linalg/setup.py @@ -9,11 +9,6 @@ def configuration(parent_package='', top_path=None): config.add_subpackage('tests') - # Accelerate is buggy, disallow it. See also numpy/core/setup.py - for opt_order in (blas_opt_info.blas_order, lapack_opt_info.lapack_order): - if 'accelerate' in opt_order: - opt_order.remove('accelerate') - # Configure lapack_lite src_dir = 'lapack_lite' diff --git a/numpy/linalg/tests/test_linalg.py b/numpy/linalg/tests/test_linalg.py index 8a270f194..c6e8cdd03 100644 --- a/numpy/linalg/tests/test_linalg.py +++ b/numpy/linalg/tests/test_linalg.py @@ -684,7 +684,7 @@ class SVDHermitianCases(HermitianTestCase, HermitianGeneralizedTestCase): axes = list(range(mat.ndim)) axes[-1], axes[-2] = axes[-2], axes[-1] return np.conj(np.transpose(mat, axes=axes)) - + assert_almost_equal(np.matmul(u, hermitian(u)), np.broadcast_to(np.eye(u.shape[-1]), u.shape)) assert_almost_equal(np.matmul(vt, hermitian(vt)), np.broadcast_to(np.eye(vt.shape[-1]), vt.shape)) assert_equal(np.sort(s)[..., ::-1], s) @@ -766,6 +766,9 @@ class TestCond(CondCases): for A, p in itertools.product(As, p_neg): linalg.cond(A, p) + @pytest.mark.xfail(True, run=False, + reason="Platform/LAPACK-dependent failure, " + "see gh-18914") def test_nan(self): # nans should be passed through, not converted to infs ps = [None, 1, -1, 2, -2, 'fro'] @@ -981,7 +984,7 @@ class TestLstsq(LstsqCases): linalg.lstsq(A, y, rcond=None) -@pytest.mark.parametrize('dt', [np.dtype(c) for c in '?bBhHiIqQefdgFDGO']) +@pytest.mark.parametrize('dt', [np.dtype(c) for c in '?bBhHiIqQefdgFDGO']) class TestMatrixPower: rshft_0 = np.eye(4) @@ -1010,7 +1013,7 @@ class TestMatrixPower: mz = matrix_power(M, 0) assert_equal(mz, identity_like_generalized(M)) assert_equal(mz.dtype, M.dtype) - + for mat in self.rshft_all: tz(mat.astype(dt)) if dt != object: diff --git a/numpy/ma/__init__.pyi b/numpy/ma/__init__.pyi index 16e026272..a9a833e52 100644 --- a/numpy/ma/__init__.pyi +++ b/numpy/ma/__init__.pyi @@ -2,228 +2,231 @@ from typing import Any, List from numpy.ma import extras as extras -__all__: List[str] +from numpy.ma.core import ( + MAError as MAError, + MaskError as MaskError, + MaskType as MaskType, + MaskedArray as MaskedArray, + abs as abs, + absolute as absolute, + add as add, + all as all, + allclose as allclose, + allequal as allequal, + alltrue as alltrue, + amax as amax, + amin as amin, + angle as angle, + anom as anom, + anomalies as anomalies, + any as any, + append as append, + arange as arange, + arccos as arccos, + arccosh as arccosh, + arcsin as arcsin, + arcsinh as arcsinh, + arctan as arctan, + arctan2 as arctan2, + arctanh as arctanh, + argmax as argmax, + argmin as argmin, + argsort as argsort, + around as around, + array as array, + asanyarray as asanyarray, + asarray as asarray, + bitwise_and as bitwise_and, + bitwise_or as bitwise_or, + bitwise_xor as bitwise_xor, + bool_ as bool_, + ceil as ceil, + choose as choose, + clip as clip, + common_fill_value as common_fill_value, + compress as compress, + compressed as compressed, + concatenate as concatenate, + conjugate as conjugate, + convolve as convolve, + copy as copy, + correlate as correlate, + cos as cos, + cosh as cosh, + count as count, + cumprod as cumprod, + cumsum as cumsum, + default_fill_value as default_fill_value, + diag as diag, + diagonal as diagonal, + diff as diff, + divide as divide, + empty as empty, + empty_like as empty_like, + equal as equal, + exp as exp, + expand_dims as expand_dims, + fabs as fabs, + filled as filled, + fix_invalid as fix_invalid, + flatten_mask as flatten_mask, + flatten_structured_array as flatten_structured_array, + floor as floor, + floor_divide as floor_divide, + fmod as fmod, + frombuffer as frombuffer, + fromflex as fromflex, + fromfunction as fromfunction, + getdata as getdata, + getmask as getmask, + getmaskarray as getmaskarray, + greater as greater, + greater_equal as greater_equal, + harden_mask as harden_mask, + hypot as hypot, + identity as identity, + ids as ids, + indices as indices, + inner as inner, + innerproduct as innerproduct, + isMA as isMA, + isMaskedArray as isMaskedArray, + is_mask as is_mask, + is_masked as is_masked, + isarray as isarray, + left_shift as left_shift, + less as less, + less_equal as less_equal, + log as log, + log10 as log10, + log2 as log2, + logical_and as logical_and, + logical_not as logical_not, + logical_or as logical_or, + logical_xor as logical_xor, + make_mask as make_mask, + make_mask_descr as make_mask_descr, + make_mask_none as make_mask_none, + mask_or as mask_or, + masked as masked, + masked_array as masked_array, + masked_equal as masked_equal, + masked_greater as masked_greater, + masked_greater_equal as masked_greater_equal, + masked_inside as masked_inside, + masked_invalid as masked_invalid, + masked_less as masked_less, + masked_less_equal as masked_less_equal, + masked_not_equal as masked_not_equal, + masked_object as masked_object, + masked_outside as masked_outside, + masked_print_option as masked_print_option, + masked_singleton as masked_singleton, + masked_values as masked_values, + masked_where as masked_where, + max as max, + maximum as maximum, + maximum_fill_value as maximum_fill_value, + mean as mean, + min as min, + minimum as minimum, + minimum_fill_value as minimum_fill_value, + mod as mod, + multiply as multiply, + mvoid as mvoid, + ndim as ndim, + negative as negative, + nomask as nomask, + nonzero as nonzero, + not_equal as not_equal, + ones as ones, + outer as outer, + outerproduct as outerproduct, + power as power, + prod as prod, + product as product, + ptp as ptp, + put as put, + putmask as putmask, + ravel as ravel, + remainder as remainder, + repeat as repeat, + reshape as reshape, + resize as resize, + right_shift as right_shift, + round as round, + round_ as round_, + set_fill_value as set_fill_value, + shape as shape, + sin as sin, + sinh as sinh, + size as size, + soften_mask as soften_mask, + sometrue as sometrue, + sort as sort, + sqrt as sqrt, + squeeze as squeeze, + std as std, + subtract as subtract, + sum as sum, + swapaxes as swapaxes, + take as take, + tan as tan, + tanh as tanh, + trace as trace, + transpose as transpose, + true_divide as true_divide, + var as var, + where as where, + zeros as zeros, +) + +from numpy.ma.extras import ( + apply_along_axis as apply_along_axis, + apply_over_axes as apply_over_axes, + atleast_1d as atleast_1d, + atleast_2d as atleast_2d, + atleast_3d as atleast_3d, + average as average, + clump_masked as clump_masked, + clump_unmasked as clump_unmasked, + column_stack as column_stack, + compress_cols as compress_cols, + compress_nd as compress_nd, + compress_rowcols as compress_rowcols, + compress_rows as compress_rows, + count_masked as count_masked, + corrcoef as corrcoef, + cov as cov, + diagflat as diagflat, + dot as dot, + dstack as dstack, + ediff1d as ediff1d, + flatnotmasked_contiguous as flatnotmasked_contiguous, + flatnotmasked_edges as flatnotmasked_edges, + hsplit as hsplit, + hstack as hstack, + isin as isin, + in1d as in1d, + intersect1d as intersect1d, + mask_cols as mask_cols, + mask_rowcols as mask_rowcols, + mask_rows as mask_rows, + masked_all as masked_all, + masked_all_like as masked_all_like, + median as median, + mr_ as mr_, + notmasked_contiguous as notmasked_contiguous, + notmasked_edges as notmasked_edges, + polyfit as polyfit, + row_stack as row_stack, + setdiff1d as setdiff1d, + setxor1d as setxor1d, + stack as stack, + unique as unique, + union1d as union1d, + vander as vander, + vstack as vstack, +) -core: Any -extras: Any -MAError: Any -MaskError: Any -MaskType: Any -MaskedArray: Any -abs: Any -absolute: Any -add: Any -all: Any -allclose: Any -allequal: Any -alltrue: Any -amax: Any -amin: Any -angle: Any -anom: Any -anomalies: Any -any: Any -append: Any -arange: Any -arccos: Any -arccosh: Any -arcsin: Any -arcsinh: Any -arctan: Any -arctan2: Any -arctanh: Any -argmax: Any -argmin: Any -argsort: Any -around: Any -array: Any -asanyarray: Any -asarray: Any -bitwise_and: Any -bitwise_or: Any -bitwise_xor: Any -bool_: Any -ceil: Any -choose: Any -clip: Any -common_fill_value: Any -compress: Any -compressed: Any -concatenate: Any -conjugate: Any -convolve: Any -copy: Any -correlate: Any -cos: Any -cosh: Any -count: Any -cumprod: Any -cumsum: Any -default_fill_value: Any -diag: Any -diagonal: Any -diff: Any -divide: Any -empty: Any -empty_like: Any -equal: Any -exp: Any -expand_dims: Any -fabs: Any -filled: Any -fix_invalid: Any -flatten_mask: Any -flatten_structured_array: Any -floor: Any -floor_divide: Any -fmod: Any -frombuffer: Any -fromflex: Any -fromfunction: Any -getdata: Any -getmask: Any -getmaskarray: Any -greater: Any -greater_equal: Any -harden_mask: Any -hypot: Any -identity: Any -ids: Any -indices: Any -inner: Any -innerproduct: Any -isMA: Any -isMaskedArray: Any -is_mask: Any -is_masked: Any -isarray: Any -left_shift: Any -less: Any -less_equal: Any -log: Any -log10: Any -log2: Any -logical_and: Any -logical_not: Any -logical_or: Any -logical_xor: Any -make_mask: Any -make_mask_descr: Any -make_mask_none: Any -mask_or: Any -masked: Any -masked_array: Any -masked_equal: Any -masked_greater: Any -masked_greater_equal: Any -masked_inside: Any -masked_invalid: Any -masked_less: Any -masked_less_equal: Any -masked_not_equal: Any -masked_object: Any -masked_outside: Any -masked_print_option: Any -masked_singleton: Any -masked_values: Any -masked_where: Any -max: Any -maximum: Any -maximum_fill_value: Any -mean: Any -min: Any -minimum: Any -minimum_fill_value: Any -mod: Any -multiply: Any -mvoid: Any -ndim: Any -negative: Any -nomask: Any -nonzero: Any -not_equal: Any -ones: Any -outer: Any -outerproduct: Any -power: Any -prod: Any -product: Any -ptp: Any -put: Any -putmask: Any -ravel: Any -remainder: Any -repeat: Any -reshape: Any -resize: Any -right_shift: Any -round: Any -round_: Any -set_fill_value: Any -shape: Any -sin: Any -sinh: Any -size: Any -soften_mask: Any -sometrue: Any -sort: Any -sqrt: Any -squeeze: Any -std: Any -subtract: Any -sum: Any -swapaxes: Any -take: Any -tan: Any -tanh: Any -trace: Any -transpose: Any -true_divide: Any -var: Any -where: Any -zeros: Any -apply_along_axis: Any -apply_over_axes: Any -atleast_1d: Any -atleast_2d: Any -atleast_3d: Any -average: Any -clump_masked: Any -clump_unmasked: Any -column_stack: Any -compress_cols: Any -compress_nd: Any -compress_rowcols: Any -compress_rows: Any -count_masked: Any -corrcoef: Any -cov: Any -diagflat: Any -dot: Any -dstack: Any -ediff1d: Any -flatnotmasked_contiguous: Any -flatnotmasked_edges: Any -hsplit: Any -hstack: Any -isin: Any -in1d: Any -intersect1d: Any -mask_cols: Any -mask_rowcols: Any -mask_rows: Any -masked_all: Any -masked_all_like: Any -median: Any -mr_: Any -notmasked_contiguous: Any -notmasked_edges: Any -polyfit: Any -row_stack: Any -setdiff1d: Any -setxor1d: Any -stack: Any -unique: Any -union1d: Any -vander: Any -vstack: Any +__all__: List[str] diff --git a/numpy/ma/core.pyi b/numpy/ma/core.pyi new file mode 100644 index 000000000..e7e3f1f36 --- /dev/null +++ b/numpy/ma/core.pyi @@ -0,0 +1,468 @@ +from typing import Any, List, TypeVar, Callable +from numpy import ndarray, dtype, float64 + +from numpy import ( + amax as amax, + amin as amin, + bool_ as bool_, + expand_dims as expand_dims, + diff as diff, + clip as clip, + indices as indices, + ones_like as ones_like, + squeeze as squeeze, + zeros_like as zeros_like, +) + +from numpy.lib.function_base import ( + angle as angle, +) + +# TODO: Set the `bound` to something more suitable once we +# have proper shape support +_ShapeType = TypeVar("_ShapeType", bound=Any) +_DType_co = TypeVar("_DType_co", bound=dtype[Any], covariant=True) + +__all__: List[str] + +MaskType = bool_ +nomask: bool_ + +class MaskedArrayFutureWarning(FutureWarning): ... +class MAError(Exception): ... +class MaskError(MAError): ... + +def default_fill_value(obj): ... +def minimum_fill_value(obj): ... +def maximum_fill_value(obj): ... +def set_fill_value(a, fill_value): ... +def common_fill_value(a, b): ... +def filled(a, fill_value=...): ... +def getdata(a, subok=...): ... +get_data = getdata + +def fix_invalid(a, mask=..., copy=..., fill_value=...): ... + +class _MaskedUFunc: + f: Any + __doc__: Any + __name__: Any + def __init__(self, ufunc): ... + +class _MaskedUnaryOperation(_MaskedUFunc): + fill: Any + domain: Any + def __init__(self, mufunc, fill=..., domain=...): ... + def __call__(self, a, *args, **kwargs): ... + +class _MaskedBinaryOperation(_MaskedUFunc): + fillx: Any + filly: Any + def __init__(self, mbfunc, fillx=..., filly=...): ... + def __call__(self, a, b, *args, **kwargs): ... + def reduce(self, target, axis=..., dtype=...): ... + def outer(self, a, b): ... + def accumulate(self, target, axis=...): ... + +class _DomainedBinaryOperation(_MaskedUFunc): + domain: Any + fillx: Any + filly: Any + def __init__(self, dbfunc, domain, fillx=..., filly=...): ... + def __call__(self, a, b, *args, **kwargs): ... + +exp: _MaskedUnaryOperation +conjugate: _MaskedUnaryOperation +sin: _MaskedUnaryOperation +cos: _MaskedUnaryOperation +arctan: _MaskedUnaryOperation +arcsinh: _MaskedUnaryOperation +sinh: _MaskedUnaryOperation +cosh: _MaskedUnaryOperation +tanh: _MaskedUnaryOperation +abs: _MaskedUnaryOperation +absolute: _MaskedUnaryOperation +fabs: _MaskedUnaryOperation +negative: _MaskedUnaryOperation +floor: _MaskedUnaryOperation +ceil: _MaskedUnaryOperation +around: _MaskedUnaryOperation +logical_not: _MaskedUnaryOperation +sqrt: _MaskedUnaryOperation +log: _MaskedUnaryOperation +log2: _MaskedUnaryOperation +log10: _MaskedUnaryOperation +tan: _MaskedUnaryOperation +arcsin: _MaskedUnaryOperation +arccos: _MaskedUnaryOperation +arccosh: _MaskedUnaryOperation +arctanh: _MaskedUnaryOperation + +add: _MaskedBinaryOperation +subtract: _MaskedBinaryOperation +multiply: _MaskedBinaryOperation +arctan2: _MaskedBinaryOperation +equal: _MaskedBinaryOperation +not_equal: _MaskedBinaryOperation +less_equal: _MaskedBinaryOperation +greater_equal: _MaskedBinaryOperation +less: _MaskedBinaryOperation +greater: _MaskedBinaryOperation +logical_and: _MaskedBinaryOperation +alltrue: _MaskedBinaryOperation +logical_or: _MaskedBinaryOperation +sometrue: Callable[..., Any] +logical_xor: _MaskedBinaryOperation +bitwise_and: _MaskedBinaryOperation +bitwise_or: _MaskedBinaryOperation +bitwise_xor: _MaskedBinaryOperation +hypot: _MaskedBinaryOperation +divide: _MaskedBinaryOperation +true_divide: _MaskedBinaryOperation +floor_divide: _MaskedBinaryOperation +remainder: _MaskedBinaryOperation +fmod: _MaskedBinaryOperation +mod: _MaskedBinaryOperation + +def make_mask_descr(ndtype): ... +def getmask(a): ... +get_mask = getmask + +def getmaskarray(arr): ... +def is_mask(m): ... +def make_mask(m, copy=..., shrink=..., dtype=...): ... +def make_mask_none(newshape, dtype=...): ... +def mask_or(m1, m2, copy=..., shrink=...): ... +def flatten_mask(mask): ... +def masked_where(condition, a, copy=...): ... +def masked_greater(x, value, copy=...): ... +def masked_greater_equal(x, value, copy=...): ... +def masked_less(x, value, copy=...): ... +def masked_less_equal(x, value, copy=...): ... +def masked_not_equal(x, value, copy=...): ... +def masked_equal(x, value, copy=...): ... +def masked_inside(x, v1, v2, copy=...): ... +def masked_outside(x, v1, v2, copy=...): ... +def masked_object(x, value, copy=..., shrink=...): ... +def masked_values(x, value, rtol=..., atol=..., copy=..., shrink=...): ... +def masked_invalid(a, copy=...): ... + +class _MaskedPrintOption: + def __init__(self, display): ... + def display(self): ... + def set_display(self, s): ... + def enabled(self): ... + def enable(self, shrink=...): ... + +masked_print_option: _MaskedPrintOption + +def flatten_structured_array(a): ... + +class MaskedIterator: + ma: Any + dataiter: Any + maskiter: Any + def __init__(self, ma): ... + def __iter__(self): ... + def __getitem__(self, indx): ... + def __setitem__(self, index, value): ... + def __next__(self): ... + +class MaskedArray(ndarray[_ShapeType, _DType_co]): + __array_priority__: Any + def __new__(cls, data=..., mask=..., dtype=..., copy=..., subok=..., ndmin=..., fill_value=..., keep_mask=..., hard_mask=..., shrink=..., order=...): ... + def __array_finalize__(self, obj): ... + def __array_wrap__(self, obj, context=...): ... + def view(self, dtype=..., type=..., fill_value=...): ... + def __getitem__(self, indx): ... + def __setitem__(self, indx, value): ... + @property + def dtype(self): ... + @dtype.setter + def dtype(self, dtype): ... + @property + def shape(self): ... + @shape.setter + def shape(self, shape): ... + def __setmask__(self, mask, copy=...): ... + @property + def mask(self): ... + @mask.setter + def mask(self, value): ... + @property + def recordmask(self): ... + @recordmask.setter + def recordmask(self, mask): ... + def harden_mask(self): ... + def soften_mask(self): ... + @property + def hardmask(self): ... + def unshare_mask(self): ... + @property + def sharedmask(self): ... + def shrink_mask(self): ... + @property + def baseclass(self): ... + data: Any + @property + def flat(self): ... + @flat.setter + def flat(self, value): ... + @property + def fill_value(self): ... + @fill_value.setter + def fill_value(self, value=...): ... + get_fill_value: Any + set_fill_value: Any + def filled(self, fill_value=...): ... + def compressed(self): ... + def compress(self, condition, axis=..., out=...): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __add__(self, other): ... + def __radd__(self, other): ... + def __sub__(self, other): ... + def __rsub__(self, other): ... + def __mul__(self, other): ... + def __rmul__(self, other): ... + def __div__(self, other): ... + def __truediv__(self, other): ... + def __rtruediv__(self, other): ... + def __floordiv__(self, other): ... + def __rfloordiv__(self, other): ... + def __pow__(self, other): ... + def __rpow__(self, other): ... + def __iadd__(self, other): ... + def __isub__(self, other): ... + def __imul__(self, other): ... + def __idiv__(self, other): ... + def __ifloordiv__(self, other): ... + def __itruediv__(self, other): ... + def __ipow__(self, other): ... + def __float__(self): ... + def __int__(self): ... + @property # type: ignore[misc] + def imag(self): ... + get_imag: Any + @property # type: ignore[misc] + def real(self): ... + get_real: Any + def count(self, axis=..., keepdims=...): ... + def ravel(self, order=...): ... + def reshape(self, *s, **kwargs): ... + def resize(self, newshape, refcheck=..., order=...): ... + def put(self, indices, values, mode=...): ... + def ids(self): ... + def iscontiguous(self): ... + def all(self, axis=..., out=..., keepdims=...): ... + def any(self, axis=..., out=..., keepdims=...): ... + def nonzero(self): ... + def trace(self, offset=..., axis1=..., axis2=..., dtype=..., out=...): ... + def dot(self, b, out=..., strict=...): ... + def sum(self, axis=..., dtype=..., out=..., keepdims=...): ... + def cumsum(self, axis=..., dtype=..., out=...): ... + def prod(self, axis=..., dtype=..., out=..., keepdims=...): ... + product: Any + def cumprod(self, axis=..., dtype=..., out=...): ... + def mean(self, axis=..., dtype=..., out=..., keepdims=...): ... + def anom(self, axis=..., dtype=...): ... + def var(self, axis=..., dtype=..., out=..., ddof=..., keepdims=...): ... + def std(self, axis=..., dtype=..., out=..., ddof=..., keepdims=...): ... + def round(self, decimals=..., out=...): ... + def argsort(self, axis=..., kind=..., order=..., endwith=..., fill_value=...): ... + def argmin(self, axis=..., fill_value=..., out=...): ... + def argmax(self, axis=..., fill_value=..., out=...): ... + def sort(self, axis=..., kind=..., order=..., endwith=..., fill_value=...): ... + def min(self, axis=..., out=..., fill_value=..., keepdims=...): ... + # NOTE: deprecated + # def mini(self, axis=...): ... + # def tostring(self, fill_value=..., order=...): ... + def max(self, axis=..., out=..., fill_value=..., keepdims=...): ... + def ptp(self, axis=..., out=..., fill_value=..., keepdims=...): ... + def partition(self, *args, **kwargs): ... + def argpartition(self, *args, **kwargs): ... + def take(self, indices, axis=..., out=..., mode=...): ... + copy: Any + diagonal: Any + flatten: Any + repeat: Any + squeeze: Any + swapaxes: Any + T: Any + transpose: Any + def tolist(self, fill_value=...): ... + def tobytes(self, fill_value=..., order=...): ... + def tofile(self, fid, sep=..., format=...): ... + def toflex(self): ... + torecords: Any + def __reduce__(self): ... + def __deepcopy__(self, memo=...): ... + +class mvoid(MaskedArray[_ShapeType, _DType_co]): + def __new__( + self, + data, + mask=..., + dtype=..., + fill_value=..., + hardmask=..., + copy=..., + subok=..., + ): ... + def __getitem__(self, indx): ... + def __setitem__(self, indx, value): ... + def __iter__(self): ... + def __len__(self): ... + def filled(self, fill_value=...): ... + def tolist(self): ... + +def isMaskedArray(x): ... +isarray = isMaskedArray +isMA = isMaskedArray + +# 0D float64 array +class MaskedConstant(MaskedArray[Any, dtype[float64]]): + def __new__(cls): ... + __class__: Any + def __array_finalize__(self, obj): ... + def __array_prepare__(self, obj, context=...): ... + def __array_wrap__(self, obj, context=...): ... + def __format__(self, format_spec): ... + def __reduce__(self): ... + def __iop__(self, other): ... + __iadd__: Any + __isub__: Any + __imul__: Any + __ifloordiv__: Any + __itruediv__: Any + __ipow__: Any + def copy(self, *args, **kwargs): ... + def __copy__(self): ... + def __deepcopy__(self, memo): ... + def __setattr__(self, attr, value): ... + +masked: MaskedConstant +masked_singleton: MaskedConstant +masked_array = MaskedArray + +def array( + data, + dtype=..., + copy=..., + order=..., + mask=..., + fill_value=..., + keep_mask=..., + hard_mask=..., + shrink=..., + subok=..., + ndmin=..., +): ... +def is_masked(x): ... + +class _extrema_operation(_MaskedUFunc): + compare: Any + fill_value_func: Any + def __init__(self, ufunc, compare, fill_value): ... + # NOTE: in practice `b` has a default value, but users should + # explicitly provide a value here as the default is deprecated + def __call__(self, a, b): ... + def reduce(self, target, axis=...): ... + def outer(self, a, b): ... + +def min(obj, axis=..., out=..., fill_value=..., keepdims=...): ... +def max(obj, axis=..., out=..., fill_value=..., keepdims=...): ... +def ptp(obj, axis=..., out=..., fill_value=..., keepdims=...): ... + +class _frommethod: + __name__: Any + __doc__: Any + reversed: Any + def __init__(self, methodname, reversed=...): ... + def getdoc(self): ... + def __call__(self, a, *args, **params): ... + +all: _frommethod +anomalies: _frommethod +anom: _frommethod +any: _frommethod +compress: _frommethod +cumprod: _frommethod +cumsum: _frommethod +copy: _frommethod +diagonal: _frommethod +harden_mask: _frommethod +ids: _frommethod +mean: _frommethod +nonzero: _frommethod +prod: _frommethod +product: _frommethod +ravel: _frommethod +repeat: _frommethod +soften_mask: _frommethod +std: _frommethod +sum: _frommethod +swapaxes: _frommethod +trace: _frommethod +var: _frommethod +count: _frommethod +argmin: _frommethod +argmax: _frommethod + +minimum: _extrema_operation +maximum: _extrema_operation + +def take(a, indices, axis=..., out=..., mode=...): ... +def power(a, b, third=...): ... +def argsort(a, axis=..., kind=..., order=..., endwith=..., fill_value=...): ... +def sort(a, axis=..., kind=..., order=..., endwith=..., fill_value=...): ... +def compressed(x): ... +def concatenate(arrays, axis=...): ... +def diag(v, k=...): ... +def left_shift(a, n): ... +def right_shift(a, n): ... +def put(a, indices, values, mode=...): ... +def putmask(a, mask, values): ... +def transpose(a, axes=...): ... +def reshape(a, new_shape, order=...): ... +def resize(x, new_shape): ... +def ndim(obj): ... +def shape(obj): ... +def size(obj, axis=...): ... +def where(condition, x=..., y=...): ... +def choose(indices, choices, out=..., mode=...): ... +def round_(a, decimals=..., out=...): ... +round = round_ + +def inner(a, b): ... +innerproduct = inner + +def outer(a, b): ... +outerproduct = outer + +def correlate(a, v, mode=..., propagate_mask=...): ... +def convolve(a, v, mode=..., propagate_mask=...): ... +def allequal(a, b, fill_value=...): ... +def allclose(a, b, masked_equal=..., rtol=..., atol=...): ... +def asarray(a, dtype=..., order=...): ... +def asanyarray(a, dtype=...): ... +def fromflex(fxarray): ... + +class _convert2ma: + __doc__: Any + def __init__(self, funcname, params=...): ... + def getdoc(self): ... + def __call__(self, *args, **params): ... + +arange: _convert2ma +empty: _convert2ma +empty_like: _convert2ma +frombuffer: _convert2ma +fromfunction: _convert2ma +identity: _convert2ma +ones: _convert2ma +zeros: _convert2ma + +def append(a, b, axis=...): ... +def dot(a, b, strict=..., out=...): ... +def mask_rowcols(a, axis=...): ... diff --git a/numpy/ma/extras.pyi b/numpy/ma/extras.pyi new file mode 100644 index 000000000..e58e43bad --- /dev/null +++ b/numpy/ma/extras.pyi @@ -0,0 +1,84 @@ +from typing import Any, List +from numpy.lib.index_tricks import AxisConcatenator + +from numpy.ma.core import ( + dot as dot, + mask_rowcols as mask_rowcols, +) + +__all__: List[str] + +def count_masked(arr, axis=...): ... +def masked_all(shape, dtype = ...): ... +def masked_all_like(arr): ... + +class _fromnxfunction: + __name__: Any + __doc__: Any + def __init__(self, funcname): ... + def getdoc(self): ... + def __call__(self, *args, **params): ... + +class _fromnxfunction_single(_fromnxfunction): + def __call__(self, x, *args, **params): ... + +class _fromnxfunction_seq(_fromnxfunction): + def __call__(self, x, *args, **params): ... + +class _fromnxfunction_allargs(_fromnxfunction): + def __call__(self, *args, **params): ... + +atleast_1d: _fromnxfunction_allargs +atleast_2d: _fromnxfunction_allargs +atleast_3d: _fromnxfunction_allargs + +vstack: _fromnxfunction_seq +row_stack: _fromnxfunction_seq +hstack: _fromnxfunction_seq +column_stack: _fromnxfunction_seq +dstack: _fromnxfunction_seq +stack: _fromnxfunction_seq + +hsplit: _fromnxfunction_single +diagflat: _fromnxfunction_single + +def apply_along_axis(func1d, axis, arr, *args, **kwargs): ... +def apply_over_axes(func, a, axes): ... +def average(a, axis=..., weights=..., returned=...): ... +def median(a, axis=..., out=..., overwrite_input=..., keepdims=...): ... +def compress_nd(x, axis=...): ... +def compress_rowcols(x, axis=...): ... +def compress_rows(a): ... +def compress_cols(a): ... +def mask_rows(a, axis = ...): ... +def mask_cols(a, axis = ...): ... +def ediff1d(arr, to_end=..., to_begin=...): ... +def unique(ar1, return_index=..., return_inverse=...): ... +def intersect1d(ar1, ar2, assume_unique=...): ... +def setxor1d(ar1, ar2, assume_unique=...): ... +def in1d(ar1, ar2, assume_unique=..., invert=...): ... +def isin(element, test_elements, assume_unique=..., invert=...): ... +def union1d(ar1, ar2): ... +def setdiff1d(ar1, ar2, assume_unique=...): ... +def cov(x, y=..., rowvar=..., bias=..., allow_masked=..., ddof=...): ... +def corrcoef(x, y=..., rowvar=..., bias = ..., allow_masked=..., ddof = ...): ... + +class MAxisConcatenator(AxisConcatenator): + concatenate: Any + @classmethod + def makemat(cls, arr): ... + def __getitem__(self, key): ... + +class mr_class(MAxisConcatenator): + def __init__(self): ... + +mr_: mr_class + +def flatnotmasked_edges(a): ... +def notmasked_edges(a, axis=...): ... +def flatnotmasked_contiguous(a): ... +def notmasked_contiguous(a, axis=...): ... +def clump_unmasked(a): ... +def clump_masked(a): ... +def vander(x, n=...): ... +def polyfit(x, y, deg, rcond=..., full=..., w=..., cov=...): ... diff --git a/numpy/ma/mrecords.pyi b/numpy/ma/mrecords.pyi new file mode 100644 index 000000000..92d5afb89 --- /dev/null +++ b/numpy/ma/mrecords.pyi @@ -0,0 +1,88 @@ +from typing import List, Any, TypeVar + +from numpy import dtype +from numpy.ma import MaskedArray + +__all__: List[str] + +# TODO: Set the `bound` to something more suitable once we +# have proper shape support +_ShapeType = TypeVar("_ShapeType", bound=Any) +_DType_co = TypeVar("_DType_co", bound=dtype[Any], covariant=True) + +class MaskedRecords(MaskedArray[_ShapeType, _DType_co]): + def __new__( + cls, + shape, + dtype=..., + buf=..., + offset=..., + strides=..., + formats=..., + names=..., + titles=..., + byteorder=..., + aligned=..., + mask=..., + hard_mask=..., + fill_value=..., + keep_mask=..., + copy=..., + **options, + ): ... + _mask: Any + _fill_value: Any + @property + def _data(self): ... + @property + def _fieldmask(self): ... + def __array_finalize__(self, obj): ... + def __len__(self): ... + def __getattribute__(self, attr): ... + def __setattr__(self, attr, val): ... + def __getitem__(self, indx): ... + def __setitem__(self, indx, value): ... + def view(self, dtype=..., type=...): ... + def harden_mask(self): ... + def soften_mask(self): ... + def copy(self): ... + def tolist(self, fill_value=...): ... + def __reduce__(self): ... + +mrecarray = MaskedRecords + +def fromarrays( + arraylist, + dtype=..., + shape=..., + formats=..., + names=..., + titles=..., + aligned=..., + byteorder=..., + fill_value=..., +): ... + +def fromrecords( + reclist, + dtype=..., + shape=..., + formats=..., + names=..., + titles=..., + aligned=..., + byteorder=..., + fill_value=..., + mask=..., +): ... + +def fromtextfile( + fname, + delimitor=..., + commentchar=..., + missingchar=..., + varnames=..., + vartypes=..., +): ... + +def addfield(mrecord, newfield, newfieldname=...): ... diff --git a/numpy/polynomial/__init__.pyi b/numpy/polynomial/__init__.pyi index 6a7406041..bebedb3a6 100644 --- a/numpy/polynomial/__init__.pyi +++ b/numpy/polynomial/__init__.pyi @@ -1,4 +1,4 @@ -from typing import Any, List +from typing import List from numpy.polynomial import ( chebyshev as chebyshev, @@ -8,13 +8,13 @@ from numpy.polynomial import ( legendre as legendre, polynomial as polynomial, ) +from numpy.polynomial.chebyshev import Chebyshev as Chebyshev +from numpy.polynomial.hermite import Hermite as Hermite +from numpy.polynomial.hermite_e import HermiteE as HermiteE +from numpy.polynomial.laguerre import Laguerre as Laguerre +from numpy.polynomial.legendre import Legendre as Legendre +from numpy.polynomial.polynomial import Polynomial as Polynomial __all__: List[str] -Polynomial: Any -Chebyshev: Any -Legendre: Any -Hermite: Any -HermiteE: Any -Laguerre: Any -set_default_printstyle: Any +def set_default_printstyle(style): ... diff --git a/numpy/polynomial/_polybase.pyi b/numpy/polynomial/_polybase.pyi new file mode 100644 index 000000000..c41601469 --- /dev/null +++ b/numpy/polynomial/_polybase.pyi @@ -0,0 +1,69 @@ +import abc +from typing import Any, List, ClassVar + +__all__: List[str] + +class ABCPolyBase(abc.ABC): + __hash__: ClassVar[None] # type: ignore[assignment] + __array_ufunc__: ClassVar[None] + maxpower: ClassVar[int] + coef: Any + @property + @abc.abstractmethod + def domain(self): ... + @property + @abc.abstractmethod + def window(self): ... + @property + @abc.abstractmethod + def basis_name(self): ... + def has_samecoef(self, other): ... + def has_samedomain(self, other): ... + def has_samewindow(self, other): ... + def has_sametype(self, other): ... + def __init__(self, coef, domain=..., window=...): ... + def __format__(self, fmt_str): ... + def __call__(self, arg): ... + def __iter__(self): ... + def __len__(self): ... + def __neg__(self): ... + def __pos__(self): ... + def __add__(self, other): ... + def __sub__(self, other): ... + def __mul__(self, other): ... + def __truediv__(self, other): ... + def __floordiv__(self, other): ... + def __mod__(self, other): ... + def __divmod__(self, other): ... + def __pow__(self, other): ... + def __radd__(self, other): ... + def __rsub__(self, other): ... + def __rmul__(self, other): ... + def __rdiv__(self, other): ... + def __rtruediv__(self, other): ... + def __rfloordiv__(self, other): ... + def __rmod__(self, other): ... + def __rdivmod__(self, other): ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def copy(self): ... + def degree(self): ... + def cutdeg(self, deg): ... + def trim(self, tol=...): ... + def truncate(self, size): ... + def convert(self, domain=..., kind=..., window=...): ... + def mapparms(self): ... + def integ(self, m=..., k = ..., lbnd=...): ... + def deriv(self, m=...): ... + def roots(self): ... + def linspace(self, n=..., domain=...): ... + @classmethod + def fit(cls, x, y, deg, domain=..., rcond=..., full=..., w=..., window=...): ... + @classmethod + def fromroots(cls, roots, domain = ..., window=...): ... + @classmethod + def identity(cls, domain=..., window=...): ... + @classmethod + def basis(cls, deg, domain=..., window=...): ... + @classmethod + def cast(cls, series, domain=..., window=...): ... diff --git a/numpy/polynomial/chebyshev.pyi b/numpy/polynomial/chebyshev.pyi new file mode 100644 index 000000000..841c0859b --- /dev/null +++ b/numpy/polynomial/chebyshev.pyi @@ -0,0 +1,51 @@ +from typing import Any, List + +from numpy import ndarray, dtype, int_ +from numpy.polynomial._polybase import ABCPolyBase +from numpy.polynomial.polyutils import trimcoef + +__all__: List[str] + +chebtrim = trimcoef + +def poly2cheb(pol): ... +def cheb2poly(c): ... + +chebdomain: ndarray[Any, dtype[int_]] +chebzero: ndarray[Any, dtype[int_]] +chebone: ndarray[Any, dtype[int_]] +chebx: ndarray[Any, dtype[int_]] + +def chebline(off, scl): ... +def chebfromroots(roots): ... +def chebadd(c1, c2): ... +def chebsub(c1, c2): ... +def chebmulx(c): ... +def chebmul(c1, c2): ... +def chebdiv(c1, c2): ... +def chebpow(c, pow, maxpower=...): ... +def chebder(c, m=..., scl=..., axis=...): ... +def chebint(c, m=..., k = ..., lbnd=..., scl=..., axis=...): ... +def chebval(x, c, tensor=...): ... +def chebval2d(x, y, c): ... +def chebgrid2d(x, y, c): ... +def chebval3d(x, y, z, c): ... +def chebgrid3d(x, y, z, c): ... +def chebvander(x, deg): ... +def chebvander2d(x, y, deg): ... +def chebvander3d(x, y, z, deg): ... +def chebfit(x, y, deg, rcond=..., full=..., w=...): ... +def chebcompanion(c): ... +def chebroots(c): ... +def chebinterpolate(func, deg, args = ...): ... +def chebgauss(deg): ... +def chebweight(x): ... +def chebpts1(npts): ... +def chebpts2(npts): ... + +class Chebyshev(ABCPolyBase): + @classmethod + def interpolate(cls, func, deg, domain=..., args = ...): ... + domain: Any + window: Any + basis_name: Any diff --git a/numpy/polynomial/hermite.pyi b/numpy/polynomial/hermite.pyi new file mode 100644 index 000000000..8364a5b0f --- /dev/null +++ b/numpy/polynomial/hermite.pyi @@ -0,0 +1,46 @@ +from typing import Any, List + +from numpy import ndarray, dtype, int_, float_ +from numpy.polynomial._polybase import ABCPolyBase +from numpy.polynomial.polyutils import trimcoef + +__all__: list[str] + +hermtrim = trimcoef + +def poly2herm(pol): ... +def herm2poly(c): ... + +hermdomain: ndarray[Any, dtype[int_]] +hermzero: ndarray[Any, dtype[int_]] +hermone: ndarray[Any, dtype[int_]] +hermx: ndarray[Any, dtype[float_]] + +def hermline(off, scl): ... +def hermfromroots(roots): ... +def hermadd(c1, c2): ... +def hermsub(c1, c2): ... +def hermmulx(c): ... +def hermmul(c1, c2): ... +def hermdiv(c1, c2): ... +def hermpow(c, pow, maxpower=...): ... +def hermder(c, m=..., scl=..., axis=...): ... +def hermint(c, m=..., k = ..., lbnd=..., scl=..., axis=...): ... +def hermval(x, c, tensor=...): ... +def hermval2d(x, y, c): ... +def hermgrid2d(x, y, c): ... +def hermval3d(x, y, z, c): ... +def hermgrid3d(x, y, z, c): ... +def hermvander(x, deg): ... +def hermvander2d(x, y, deg): ... +def hermvander3d(x, y, z, deg): ... +def hermfit(x, y, deg, rcond=..., full=..., w=...): ... +def hermcompanion(c): ... +def hermroots(c): ... +def hermgauss(deg): ... +def hermweight(x): ... + +class Hermite(ABCPolyBase): + domain: Any + window: Any + basis_name: Any diff --git a/numpy/polynomial/hermite_e.pyi b/numpy/polynomial/hermite_e.pyi new file mode 100644 index 000000000..c029bfda7 --- /dev/null +++ b/numpy/polynomial/hermite_e.pyi @@ -0,0 +1,46 @@ +from typing import Any, List + +from numpy import ndarray, dtype, int_ +from numpy.polynomial._polybase import ABCPolyBase +from numpy.polynomial.polyutils import trimcoef + +__all__: list[str] + +hermetrim = trimcoef + +def poly2herme(pol): ... +def herme2poly(c): ... + +hermedomain: ndarray[Any, dtype[int_]] +hermezero: ndarray[Any, dtype[int_]] +hermeone: ndarray[Any, dtype[int_]] +hermex: ndarray[Any, dtype[int_]] + +def hermeline(off, scl): ... +def hermefromroots(roots): ... +def hermeadd(c1, c2): ... +def hermesub(c1, c2): ... +def hermemulx(c): ... +def hermemul(c1, c2): ... +def hermediv(c1, c2): ... +def hermepow(c, pow, maxpower=...): ... +def hermeder(c, m=..., scl=..., axis=...): ... +def hermeint(c, m=..., k = ..., lbnd=..., scl=..., axis=...): ... +def hermeval(x, c, tensor=...): ... +def hermeval2d(x, y, c): ... +def hermegrid2d(x, y, c): ... +def hermeval3d(x, y, z, c): ... +def hermegrid3d(x, y, z, c): ... +def hermevander(x, deg): ... +def hermevander2d(x, y, deg): ... +def hermevander3d(x, y, z, deg): ... +def hermefit(x, y, deg, rcond=..., full=..., w=...): ... +def hermecompanion(c): ... +def hermeroots(c): ... +def hermegauss(deg): ... +def hermeweight(x): ... + +class HermiteE(ABCPolyBase): + domain: Any + window: Any + basis_name: Any diff --git a/numpy/polynomial/laguerre.pyi b/numpy/polynomial/laguerre.pyi new file mode 100644 index 000000000..2b9ab34e0 --- /dev/null +++ b/numpy/polynomial/laguerre.pyi @@ -0,0 +1,46 @@ +from typing import Any, List + +from numpy import ndarray, dtype, int_ +from numpy.polynomial._polybase import ABCPolyBase +from numpy.polynomial.polyutils import trimcoef + +__all__: list[str] + +lagtrim = trimcoef + +def poly2lag(pol): ... +def lag2poly(c): ... + +lagdomain: ndarray[Any, dtype[int_]] +lagzero: ndarray[Any, dtype[int_]] +lagone: ndarray[Any, dtype[int_]] +lagx: ndarray[Any, dtype[int_]] + +def lagline(off, scl): ... +def lagfromroots(roots): ... +def lagadd(c1, c2): ... +def lagsub(c1, c2): ... +def lagmulx(c): ... +def lagmul(c1, c2): ... +def lagdiv(c1, c2): ... +def lagpow(c, pow, maxpower=...): ... +def lagder(c, m=..., scl=..., axis=...): ... +def lagint(c, m=..., k = ..., lbnd=..., scl=..., axis=...): ... +def lagval(x, c, tensor=...): ... +def lagval2d(x, y, c): ... +def laggrid2d(x, y, c): ... +def lagval3d(x, y, z, c): ... +def laggrid3d(x, y, z, c): ... +def lagvander(x, deg): ... +def lagvander2d(x, y, deg): ... +def lagvander3d(x, y, z, deg): ... +def lagfit(x, y, deg, rcond=..., full=..., w=...): ... +def lagcompanion(c): ... +def lagroots(c): ... +def laggauss(deg): ... +def lagweight(x): ... + +class Laguerre(ABCPolyBase): + domain: Any + window: Any + basis_name: Any diff --git a/numpy/polynomial/legendre.pyi b/numpy/polynomial/legendre.pyi new file mode 100644 index 000000000..86aef1793 --- /dev/null +++ b/numpy/polynomial/legendre.pyi @@ -0,0 +1,46 @@ +from typing import Any, List + +from numpy import ndarray, dtype, int_ +from numpy.polynomial._polybase import ABCPolyBase +from numpy.polynomial.polyutils import trimcoef + +__all__: list[str] + +legtrim = trimcoef + +def poly2leg(pol): ... +def leg2poly(c): ... + +legdomain: ndarray[Any, dtype[int_]] +legzero: ndarray[Any, dtype[int_]] +legone: ndarray[Any, dtype[int_]] +legx: ndarray[Any, dtype[int_]] + +def legline(off, scl): ... +def legfromroots(roots): ... +def legadd(c1, c2): ... +def legsub(c1, c2): ... +def legmulx(c): ... +def legmul(c1, c2): ... +def legdiv(c1, c2): ... +def legpow(c, pow, maxpower=...): ... +def legder(c, m=..., scl=..., axis=...): ... +def legint(c, m=..., k = ..., lbnd=..., scl=..., axis=...): ... +def legval(x, c, tensor=...): ... +def legval2d(x, y, c): ... +def leggrid2d(x, y, c): ... +def legval3d(x, y, z, c): ... +def leggrid3d(x, y, z, c): ... +def legvander(x, deg): ... +def legvander2d(x, y, deg): ... +def legvander3d(x, y, z, deg): ... +def legfit(x, y, deg, rcond=..., full=..., w=...): ... +def legcompanion(c): ... +def legroots(c): ... +def leggauss(deg): ... +def legweight(x): ... + +class Legendre(ABCPolyBase): + domain: Any + window: Any + basis_name: Any diff --git a/numpy/polynomial/polynomial.pyi b/numpy/polynomial/polynomial.pyi new file mode 100644 index 000000000..f779300a9 --- /dev/null +++ b/numpy/polynomial/polynomial.pyi @@ -0,0 +1,41 @@ +from typing import Any, List + +from numpy import ndarray, dtype, int_ +from numpy.polynomial._polybase import ABCPolyBase +from numpy.polynomial.polyutils import trimcoef + +__all__: list[str] + +polytrim = trimcoef + +polydomain: ndarray[Any, dtype[int_]] +polyzero: ndarray[Any, dtype[int_]] +polyone: ndarray[Any, dtype[int_]] +polyx: ndarray[Any, dtype[int_]] + +def polyline(off, scl): ... +def polyfromroots(roots): ... +def polyadd(c1, c2): ... +def polysub(c1, c2): ... +def polymulx(c): ... +def polymul(c1, c2): ... +def polydiv(c1, c2): ... +def polypow(c, pow, maxpower=...): ... +def polyder(c, m=..., scl=..., axis=...): ... +def polyint(c, m=..., k=..., lbnd=..., scl=..., axis=...): ... +def polyval(x, c, tensor=...): ... +def polyvalfromroots(x, r, tensor=...): ... +def polyval2d(x, y, c): ... +def polygrid2d(x, y, c): ... +def polyval3d(x, y, z, c): ... +def polygrid3d(x, y, z, c): ... +def polyvander(x, deg): ... +def polyvander2d(x, y, deg): ... +def polyvander3d(x, y, z, deg): ... +def polyfit(x, y, deg, rcond=..., full=..., w=...): ... +def polyroots(c): ... + +class Polynomial(ABCPolyBase): + domain: Any + window: Any + basis_name: Any diff --git a/numpy/polynomial/polyutils.pyi b/numpy/polynomial/polyutils.pyi new file mode 100644 index 000000000..0befa740e --- /dev/null +++ b/numpy/polynomial/polyutils.pyi @@ -0,0 +1,17 @@ +from typing import List + +__all__: List[str] + +class RankWarning(UserWarning): ... +class PolyError(Exception): ... +class PolyDomainError(PolyError): ... + +# NOTE: Deprecated +# class PolyBase: ... + +def trimseq(seq): ... +def as_series(alist, trim=...): ... +def trimcoef(c, tol=...): ... +def getdomain(x): ... +def mapparms(old, new): ... +def mapdomain(x, old, new): ... diff --git a/numpy/random/__init__.py b/numpy/random/__init__.py index 7efa5c07f..2e8f99fe3 100644 --- a/numpy/random/__init__.py +++ b/numpy/random/__init__.py @@ -17,6 +17,7 @@ BitGenerator Streams that work with Generator --------------------------------------------- --- MT19937 PCG64 +PCG64DXSM Philox SFC64 ============================================= === @@ -183,13 +184,14 @@ from . import _bounded_integers from ._generator import Generator, default_rng from .bit_generator import SeedSequence, BitGenerator from ._mt19937 import MT19937 -from ._pcg64 import PCG64 +from ._pcg64 import PCG64, PCG64DXSM from ._philox import Philox from ._sfc64 import SFC64 from .mtrand import * __all__ += ['Generator', 'RandomState', 'SeedSequence', 'MT19937', - 'Philox', 'PCG64', 'SFC64', 'default_rng', 'BitGenerator'] + 'Philox', 'PCG64', 'PCG64DXSM', 'SFC64', 'default_rng', + 'BitGenerator'] def __RandomState_ctor(): diff --git a/numpy/random/__init__.pyi b/numpy/random/__init__.pyi index 1187b7d8e..48b620c48 100644 --- a/numpy/random/__init__.pyi +++ b/numpy/random/__init__.pyi @@ -3,7 +3,10 @@ from typing import List from numpy.random._generator import Generator as Generator from numpy.random._generator import default_rng as default_rng from numpy.random._mt19937 import MT19937 as MT19937 -from numpy.random._pcg64 import PCG64 as PCG64 +from numpy.random._pcg64 import ( + PCG64 as PCG64, + PCG64DXSM as PCG64DXSM, +) from numpy.random._philox import Philox as Philox from numpy.random._sfc64 import SFC64 as SFC64 from numpy.random.bit_generator import BitGenerator as BitGenerator diff --git a/numpy/random/_pcg64.pyi b/numpy/random/_pcg64.pyi index a4f6e0760..25e2fdde6 100644 --- a/numpy/random/_pcg64.pyi +++ b/numpy/random/_pcg64.pyi @@ -32,3 +32,17 @@ class PCG64(BitGenerator): value: _PCG64State, ) -> None: ... def advance(self, delta: int) -> PCG64: ... + +class PCG64DXSM(BitGenerator): + def __init__(self, seed: Union[None, _ArrayLikeInt_co, SeedSequence] = ...) -> None: ... + def jumped(self, jumps: int = ...) -> PCG64DXSM: ... + @property + def state( + self, + ) -> _PCG64State: ... + @state.setter + def state( + self, + value: _PCG64State, + ) -> None: ... + def advance(self, delta: int) -> PCG64DXSM: ... diff --git a/numpy/random/_pcg64.pyx b/numpy/random/_pcg64.pyx index 605aae4bc..8a00dc265 100644 --- a/numpy/random/_pcg64.pyx +++ b/numpy/random/_pcg64.pyx @@ -26,6 +26,10 @@ cdef extern from "src/pcg64/pcg64.h": void pcg64_get_state(pcg64_state *state, uint64_t *state_arr, int *has_uint32, uint32_t *uinteger) void pcg64_set_state(pcg64_state *state, uint64_t *state_arr, int has_uint32, uint32_t uinteger) + uint64_t pcg64_cm_next64(pcg64_state *state) nogil + uint32_t pcg64_cm_next32(pcg64_state *state) nogil + void pcg64_cm_advance(pcg64_state *state, uint64_t *step) + cdef uint64_t pcg64_uint64(void* st) nogil: return pcg64_next64(<pcg64_state *>st) @@ -35,6 +39,14 @@ cdef uint32_t pcg64_uint32(void *st) nogil: cdef double pcg64_double(void* st) nogil: return uint64_to_double(pcg64_next64(<pcg64_state *>st)) +cdef uint64_t pcg64_cm_uint64(void* st) nogil: + return pcg64_cm_next64(<pcg64_state *>st) + +cdef uint32_t pcg64_cm_uint32(void *st) nogil: + return pcg64_cm_next32(<pcg64_state *> st) + +cdef double pcg64_cm_double(void* st) nogil: + return uint64_to_double(pcg64_cm_next64(<pcg64_state *>st)) cdef class PCG64(BitGenerator): """ @@ -268,3 +280,239 @@ cdef class PCG64(BitGenerator): pcg64_advance(&self.rng_state, <uint64_t *>np.PyArray_DATA(d)) self._reset_state_variables() return self + + +cdef class PCG64DXSM(BitGenerator): + """ + PCG64DXSM(seed=None) + + BitGenerator for the PCG-64 DXSM pseudo-random number generator. + + Parameters + ---------- + seed : {None, int, array_like[ints], SeedSequence}, optional + A seed to initialize the `BitGenerator`. If None, then fresh, + unpredictable entropy will be pulled from the OS. If an ``int`` or + ``array_like[ints]`` is passed, then it will be passed to + `SeedSequence` to derive the initial `BitGenerator` state. One may also + pass in a `SeedSequence` instance. + + Notes + ----- + PCG-64 DXSM is a 128-bit implementation of O'Neill's permutation congruential + generator ([1]_, [2]_). PCG-64 DXSM has a period of :math:`2^{128}` and supports + advancing an arbitrary number of steps as well as :math:`2^{127}` streams. + The specific member of the PCG family that we use is PCG CM DXSM 128/64. It + differs from ``PCG64`` in that it uses the stronger DXSM output function, + a 64-bit "cheap multiplier" in the LCG, and outputs from the state before + advancing it rather than advance-then-output. + + ``PCG64DXSM`` provides a capsule containing function pointers that produce + doubles, and unsigned 32 and 64- bit integers. These are not + directly consumable in Python and must be consumed by a ``Generator`` + or similar object that supports low-level access. + + Supports the method :meth:`advance` to advance the RNG an arbitrary number of + steps. The state of the PCG-64 DXSM RNG is represented by 2 128-bit unsigned + integers. + + **State and Seeding** + + The ``PCG64DXSM`` state vector consists of 2 unsigned 128-bit values, + which are represented externally as Python ints. One is the state of the + PRNG, which is advanced by a linear congruential generator (LCG). The + second is a fixed odd increment used in the LCG. + + The input seed is processed by `SeedSequence` to generate both values. The + increment is not independently settable. + + **Parallel Features** + + The preferred way to use a BitGenerator in parallel applications is to use + the `SeedSequence.spawn` method to obtain entropy values, and to use these + to generate new BitGenerators: + + >>> from numpy.random import Generator, PCG64DXSM, SeedSequence + >>> sg = SeedSequence(1234) + >>> rg = [Generator(PCG64DXSM(s)) for s in sg.spawn(10)] + + **Compatibility Guarantee** + + ``PCG64DXSM`` makes a guarantee that a fixed seed and will always produce + the same random integer stream. + + References + ---------- + .. [1] `"PCG, A Family of Better Random Number Generators" + <http://www.pcg-random.org/>`_ + .. [2] O'Neill, Melissa E. `"PCG: A Family of Simple Fast Space-Efficient + Statistically Good Algorithms for Random Number Generation" + <https://www.cs.hmc.edu/tr/hmc-cs-2014-0905.pdf>`_ + """ + cdef pcg64_state rng_state + cdef pcg64_random_t pcg64_random_state + + def __init__(self, seed=None): + BitGenerator.__init__(self, seed) + self.rng_state.pcg_state = &self.pcg64_random_state + + self._bitgen.state = <void *>&self.rng_state + self._bitgen.next_uint64 = &pcg64_cm_uint64 + self._bitgen.next_uint32 = &pcg64_cm_uint32 + self._bitgen.next_double = &pcg64_cm_double + self._bitgen.next_raw = &pcg64_cm_uint64 + # Seed the _bitgen + val = self._seed_seq.generate_state(4, np.uint64) + pcg64_set_seed(&self.rng_state, + <uint64_t *>np.PyArray_DATA(val), + (<uint64_t *>np.PyArray_DATA(val) + 2)) + self._reset_state_variables() + + cdef _reset_state_variables(self): + self.rng_state.has_uint32 = 0 + self.rng_state.uinteger = 0 + + cdef jump_inplace(self, jumps): + """ + Jump state in-place + Not part of public API + + Parameters + ---------- + jumps : integer, positive + Number of times to jump the state of the rng. + + Notes + ----- + The step size is phi-1 when multiplied by 2**128 where phi is the + golden ratio. + """ + step = 0x9e3779b97f4a7c15f39cc0605cedc835 + self.advance(step * int(jumps)) + + def jumped(self, jumps=1): + """ + jumped(jumps=1) + + Returns a new bit generator with the state jumped. + + Jumps the state as-if jumps * 210306068529402873165736369884012333109 + random numbers have been generated. + + Parameters + ---------- + jumps : integer, positive + Number of times to jump the state of the bit generator returned + + Returns + ------- + bit_generator : PCG64DXSM + New instance of generator jumped iter times + + Notes + ----- + The step size is phi-1 when multiplied by 2**128 where phi is the + golden ratio. + """ + cdef PCG64DXSM bit_generator + + bit_generator = self.__class__() + bit_generator.state = self.state + bit_generator.jump_inplace(jumps) + + return bit_generator + + @property + def state(self): + """ + Get or set the PRNG state + + Returns + ------- + state : dict + Dictionary containing the information required to describe the + state of the PRNG + """ + cdef np.ndarray state_vec + cdef int has_uint32 + cdef uint32_t uinteger + + # state_vec is state.high, state.low, inc.high, inc.low + state_vec = <np.ndarray>np.empty(4, dtype=np.uint64) + pcg64_get_state(&self.rng_state, + <uint64_t *>np.PyArray_DATA(state_vec), + &has_uint32, &uinteger) + state = int(state_vec[0]) * 2**64 + int(state_vec[1]) + inc = int(state_vec[2]) * 2**64 + int(state_vec[3]) + return {'bit_generator': self.__class__.__name__, + 'state': {'state': state, 'inc': inc}, + 'has_uint32': has_uint32, + 'uinteger': uinteger} + + @state.setter + def state(self, value): + cdef np.ndarray state_vec + cdef int has_uint32 + cdef uint32_t uinteger + if not isinstance(value, dict): + raise TypeError('state must be a dict') + bitgen = value.get('bit_generator', '') + if bitgen != self.__class__.__name__: + raise ValueError('state must be for a {0} ' + 'RNG'.format(self.__class__.__name__)) + state_vec = <np.ndarray>np.empty(4, dtype=np.uint64) + state_vec[0] = value['state']['state'] // 2 ** 64 + state_vec[1] = value['state']['state'] % 2 ** 64 + state_vec[2] = value['state']['inc'] // 2 ** 64 + state_vec[3] = value['state']['inc'] % 2 ** 64 + has_uint32 = value['has_uint32'] + uinteger = value['uinteger'] + pcg64_set_state(&self.rng_state, + <uint64_t *>np.PyArray_DATA(state_vec), + has_uint32, uinteger) + + def advance(self, delta): + """ + advance(delta) + + Advance the underlying RNG as-if delta draws have occurred. + + Parameters + ---------- + delta : integer, positive + Number of draws to advance the RNG. Must be less than the + size state variable in the underlying RNG. + + Returns + ------- + self : PCG64 + RNG advanced delta steps + + Notes + ----- + Advancing a RNG updates the underlying RNG state as-if a given + number of calls to the underlying RNG have been made. In general + there is not a one-to-one relationship between the number output + random values from a particular distribution and the number of + draws from the core RNG. This occurs for two reasons: + + * The random values are simulated using a rejection-based method + and so, on average, more than one value from the underlying + RNG is required to generate an single draw. + * The number of bits required to generate a simulated value + differs from the number of bits generated by the underlying + RNG. For example, two 16-bit integer values can be simulated + from a single draw of a 32-bit RNG. + + Advancing the RNG state resets any pre-computed random numbers. + This is required to ensure exact reproducibility. + """ + delta = wrap_int(delta, 128) + + cdef np.ndarray d = np.empty(2, dtype=np.uint64) + d[0] = delta // 2**64 + d[1] = delta % 2**64 + pcg64_cm_advance(&self.rng_state, <uint64_t *>np.PyArray_DATA(d)) + self._reset_state_variables() + return self + diff --git a/numpy/random/_pickle.py b/numpy/random/_pickle.py index 71b01d6cd..a32f64f4a 100644 --- a/numpy/random/_pickle.py +++ b/numpy/random/_pickle.py @@ -1,6 +1,6 @@ from .mtrand import RandomState from ._philox import Philox -from ._pcg64 import PCG64 +from ._pcg64 import PCG64, PCG64DXSM from ._sfc64 import SFC64 from ._generator import Generator @@ -8,6 +8,7 @@ from ._mt19937 import MT19937 BitGenerators = {'MT19937': MT19937, 'PCG64': PCG64, + 'PCG64DXSM': PCG64DXSM, 'Philox': Philox, 'SFC64': SFC64, } diff --git a/numpy/random/src/pcg64/pcg64.c b/numpy/random/src/pcg64/pcg64.c index b15973aef..c623c809b 100644 --- a/numpy/random/src/pcg64/pcg64.c +++ b/numpy/random/src/pcg64/pcg64.c @@ -61,6 +61,10 @@ pcg_setseq_128_xsl_rr_64_boundedrand_r(pcg_state_setseq_128 *rng, uint64_t bound); extern inline void pcg_setseq_128_advance_r(pcg_state_setseq_128 *rng, pcg128_t delta); +extern inline uint64_t pcg_cm_random_r(pcg_state_setseq_128 *rng); +extern inline void pcg_cm_step_r(pcg_state_setseq_128 *rng); +extern inline uint64_t pcg_output_cm_128_64(pcg128_t state); +extern inline void pcg_cm_srandom_r(pcg_state_setseq_128 *rng, pcg128_t initstate, pcg128_t initseq); /* Multi-step advance functions (jump-ahead, jump-back) * @@ -117,6 +121,9 @@ pcg128_t pcg_advance_lcg_128(pcg128_t state, pcg128_t delta, pcg128_t cur_mult, extern inline uint64_t pcg64_next64(pcg64_state *state); extern inline uint32_t pcg64_next32(pcg64_state *state); +extern inline uint64_t pcg64_cm_next64(pcg64_state *state); +extern inline uint32_t pcg64_cm_next32(pcg64_state *state); + extern void pcg64_advance(pcg64_state *state, uint64_t *step) { pcg128_t delta; #ifndef PCG_EMULATED_128BIT_MATH @@ -128,6 +135,17 @@ extern void pcg64_advance(pcg64_state *state, uint64_t *step) { pcg64_advance_r(state->pcg_state, delta); } +extern void pcg64_cm_advance(pcg64_state *state, uint64_t *step) { + pcg128_t delta; +#ifndef PCG_EMULATED_128BIT_MATH + delta = (((pcg128_t)step[0]) << 64) | step[1]; +#else + delta.high = step[0]; + delta.low = step[1]; +#endif + pcg_cm_advance_r(state->pcg_state, delta); +} + extern void pcg64_set_seed(pcg64_state *state, uint64_t *seed, uint64_t *inc) { pcg128_t s, i; #ifndef PCG_EMULATED_128BIT_MATH diff --git a/numpy/random/src/pcg64/pcg64.h b/numpy/random/src/pcg64/pcg64.h index 31899cbc1..6691a18fc 100644 --- a/numpy/random/src/pcg64/pcg64.h +++ b/numpy/random/src/pcg64/pcg64.h @@ -104,6 +104,9 @@ typedef struct { , PCG_128BIT_CONSTANT(0x0000000000000001ULL, 0xda3e39cb94b95bdbULL) \ } +#define PCG_CHEAP_MULTIPLIER_128 (0xda942042e4dd58b5ULL) + + static inline uint64_t pcg_rotr_64(uint64_t value, unsigned int rot) { #ifdef _WIN32 return _rotr64(value, rot); @@ -198,6 +201,62 @@ pcg_setseq_128_xsl_rr_64_random_r(pcg_state_setseq_128 *rng) { #endif } +static inline pcg128_t pcg128_mult_64(pcg128_t a, uint64_t b) { + uint64_t h1; + pcg128_t result; + + h1 = a.high * b; + _pcg_mult64(a.low, b, &(result.high), &(result.low)); + result.high += h1; + return result; +} + +static inline void pcg_cm_step_r(pcg_state_setseq_128 *rng) { +#if defined _WIN32 && _MSC_VER >= 1900 && _M_AMD64 + uint64_t h1; + pcg128_t product; + + /* Manually inline the multiplication and addition using intrinsics */ + h1 = rng->state.high * PCG_CHEAP_MULTIPLIER_128; + product.low = + _umul128(rng->state.low, PCG_CHEAP_MULTIPLIER_128, &(product.high)); + product.high += h1; + _addcarry_u64(_addcarry_u64(0, product.low, rng->inc.low, &(rng->state.low)), + product.high, rng->inc.high, &(rng->state.high)); +#else + rng->state = pcg128_add(pcg128_mult_64(rng->state, PCG_CHEAP_MULTIPLIER_128), + rng->inc); +#endif +} + +static inline uint64_t pcg_output_cm_128_64(pcg128_t state) { + uint64_t hi = state.high; + uint64_t lo = state.low; + + lo |= 1; + hi ^= hi >> 32; + hi *= 0xda942042e4dd58b5ULL; + hi ^= hi >> 48; + hi *= lo; + return hi; +} + +static inline void pcg_cm_srandom_r(pcg_state_setseq_128 *rng, pcg128_t initstate, pcg128_t initseq) { + rng->state = PCG_128BIT_CONSTANT(0ULL, 0ULL); + rng->inc.high = initseq.high << 1u; + rng->inc.high |= initseq.low >> 63u; + rng->inc.low = (initseq.low << 1u) | 1u; + pcg_cm_step_r(rng); + rng->state = pcg128_add(rng->state, initstate); + pcg_cm_step_r(rng); +} + +static inline uint64_t pcg_cm_random_r(pcg_state_setseq_128* rng) +{ + uint64_t ret = pcg_output_cm_128_64(rng->state); + pcg_cm_step_r(rng); + return ret; +} #else /* PCG_EMULATED_128BIT_MATH */ static inline void pcg_setseq_128_step_r(pcg_state_setseq_128 *rng) { @@ -209,6 +268,37 @@ static inline uint64_t pcg_output_xsl_rr_128_64(pcg128_t state) { state >> 122u); } +static inline void pcg_cm_step_r(pcg_state_setseq_128 *rng) { + rng-> state = rng->state * PCG_CHEAP_MULTIPLIER_128 + rng->inc; +} + +static inline uint64_t pcg_output_cm_128_64(pcg128_t state) { + uint64_t hi = state >> 64; + uint64_t lo = state; + + lo |= 1; + hi ^= hi >> 32; + hi *= 0xda942042e4dd58b5ULL; + hi ^= hi >> 48; + hi *= lo; + return hi; +} + +static inline void pcg_cm_srandom_r(pcg_state_setseq_128 *rng, pcg128_t initstate, pcg128_t initseq) { + rng->state = 0U; + rng->inc = (initseq << 1u) | 1u; + pcg_cm_step_r(rng); + rng->state += initstate; + pcg_cm_step_r(rng); +} + +static inline uint64_t pcg_cm_random_r(pcg_state_setseq_128* rng) +{ + uint64_t ret = pcg_output_cm_128_64(rng->state); + pcg_cm_step_r(rng); + return ret; +} + static inline uint64_t pcg_setseq_128_xsl_rr_64_random_r(pcg_state_setseq_128* rng) { @@ -248,6 +338,12 @@ static inline void pcg_setseq_128_advance_r(pcg_state_setseq_128 *rng, PCG_DEFAULT_MULTIPLIER_128, rng->inc); } +static inline void pcg_cm_advance_r(pcg_state_setseq_128 *rng, pcg128_t delta) { + rng->state = pcg_advance_lcg_128(rng->state, delta, + PCG_128BIT_CONSTANT(0, PCG_CHEAP_MULTIPLIER_128), + rng->inc); +} + typedef pcg_state_setseq_128 pcg64_random_t; #define pcg64_random_r pcg_setseq_128_xsl_rr_64_random_r #define pcg64_boundedrand_r pcg_setseq_128_xsl_rr_64_boundedrand_r @@ -281,7 +377,24 @@ static inline uint32_t pcg64_next32(pcg64_state *state) { return (uint32_t)(next & 0xffffffff); } +static inline uint64_t pcg64_cm_next64(pcg64_state *state) { + return pcg_cm_random_r(state->pcg_state); +} + +static inline uint32_t pcg64_cm_next32(pcg64_state *state) { + uint64_t next; + if (state->has_uint32) { + state->has_uint32 = 0; + return state->uinteger; + } + next = pcg_cm_random_r(state->pcg_state); + state->has_uint32 = 1; + state->uinteger = (uint32_t)(next >> 32); + return (uint32_t)(next & 0xffffffff); +} + void pcg64_advance(pcg64_state *state, uint64_t *step); +void pcg64_cm_advance(pcg64_state *state, uint64_t *step); void pcg64_set_seed(pcg64_state *state, uint64_t *seed, uint64_t *inc); diff --git a/numpy/random/tests/data/pcg64dxsm-testset-1.csv b/numpy/random/tests/data/pcg64dxsm-testset-1.csv new file mode 100644 index 000000000..39cef057f --- /dev/null +++ b/numpy/random/tests/data/pcg64dxsm-testset-1.csv @@ -0,0 +1,1001 @@ +seed, 0xdeadbeaf +0, 0xdf1ddcf1e22521fe +1, 0xc71b2f9c706cf151 +2, 0x6922a8cc24ad96b2 +3, 0x82738c549beccc30 +4, 0x5e8415cdb1f17580 +5, 0x64c54ad0c09cb43 +6, 0x361a17a607dce278 +7, 0x4346f6afb7acad68 +8, 0x6e9f14d4f6398d6b +9, 0xf818d4343f8ed822 +10, 0x6327647daf508ed6 +11, 0xe1d1dbe5496a262a +12, 0xfc081e619076b2e0 +13, 0x37126563a956ab1 +14, 0x8bb46e155db16b9 +15, 0x56449f006c9f3fb4 +16, 0x34a9273550941803 +17, 0x5b4df62660f99462 +18, 0xb8665cad532e3018 +19, 0x72fc3e5f7f84216a +20, 0x71d3c47f6fd59939 +21, 0xfd4218afa1de463b +22, 0xc84054c78e0a9a71 +23, 0xae59034726be61a8 +24, 0xa6a5f21de983654d +25, 0x3b633acf572009da +26, 0x6a0884f347ab54c8 +27, 0x7a907ebe9adcab50 +28, 0xbe779be53d7b8d4a +29, 0xf5976e8c69b9dcd1 +30, 0x1d8302f114699e11 +31, 0x7d37e43042c038a0 +32, 0x2cc1d4edc2a40f35 +33, 0x83e3347bb2d581f1 +34, 0x253f8698651a844d +35, 0x4312dea0dd4e32f6 +36, 0x10f106439964ea3a +37, 0x810eb374844868cc +38, 0x366342a54b1978cc +39, 0x9fb39b13aaddfb5e +40, 0xdb91fd0d9482bed7 +41, 0x89f6ea4ca9c68204 +42, 0x146b31ccca461792 +43, 0x203fd9724deb2486 +44, 0x58a84f23748e25cb +45, 0x2f20eb6aeb94e88 +46, 0x14d3581460e473c +47, 0xad5bd0d25f37d047 +48, 0x1cf88fa16de258b2 +49, 0x3bcab6485b7a341 +50, 0xb2433b37f227d90c +51, 0x2cffd7e0a8360cc8 +52, 0x5d2eeff7c9ebc847 +53, 0x6fd7c7ae23f9f64b +54, 0x381650b2d00f175d +55, 0x9d93edcedc873cae +56, 0x56e369a033d4cb49 +57, 0x7547997116a3bac +58, 0x11debaa897fd4665 +59, 0xdf799d2b73bd6fb8 +60, 0x3747d299c66624d +61, 0xac9346701afd0cfa +62, 0xac90e150fa13c7bf +63, 0x85c56ad2248c2871 +64, 0xdea66bf35c45f195 +65, 0x59cf910ea079fb74 +66, 0x2f841bb782274586 +67, 0x9814df4384d92bd9 +68, 0x15bc70824be09925 +69, 0x16d4d0524c0503a3 +70, 0xf04ea249135c0cc7 +71, 0xa707ab509b7e3032 +72, 0x465459efa869e372 +73, 0x64cbf70a783fab67 +74, 0x36b3541a14ca8ed7 +75, 0x9a4dfae8f4c596bf +76, 0x11d9a04224281be3 +77, 0xe09bbe6d5e98ec32 +78, 0xa6c60d908973aa0d +79, 0x7c524c57dd5915c8 +80, 0xa810c170b27f1fdc +81, 0xce5d409819621583 +82, 0xfe2ee3d5332a3525 +83, 0x162fb7c8b32045eb +84, 0x4a3327156b0b2d83 +85, 0x808d0282f971064 +86, 0x2e6f04cf5ed27e60 +87, 0xaf6800699cca67a9 +88, 0xc7590aae7244c3bf +89, 0x7824345f4713f5f9 +90, 0x8f713505f8fd059b +91, 0x3d5b5b9bb6b1e80e +92, 0x8674f45e5dc40d79 +93, 0xcb1e36846aa14773 +94, 0xe0ae45b2b9b778c1 +95, 0xd7254ce931eefcfb +96, 0xef34e15e4f55ac0a +97, 0xf17cc0ba15a99bc4 +98, 0x77bb0f7ffe7b31f1 +99, 0x6ee86438d2e71d38 +100, 0x584890f86829a455 +101, 0x7baf0d8d30ba70fe +102, 0xb1ac8f326b8403ae +103, 0xcc1963435c874ba7 +104, 0x9c483b953d1334ce +105, 0xc0924bcbf3e10941 +106, 0x21bcc581558717b1 +107, 0x2c5ad1623f8d292b +108, 0xa8ea110f6124557e +109, 0x15f24a6c5c4c591 +110, 0x40fe0d9cd7629126 +111, 0xcfe8f2b3b081484d +112, 0x891383f4b4cac284 +113, 0x76f2fcdef7fa845 +114, 0x4edd12133aed0584 +115, 0xd53c06d12308873d +116, 0xf7f22882c17f86bf +117, 0xfbaa4aad72f35e10 +118, 0x627610da2e3c0cc3 +119, 0x582b16a143634d9a +120, 0x9b4a7f69ed38f4a0 +121, 0x2df694974d1e1cbe +122, 0xe5be6eaafed5d4b +123, 0xc48e2a288ad6605e +124, 0xbcb088149ce27c2b +125, 0x3cb6a7fb06ceecbe +126, 0x516735fff3b9e3ac +127, 0x5cbafc551ee5008d +128, 0xee27d1ab855c5fd5 +129, 0xc99fb341f6baf846 +130, 0x7ad8891b92058e6d +131, 0xf50310d03c1ac6c7 +132, 0x947e281d998cbd3e +133, 0x1d4d94a93824fe80 +134, 0x5568b77289e7ee73 +135, 0x7d82d1b2b41e3c8b +136, 0x1af462c7abc787b +137, 0xcfd8dfe80bfae1ef +138, 0xd314caeb723a63ea +139, 0x1c63ddcfc1145429 +140, 0x3801b7cc6cbf2437 +141, 0xc327d5b9fdafddd3 +142, 0xe140278430ca3c78 +143, 0x4d0345a685cb6ef8 +144, 0x47640dc86e261ff9 +145, 0xab817f158523ebf4 +146, 0x37c51e35fbe65a6b +147, 0xab090f475d30a178 +148, 0x4d3ec225bf599fc1 +149, 0xefd517b0041679b1 +150, 0x20ad50bca4da32c5 +151, 0x75e1f7cd07fad86d +152, 0x348cf781ee655f4b +153, 0x9375f0e5ffc2d2ec +154, 0x7689082fd5f7279c +155, 0x633e56f763561e77 +156, 0x9d1752d70861f9fd +157, 0xa3c994b4e70b0b0f +158, 0xabf7276a58701b88 +159, 0xbfa18d1a0540d000 +160, 0xc6a28a2475646d26 +161, 0x7cdf108583f65085 +162, 0x82dcefb9f32104be +163, 0xc6baadd0adc6b446 +164, 0x7a63cff01075b1b4 +165, 0x67ac62e575c89919 +166, 0x96fa4320a0942035 +167, 0xc4658859385b325f +168, 0xde22c17ff47808f6 +169, 0xbb952c4d89e2f2ec +170, 0x638251fbc55bdc37 +171, 0x38918b307a03b3ea +172, 0xccb60f2cedbb570b +173, 0x3c06f4086a28f012 +174, 0x4e8d238388986e33 +175, 0x1760b7793514a143 +176, 0xa3f924efe49ee7d6 +177, 0xaf6be2dbaebc0bdf +178, 0x6782682090dffe09 +179, 0xb63a4d90d848e8ef +180, 0x5f649c7eaf4c54c5 +181, 0xbe57582426a085ba +182, 0xb5dd825aa52fb76d +183, 0x74cb4e6ca4039617 +184, 0x382e578bf0a49588 +185, 0xc043e8ea6e1dcdae +186, 0xf902addd5c04fa7c +187, 0xf3337994612528db +188, 0x4e8fd48d6d15b4e6 +189, 0x7190a509927c07ab +190, 0x864c2dee5b7108ae +191, 0xbb9972ddc196f467 +192, 0x1ea02ab3ca10a448 +193, 0xe50a8ffde35ddef9 +194, 0x7bd2f59a67183541 +195, 0x5a940b30d8fcd27a +196, 0x82b4cea62623d4d3 +197, 0x6fbda76d4afef445 +198, 0x8b1f6880f418328e +199, 0x8b69a025c72c54b7 +200, 0xb71e0f3986a3835f +201, 0xa4a7ddb8b9816825 +202, 0x945dcda28228b1d8 +203, 0xb471abf2f8044d72 +204, 0xf07d4af64742b1ba +205, 0xfca5190bc4dd6a2a +206, 0xd681497262e11bc5 +207, 0xbe95d5f00c577028 +208, 0x56313439fd8bde19 +209, 0x3f3d9ac9b5ee6522 +210, 0x7b8d457dd2b49bbe +211, 0xe76b5747885d214b +212, 0xa8a695b3deb493ea +213, 0x5292446548c95d71 +214, 0xbf5cdf0d436412df +215, 0x7936abaed779d28d +216, 0x659c6e8073b3a06d +217, 0x86c9ff28f5543b71 +218, 0x6faa748445a99146 +219, 0xdcc1e6ab57904fd7 +220, 0x770bd61233addc5f +221, 0x16963e041e46d94f +222, 0x158e6cb2934157ac +223, 0xb65088a8fd246441 +224, 0x2b12ced6ce8a68c3 +225, 0x59a18d02cd6082b3 +226, 0x4ddbc318cb5488ee +227, 0x3d4cf520b3ed20a1 +228, 0x7028b3a92e2b292d +229, 0xf141da264a250e4d +230, 0x9788d53e86041c37 +231, 0x1bb91238a7c97dbf +232, 0x81953d0ddb634309 +233, 0xfa39ccfe14d2d46 +234, 0xf7c7861c9b7e8399 +235, 0x18d27ca50d9dc249 +236, 0x258dfdf38510d0d9 +237, 0x9e72d8af910ea76f +238, 0x4f8ef24b96de50ad +239, 0xb9d9c12297e03dc9 +240, 0x91994e41b4a1929c +241, 0x8defa79b2ccc83b9 +242, 0x948566748706dac5 +243, 0x7b0454946e70e4cf +244, 0x340b7cb298c70ed7 +245, 0x6602005330cebd95 +246, 0xf71cb803aa61f722 +247, 0x4683fb07fc70ae8a +248, 0xc6db9f0c4de3ed88 +249, 0x3e8dfae2a593cef9 +250, 0x615f7c38e3862b33 +251, 0x676c7996550d857 +252, 0xc6d520d54a5c266a +253, 0x202b1e8eef14aa2e +254, 0xa3a84891a27a582 +255, 0x84dbee451658d47f +256, 0x254c7cd97e777e3a +257, 0xf50b6e977f0eba50 +258, 0x2898b1d3062a4798 +259, 0x4096f7cbbb019773 +260, 0x9fb8e75548062c50 +261, 0x4647071e5ca318ec +262, 0x2b4750bdb3b3b01 +263, 0x88ac41cc69a39786 +264, 0x705e25476ef46fa3 +265, 0xc0c1db19884a48a6 +266, 0x1364c0afdbb465e5 +267, 0x58e98534701272a6 +268, 0x746a5ea9701517c0 +269, 0x523a70bc6b300b67 +270, 0x9b1c098eda8564ad +271, 0xfbaeb28d3637067f +272, 0xddd9a13551fdba65 +273, 0x56461a670559e832 +274, 0xab4fd79be85570ad +275, 0xd4b691ecaff8ca55 +276, 0x11a4495939e7f004 +277, 0x40d069d19477eb47 +278, 0xe790783d285cd81e +279, 0xde8218b16d935bc7 +280, 0x2635e8c65cd4182d +281, 0xeae402623e3454 +282, 0x9f99c833184e0279 +283, 0x3d0f79a0d52d84e7 +284, 0xc1f8edb10c625b90 +285, 0x9b4546363d1f0489 +286, 0x98d86d0b1212a282 +287, 0x386b53863161200d +288, 0xbe1165c7fe48a135 +289, 0xb9658b04dbbfdc8c +290, 0xcea14eddfe84d71a +291, 0x55d03298be74abe7 +292, 0x5be3b50d961ffd7e +293, 0xc76b1045dc4b78e1 +294, 0x7830e3ff3f6c3d4c +295, 0xb617adb36ca3729 +296, 0x4a51bdb194f14aa9 +297, 0x246024e54e6b682a +298, 0x33d42fc9c6d33083 +299, 0xadccba149f31e1d +300, 0x5183e66b9002f8b +301, 0x70eb2416404d51b7 +302, 0x26c25eb225535351 +303, 0xbc2d5b0d23076561 +304, 0x5823019ddead1da +305, 0x85cfa109fca69f62 +306, 0x26017933e7e1efd9 +307, 0x3ec7be9a32212753 +308, 0x697e8a0697cd6f60 +309, 0x44735f6cca03920f +310, 0x8cc655eb94ee212e +311, 0x8b8b74eba84929a0 +312, 0x7708ccedd0c98c80 +313, 0x1b6f21f19777cbe1 +314, 0x363e564bd5fadedb +315, 0x5921543a641591fe +316, 0xc390786d68ea8a1b +317, 0x9b293138dc033fca +318, 0x45447ca8dc843345 +319, 0xee6ef6755bc49c5e +320, 0x70a3a1f5163c3be5 +321, 0xf05e25448b6343b0 +322, 0x4739f4f8717b7e69 +323, 0xb006141975bf957 +324, 0x31874a91b707f452 +325, 0x3a07f2c90bae2869 +326, 0xb73dae5499a55c5e +327, 0x489070893bb51575 +328, 0x7129acf423940575 +329, 0x38c41f4b90130972 +330, 0xc5260ca65f5a84a1 +331, 0x6e76194f39563932 +332, 0x62ca1f9ca3de3ca6 +333, 0xb4a97874e640853f +334, 0x38ed0f71e311cc02 +335, 0xde183b81099e8f47 +336, 0x9bb8bf8e6694346 +337, 0xd15497b6bf81e0f2 +338, 0xaaae52536c00111 +339, 0x4e4e60d1435aaafd +340, 0x5a15512e5d6ea721 +341, 0xff0f1ffabfc6664f +342, 0xba3ffcedc5f97fec +343, 0xef87f391c0c6bfb6 +344, 0x4a888c5d31eb0f98 +345, 0x559a3fbfd7946e95 +346, 0xe45b44a0db5a9bad +347, 0x9457898964190af1 +348, 0xd9357dfaab76cd9e +349, 0xa60e907178d965a1 +350, 0x76b2dc3032dc2f4a +351, 0x13549b9c2802120 +352, 0x8656b965a66a1800 +353, 0x16802e6e22456a23 +354, 0x23b62edc60efaa9 +355, 0x6832a366e1e4ea3b +356, 0x46b1b41093ff2b1e +357, 0x55c857128143f219 +358, 0x7fc35ddf5e138200 +359, 0x790abe78be67467e +360, 0xa4446fc08babd466 +361, 0xc23d70327999b855 +362, 0x2e019d1597148196 +363, 0xfefd98e560403ab8 +364, 0xbe5f0a33da330d58 +365, 0x3078a4e9d43ca395 +366, 0x511bfedd6f12f2b3 +367, 0x8bc138e335be987c +368, 0x24640f803465716d +369, 0xf6530b04d0bd618f +370, 0x9b7833e5aa782716 +371, 0x778cd35aea5841b1 +372, 0xecea3c458cefbc60 +373, 0x5107ae83fc527f46 +374, 0x278ad83d44bd2d1a +375, 0x7014a382295aeb16 +376, 0xf326dd762048743f +377, 0x858633d56279e553 +378, 0x76408154085f01bc +379, 0x3e77d3364d02e746 +380, 0x2f26cea26cadd50b +381, 0x6d6846a4ecb84273 +382, 0x4847e96f2df5f76 +383, 0x5a8610f46e13ff61 +384, 0x4e7a7cac403e10dd +385, 0x754bdf2e20c7bc90 +386, 0x8bdd80e6c51bd0be +387, 0x61c655fae2b4bc52 +388, 0x60873ef48e3d2f03 +389, 0x9d7d8d3698a0b4a4 +390, 0xdf48e9c355cd5d4b +391, 0x69ecf03e20be99ac +392, 0xc1a0c5a339bd1815 +393, 0x2e3263a6a3adccb +394, 0x23557459719adbdc +395, 0xd1b709a3b330e5a +396, 0xade5ab00a5d88b9d +397, 0x69a6bd644120cfad +398, 0x40187ecceee92342 +399, 0x1c41964ba1ac78da +400, 0x9ac5c51cbecabe67 +401, 0xbdc075781cf36d55 +402, 0xeaf5a32246ded56 +403, 0xcda0b67e39c0fb71 +404, 0x4839ee456ef7cc95 +405, 0xf17092fdd41d5658 +406, 0x2b5d422e60ae3253 +407, 0x3effe71102008551 +408, 0x20a47108e83934b7 +409, 0xd02da65fe768a88f +410, 0xeb046bd56afa4026 +411, 0x70c0509c08e0fbe0 +412, 0x1d35c38d4f8bac6c +413, 0x9aa8eb6466f392e0 +414, 0x587bd4a430740f30 +415, 0x82978fe4bad4195 +416, 0xdc4ebc4c0feb50ab +417, 0xd3b7164d0240c06f +418, 0x6e2ad6e5a5003a63 +419, 0xa24b430e2ee6b59c +420, 0x2905f49fd5073094 +421, 0x5f209e4de03aa941 +422, 0x57b7da3e0bedb1dc +423, 0x5e054018875b01f5 +424, 0xb2f2da6145658db3 +425, 0xbd9c94a69a8eb651 +426, 0x9c5f9a07cd6ac749 +427, 0x2296c4af4d529c38 +428, 0x522ed800fafdefab +429, 0xe2a447ced0c66791 +430, 0x937f10d45e455fef +431, 0xc882987d9e29a24 +432, 0x4610bfd6a247ee1a +433, 0x562ba3e50870059 +434, 0x59d8d58793602189 +435, 0xfe9a606e3e34abe +436, 0x6825f7932a5e9282 +437, 0xe77f7061bab476ad +438, 0xbf42001da340ace3 +439, 0x9c3e9230f5e47960 +440, 0x2c0f700d96d5ad58 +441, 0x330048b7cd18f1f9 +442, 0xffc08785eca5cca9 +443, 0xb5879046915f07a5 +444, 0xef51fe26f83c988e +445, 0xfa4c2968e7881a9a +446, 0xc0a9744455a4aad +447, 0xbd2ad686d6313928 +448, 0x6b9f0984c127682a +449, 0xc9aaa00a5da59ed8 +450, 0x762a0c4b98980dbf +451, 0x52d1a2393d3ca2d1 +452, 0x1e9308f2861db15c +453, 0xe7b3c74fe4b4a844 +454, 0x485e15704a7fc594 +455, 0x9e7f67ea44c221f6 +456, 0xbab9ad47fde916e0 +457, 0x50e383912b7fc1f4 +458, 0xaad63db8abcef62d +459, 0xc2f0c5699f47f013 +460, 0xee15b36ada826812 +461, 0x2a1b1cf1e1777142 +462, 0x8adb03ede79e937d +463, 0xf14105ef65643bf3 +464, 0x752bbaefc374a3c7 +465, 0xa4980a08a5a21d23 +466, 0x418a1c05194b2db7 +467, 0xdd6ff32efe1c3cd6 +468, 0x272473ed1f0d3aa2 +469, 0x1e7fdebadabe6c06 +470, 0xd1baa90c17b3842f +471, 0xd3d3a778e9c8404a +472, 0x781ae7fda49fa1a0 +473, 0x61c44fdbdacc672d +474, 0x6d447d0a1404f257 +475, 0x9303e8bdfbfb894d +476, 0x3b3482cdec016244 +477, 0xb149bf245d062e7b +478, 0x96f8d54b14cf992d +479, 0x4741549a01f8c3d0 +480, 0x48270811b2992af +481, 0x7b58f175cd25d147 +482, 0x8f19a840b56f4be9 +483, 0x84a77f43c0951a93 +484, 0x34e1a69381f0c374 +485, 0xb158383c9b4040f +486, 0x372f1abc7cf3a9fa +487, 0x5439819a84571763 +488, 0xabf8515e9084e2fa +489, 0xb02312b9387ff99 +490, 0x238a85bb47a68b12 +491, 0x2068cb83857c49bb +492, 0xc6170e743083664c +493, 0x745cf8470bcb8467 +494, 0xe3a759a301670300 +495, 0x292c7686ad3e67da +496, 0x359efedaff192a45 +497, 0x511f2c31a2d8c475 +498, 0x97fd041bf21c20b3 +499, 0x25ef1fe841b7b3f6 +500, 0xbb71739e656f262d +501, 0x2729b0e989b6b7b8 +502, 0xd2142702ec7dbabf +503, 0x7008decd2488ee3f +504, 0x69daa95e303298d7 +505, 0xc35eca4efb8baa5a +506, 0xf3f16d261cec3b6c +507, 0x22371c1d75396bd3 +508, 0x7aefa08eccae857e +509, 0x255b493c5e3c2a2f +510, 0x779474a077d34241 +511, 0x5199c42686bea241 +512, 0x16c83931e293b8d3 +513, 0xa57fe8db8c0302c7 +514, 0xd7ace619e5312eb1 +515, 0x8740f013306d217c +516, 0xb6a1ad5e29f4d453 +517, 0x31abf7c964688597 +518, 0xbc3d791daed71e7 +519, 0x31ee4ca67b7056ed +520, 0x1ab5416bfe290ea3 +521, 0x93db416f6d3b843a +522, 0xed83bbe5b1dd2fed +523, 0xece38271470d9b6d +524, 0x3a620f42663cd8ae +525, 0x50c87e02acafee5d +526, 0xcabeb8bedbc6dab5 +527, 0x2880a6d09970c729 +528, 0x4aba5dd3bfc81bc +529, 0xaba54edf41080cec +530, 0xb86bb916fc85a169 +531, 0x4c41de87bc79d8ca +532, 0xcce2a202622945fe +533, 0x513f086fad94c107 +534, 0x18b3960c11f8cc96 +535, 0x2f0d1cfd1896e236 +536, 0x1702ae3880d79b15 +537, 0x88923749029ae81 +538, 0x84810d4bdec668eb +539, 0xf85b0a123f4fc68d +540, 0x93efd68974b6e4d1 +541, 0x5d16d6d993a071c9 +542, 0x94436858f94ca43b +543, 0xb3dbb9ed0cb180b6 +544, 0x6447030a010b8c99 +545, 0xd7224897c62925d8 +546, 0xb0c13c1d50605d3a +547, 0xdff02c7cb9d45f30 +548, 0xe8103179f983570d +549, 0xbc552037d6d0a24e +550, 0x775e500b01486b0d +551, 0x2050ac632c694dd6 +552, 0x218910387c4d7ae7 +553, 0xf83e8b68ff885d5d +554, 0xe3374ec25fca51a3 +555, 0xfa750ffa3a60f3af +556, 0x29ee40ba6df5592e +557, 0x70e21a68f48260d2 +558, 0x3805ca72cd40886e +559, 0x2f23e73f8eabf062 +560, 0x2296f80cdf6531ae +561, 0x903099ed968db43a +562, 0xf044445cf9f2929f +563, 0xcd47fdc2de1b7a1 +564, 0xaab1cbd4f849da99 +565, 0x5fc990688da01acb +566, 0xa9cee52ea7dab392 +567, 0xecefc3a4349283a8 +568, 0xdd6b572972e3fafc +569, 0xc1f0b1a2ffb155da +570, 0xc30d53fc17bd25c8 +571, 0x8afa89c77834db28 +572, 0x5569a596fb32896c +573, 0x36f207fc8df3e3d4 +574, 0x57c2bd58517d81db +575, 0xb524693e73d0061c +576, 0xb69f6eb233f5c48b +577, 0x4f0fb23cab8dc695 +578, 0x492c1ad0a48df8df +579, 0xf6dcc348ec8dec1f +580, 0xa4d8708d6eb2e262 +581, 0x4c2072c2c9766ff1 +582, 0xa9bf27c4304875f0 +583, 0xfc8fb8066d4f9ae2 +584, 0x188095f6235fec3c +585, 0x1d8227a2938c2864 +586, 0x89ea50c599010378 +587, 0xcac86df0a7c6d56d +588, 0x47a8c5df84c7d78 +589, 0xe607ae24ea228bfa +590, 0x36624a7996efe104 +591, 0x5d72881c1227d810 +592, 0x78694a6750374c8 +593, 0x7b9a217d4ab5ff45 +594, 0xd53e5d6f7504becc +595, 0x197a72d3f4889a0e +596, 0xfdc70c4755a8df36 +597, 0xd0fda83748c77f74 +598, 0x7ddc919ac9d6dcc9 +599, 0x785c810a6a2dc08b +600, 0xba4be83e7e36896c +601, 0x379d6fe80cf2bffe +602, 0x74cae2dabc429206 +603, 0x1efac32d5d34c917 +604, 0x3cb64e2f98d36e70 +605, 0xc0a7c3cdc3c60aa7 +606, 0x699dfadd38790ebe +607, 0x4861e61b3ecfbeac +608, 0x531744826c345baa +609, 0x5ec26427ad450cba +610, 0xf2c1741479abdcae +611, 0xe9328a78b2595458 +612, 0x30cd1bdf087acd7f +613, 0x7491ced4e009adbe +614, 0xdcd942df1e2e7023 +615, 0xfe63f01689fee35 +616, 0x80282dfe5eaedc42 +617, 0x6ecdea86495f8427 +618, 0xe0adfdd5e9ed31c3 +619, 0xf32bd2a7418127e +620, 0x8aabba078db6ee2 +621, 0xa8a8e60499145aca +622, 0xf76b086ac4e8a0f2 +623, 0x6e55b3c452ff27f8 +624, 0xe18fa7cd025a71bf +625, 0xeed7b685fde0fa25 +626, 0xba9b6c95867fa721 +627, 0x4c2603bc69de2df2 +628, 0xaac87eee1b58cd66 +629, 0x3c9af6656e01282c +630, 0x2dfa05ce8ff476b6 +631, 0xeae9143fcf92f23d +632, 0x3f0699f631be3bc8 +633, 0xa0f5f79f2492bd67 +634, 0x59c47722388131ed +635, 0x5f6e9d2941cef1de +636, 0xe9ad915c09788b7b +637, 0x92c6d37e4f9482f5 +638, 0x57d301b7fdadd911 +639, 0x7e952d23d2a8443 +640, 0xbb2fa5e0704b3871 +641, 0xe5642199be36e2d5 +642, 0x5020b60d54358291 +643, 0xa0b6317ec3f60343 +644, 0xb57b08b99540bc5c +645, 0x21f1890adc997a88 +646, 0xfcf824200dd9da2d +647, 0x8146293d83d425d1 +648, 0xdadfbf5fbb99d420 +649, 0x1eb9bbc5e6482b7d +650, 0xd40ff44f1bbd0f1c +651, 0xa9f948ba2d08afa5 +652, 0x638cc07c5301e601 +653, 0x1f984baa606e14e8 +654, 0x44e153671081f398 +655, 0xb17882eeb1d77a5d +656, 0x5fd8dbee995f14c +657, 0xff3533e87f81b7fe +658, 0x2f44124293c49795 +659, 0x3bf6b51e9360248 +660, 0x72d615edf1436371 +661, 0x8fc5cf4a38adab9d +662, 0xfa517e9022078374 +663, 0xf356733f3e26f4d8 +664, 0x20ea099cdc6aad40 +665, 0xe15b977deb37637d +666, 0xcc85601b89dae88d +667, 0x5768c62f8dd4905c +668, 0xa43cc632b4e56ea +669, 0xc4240cf980e82458 +670, 0xb194e8ffb4b3eeb6 +671, 0xee753cf2219c5fa1 +672, 0xfe2500192181d44d +673, 0x2d03d7d6493dd821 +674, 0xff0e787bb98e7f9b +675, 0xa05cf8d3bd810ce7 +676, 0x718d5d6dcbbdcd65 +677, 0x8d0b5343a06931c +678, 0xae3a00a932e7eaf9 +679, 0x7ed3d8f18f983e18 +680, 0x3bb778ee466dc143 +681, 0x711c685c4e9062c0 +682, 0x104c3af5d7ac9834 +683, 0x17bdbb671fb5d5cf +684, 0xabf26caead4d2292 +685, 0xa45f02866467c005 +686, 0xf3769a32dc945d2d +687, 0xe78d0007f6aabb66 +688, 0x34b60be4acbd8d4b +689, 0x58c0b04b69359084 +690, 0x3a8bb354c212b1 +691, 0x6b82a8f3d70058d5 +692, 0x405bdef80a276a4a +693, 0xe20ca40ee9195cad +694, 0xf5dd96ba2446fefd +695, 0xc1e180c55fe55e3c +696, 0xa329caf6daa952b3 +697, 0xb4809dd0c84a6b0a +698, 0xd27f82661070cee7 +699, 0xa7121f15ee2b0d8a +700, 0x4bdaea70d6b34583 +701, 0xe821dc2f310f7a49 +702, 0x4c00a5a68e76f647 +703, 0x331065b064a2d5ea +704, 0xac0c2ce3dc04fa37 +705, 0x56b32b37b8229008 +706, 0xe757cdb51534fcfa +707, 0xd3ff183576b2fad7 +708, 0x179e1f4190f197a7 +709, 0xf874c626a7c9aae5 +710, 0xd58514ffc37c80e4 +711, 0xc65de31d33fa7fd3 +712, 0x6f6637052025769b +713, 0xca1c6bdadb519cc0 +714, 0xd1f3534cde37828a +715, 0xc858c339eee4830a +716, 0x2371eacc215e02f4 +717, 0x84e5022db85bbbe9 +718, 0x5f71c50bba48610e +719, 0xe420192dad9c323f +720, 0x2889342721fca003 +721, 0x83e64f63334f501d +722, 0xac2617172953f2c +723, 0xfa1f78d8433938ff +724, 0x5578382760051462 +725, 0x375d7a2e3b90af16 +726, 0xb93ff44e6c07552d +727, 0xded1d5ad811e818c +728, 0x7cf256b3b29e3a8c +729, 0x78d581b8e7bf95e8 +730, 0x5b69192f2caa6ad3 +731, 0xa9e25855a52de3ce +732, 0x69d8e8fc45cc188d +733, 0x5dd012c139ad347d +734, 0xfcb01c07b77db606 +735, 0x56253e36ab3d1cce +736, 0x1181edbb3ea2192 +737, 0x325bef47ff19a08d +738, 0xd3e231ceb27e5f7 +739, 0x8e819dd2de7956d2 +740, 0x34a9689fe6f84a51 +741, 0x3e4eeb719a9c2927 +742, 0x5c3b3440581d0aaf +743, 0x57caf51897d7c920 +744, 0xec6a458130464b40 +745, 0xe98f044e0da40e9b +746, 0xbe38662020eeb8e7 +747, 0x7b8c407c632724ae +748, 0x16c7cfa97b33a544 +749, 0xd23359e2e978ae5a +750, 0x4fdba458250933dd +751, 0x3c9e0713cfe616ba +752, 0x6f0df87b13163b42 +753, 0xc460902cb852cc97 +754, 0x289df8fefd6b0bce +755, 0x4ac2a2a1c3fb8029 +756, 0x2fc3e24d8b68eef7 +757, 0x34564386a59aab9a +758, 0x31047391ebd67ce4 +759, 0x6c23d070a0564d41 +760, 0xba6387b2b72545f7 +761, 0xcdcf1008058387af +762, 0xc9308fa98db05192 +763, 0xdbdbb5abd01a9d84 +764, 0x937088275c7804ab +765, 0x6f6accfefe34ee81 +766, 0x5c33c74c49cfdb2c +767, 0x5e1a771edfb92bd3 +768, 0x6e89b009069ecae7 +769, 0x34d64e17ec0e8968 +770, 0x841203d0cde0c330 +771, 0x7642cc9d7eb9e9cb +772, 0xca01d2e8c128b97e +773, 0x5b8390617b3304ab +774, 0x52ec4ed10de1eb2d +775, 0xb90f288b9616f237 +776, 0x5bd43cd49617b2e2 +777, 0x1a53e21d25230596 +778, 0x36ccd15207a21cd6 +779, 0xc8263d780618fd3c +780, 0x6eb520598c6ce1cb +781, 0x493c99a3b341564f +782, 0xab999e9c5aa8764f +783, 0xab2fa4ceaba84b +784, 0xbbd2f17e5cb2331b +785, 0xc8b4d377c0cc4e81 +786, 0x31f71a6e165c4b1e +787, 0xd1011e55fb3addaa +788, 0x5f7ec34728dfa59 +789, 0x2aef59e60a84eb0f +790, 0x5dde6f09aec9ad5f +791, 0x968c6cdbc0ef0438 +792, 0x1957133afa15b13a +793, 0xbaf28f27573a64c2 +794, 0xc6f6ddd543ebf862 +795, 0xdd7534315ec9ae1e +796, 0xd2b80cd2758dd3b +797, 0xa38c3da00cc81538 +798, 0x15c95b82d3f9b0f9 +799, 0x6704930287ce2571 +800, 0x9c40cc2f6f4ecb0c +801, 0xc8de91f50b22e94e +802, 0x39272e8fddbfdf0a +803, 0x879e0aa810a117d +804, 0xa312fff4e9e5f3bd +805, 0x10dd747f2835dfec +806, 0xeb8466db7171cdae +807, 0xaa808d87b9ad040a +808, 0xab4d2229a329243a +809, 0x7c622f70d46f789c +810, 0x5d41cef5965b2a8e +811, 0xce97ec4702410d99 +812, 0x5beba2812c91211b +813, 0xf134b46c93a3fec7 +814, 0x76401d5630127226 +815, 0xc55fc9d9eacd4ec1 +816, 0xaec8cefaa12f813f +817, 0x2f845dcfd7b00722 +818, 0x3380ab4c20885921 +819, 0xdb68ad2597691b74 +820, 0x8a7e4951455f563f +821, 0x2372d007ed761c53 +822, 0xcab691907714c4f1 +823, 0x16bc31d6f3abec1a +824, 0x7dff639fbcf1824 +825, 0x6666985fbcff543d +826, 0xb618948e3d8e6d0c +827, 0x77b87837c794e068 +828, 0xcd48288d54fcb5a8 +829, 0x47a773ed6ae30dc3 +830, 0xba85ae44e203c942 +831, 0xa7a7b21791a25b2d +832, 0x4029dd92e63f19e0 +833, 0xc2ad66ab85e7d5aa +834, 0xa0f237c96fdab0db +835, 0xffefb0ab1ca18ed +836, 0x90cb4500785fd7d5 +837, 0xa7dd3120f4876435 +838, 0x53f7872624694300 +839, 0xea111326ff0040d9 +840, 0x5f83cb4cce40c83b +841, 0x918e04936c3b504d +842, 0x87a8db4c0e15e87c +843, 0x7cff39da6a0dedd0 +844, 0x36f7de2037f85381 +845, 0xd1d8d94022a1e9a7 +846, 0x2c9930127dc33ec9 +847, 0x6cb4719dcd0101c6 +848, 0xc01868cde76935f7 +849, 0x6b86f2ec1ab50143 +850, 0x68af607d8d94ae61 +851, 0xe216c5b95feedf34 +852, 0x4b866bd91efe2e4b +853, 0x4bff79df08f92c99 +854, 0x6ff664ea806acfd1 +855, 0x7fce0b3f9ece39bc +856, 0x29bc90b59cb3db97 +857, 0x833c4b419198607d +858, 0xf3573e36ca4d4768 +859, 0x50d71c0a3c2a3fa8 +860, 0xd754591aea2017e7 +861, 0x3f9126f1ee1ebf3 +862, 0xe775d7f4b1e43de8 +863, 0xe93d51628c263060 +864, 0x83e77f6fb32d6d82 +865, 0x43dd7eef823408e4 +866, 0x1c843c2c90180662 +867, 0xe924dafb9a16066b +868, 0x6af3ee96e7b7fbd9 +869, 0x94d5c4f37befcd1f +870, 0x40ffb04bedef4236 +871, 0x71c17bbc20e553e +872, 0x101f7a0a6208729f +873, 0x5ca34570cf923548 +874, 0x8e3139db2e96e814 +875, 0x3ab96d96263d048d +876, 0x97f3c0bbc6755c3c +877, 0x31fc72daedaef3dc +878, 0x71f8d7855d10789b +879, 0xce6dc97b4662333b +880, 0xfddc2aabd342bc61 +881, 0xefbd4007ff8c7d2e +882, 0xf72cd6c689ef8758 +883, 0x932c8b0c0e755137 +884, 0x94cc4dedd58ff69 +885, 0xde4dfd6890535979 +886, 0xdb00dcd2dcb4a50a +887, 0xb0466240b4548107 +888, 0x9cb9264c7b90d1a3 +889, 0x357e378e9be5766b +890, 0x6e0316ef03367bbf +891, 0x201ea18839544ca +892, 0x803ff3406be5f338 +893, 0xf9d5e82fd4144bb2 +894, 0x1b6b88ca701e9f47 +895, 0xd1fe5ab8e1f89cc0 +896, 0x14171fe176c4bece +897, 0x887948bdef78beaa +898, 0x80449ddc3eb9b977 +899, 0x5f4e1f900fb4bcf3 +900, 0xbe30f8701909f8e2 +901, 0xd1f2a2fb5503306d +902, 0x6b1c77238dc23803 +903, 0x102156a6c9860f66 +904, 0x4cd446e099edf4c1 +905, 0xc79ac6cbc911f33b +906, 0x3ee096ffe3384f1c +907, 0xb58f83b18a306dc7 +908, 0x9f76582141de56b2 +909, 0x9ddfa85e02c13866 +910, 0x4d9a19d4ce90a543 +911, 0xbf81ab39fd17d376 +912, 0x5327e5054c6a74f1 +913, 0xd5062dd31db1a9b7 +914, 0x645853735527edc +915, 0x485393967f91af08 +916, 0xeff9667dcf77ca68 +917, 0xd012313f5fbec464 +918, 0xbeae35bdfae55144 +919, 0x302c41ebac8444a0 +920, 0x9ccdb6c2fe58fba8 +921, 0x567753af68ed23f8 +922, 0xff90f790e43efec3 +923, 0x970cc756fb799696 +924, 0xe59239d1c44915 +925, 0x4d2d189fb3941f05 +926, 0x96f23085db165a9c +927, 0xa1202dec7a37b1a5 +928, 0xc0c1ee74bcd7dc1a +929, 0x9edcf2048b30333a +930, 0xd848588ba7e865fb +931, 0x8d9f0897317cab40 +932, 0x67b96f15e25924fb +933, 0xefc8d8536619ee42 +934, 0xf3f621d22bdde0c2 +935, 0x68610a0de862ae32 +936, 0xa22ca5142de24cbd +937, 0x8815452f4e6b4801 +938, 0x4e9c1b607b2750e5 +939, 0x19b3c09ba6fc9b25 +940, 0x9b2543c8836780ac +941, 0xe702b8f950e56431 +942, 0xb357cc329cac3917 +943, 0x387bf86a17a31e08 +944, 0x9940b983d331b163 +945, 0xf5d89d7fe9095e18 +946, 0x4362682329e5c4d1 +947, 0xd2132573f6ae7b42 +948, 0xc0a5849e23a61606 +949, 0xdadbddf47265bc02 +950, 0x1b96f00339a705f7 +951, 0x94e6642329288913 +952, 0x825ab3f10e6d330b +953, 0x1a1c31ac9d883ea0 +954, 0xb49076b7155c6f47 +955, 0x920cf3085dfe3ccb +956, 0x9743407c9f28e825 +957, 0x6ce8a28622402719 +958, 0xce2fe67e06baf8a6 +959, 0x3a16b34784ecf5e6 +960, 0x140467cc1d162a0c +961, 0x32d4772692ab625 +962, 0xa4f4b28562f43336 +963, 0x885b4335457bd84a +964, 0x499d3ed26c87ad8a +965, 0xc7328bcedb9a545e +966, 0xc6dd76a6cbf5d2b2 +967, 0xba9c22be404ee1aa +968, 0x70e6aee45f23521d +969, 0x61e03a798593c177 +970, 0x171671f809c68213 +971, 0x28d54872fc1d914c +972, 0x43c2fcd9bd098b53 +973, 0x172ad4c4a98b9d37 +974, 0x330860c9460f2516 +975, 0x49547f472df984f4 +976, 0x873b2436d3f0e114 +977, 0x6f99accf4ea050b6 +978, 0x5968ac874ed51613 +979, 0x4939d70d29a3c611 +980, 0x11f381ed28738d3d +981, 0xa97430d36ab3a869 +982, 0xe6fa880801129e22 +983, 0xf84decbd8f48c913 +984, 0x4425c0ed1e9a82a5 +985, 0x7a1f9485e9929d5a +986, 0xc7c51f155dfce1c6 +987, 0x9619a39501d74f2b +988, 0x7c7035955dbf4c1b +989, 0xc61ee569cf57c2c9 +990, 0x3eaf7c5b0df734e1 +991, 0xe71cb4064d1ede05 +992, 0x356e3cec80e418b2 +993, 0xca04306243a15be6 +994, 0x941cf3881fa18896 +995, 0x30dbb0e819d644e0 +996, 0xaae22c0bef02859a +997, 0x7bd30917bbaa8a94 +998, 0x2672547bc8d7d329 +999, 0x4955c92aaa231578 diff --git a/numpy/random/tests/data/pcg64dxsm-testset-2.csv b/numpy/random/tests/data/pcg64dxsm-testset-2.csv new file mode 100644 index 000000000..878c5ea7c --- /dev/null +++ b/numpy/random/tests/data/pcg64dxsm-testset-2.csv @@ -0,0 +1,1001 @@ +seed, 0x0 +0, 0xd97e4a147f788a70 +1, 0x8dfa7bce56e3a253 +2, 0x13556ed9f53d3c10 +3, 0x55dbf1c241341e98 +4, 0xa2cd98f722eb0e0a +5, 0x83dfc407203ade8 +6, 0xeaa083df518f030d +7, 0x44968c87e432852b +8, 0x573107b9cb8d9ecc +9, 0x9eedd1da50b9daca +10, 0xb33a6735ca451e3c +11, 0x72830d2b39677262 +12, 0x9da8c512fd0207e8 +13, 0x1fc5c91954a2672b +14, 0xd33479437116e08 +15, 0x9ccdd9390cee46f3 +16, 0x1fd39bb01acd9e76 +17, 0xedc1869a42ff7fe5 +18, 0xbd68ca0b42a6e7e9 +19, 0x620b67df09621b1f +20, 0xfa11d51bd6950221 +21, 0xc8c45b36e7d28d08 +22, 0xe9c91272fbaad777 +23, 0x2dc87a143f220e90 +24, 0x6376a7c82361f49d +25, 0x552c5e434232fe75 +26, 0x468f7f872ac195bc +27, 0x32bed6858125cf89 +28, 0xe4f06111494d09d3 +29, 0xa5c166ffea248b80 +30, 0x4e26605b97064a3f +31, 0xceafd9f6fc5569d +32, 0xb772f2f9eed9e106 +33, 0x672c65e6a93534e2 +34, 0xcdc5e1a28d1bd6a0 +35, 0x1ed9c96daeebd3e3 +36, 0x4d189dcfc0c93c3f +37, 0x50df5a95c62f4b43 +38, 0xcccf4949fa65bbb8 +39, 0x19b8073d53cdc984 +40, 0x6fb40bba35483703 +41, 0xb02de4aef86b515a +42, 0x4d90c63655350310 +43, 0xea44e4089825b16c +44, 0x8d676958b1f9da2b +45, 0x6d313940917ae195 +46, 0x1b1d35a4c1dd19f4 +47, 0x117720f8397337ef +48, 0xcc073cf3ac11eeaa +49, 0x8331ec58a9ff8acb +50, 0xf3dc2a308b6b866f +51, 0x7eba1202663382b6 +52, 0x8269839debeb4e5a +53, 0x87fd3dc0f9181a8e +54, 0xabe62ddd3c925f03 +55, 0x7f56f146944fe8d4 +56, 0xc535972150852068 +57, 0x60b252d453bd3a68 +58, 0x4251f0134634490a +59, 0x338950da210dfeb2 +60, 0xcadfe932971c9471 +61, 0xfb7049457fab470e +62, 0x9bfb8145a4459dff +63, 0x4a89dda3898f9d8a +64, 0x88cc560151483929 +65, 0x277dc820f4b6796e +66, 0x3524bd07ea0afb88 +67, 0x92eb6ffb2bf14311 +68, 0xf6559be0783f3fe9 +69, 0xf0844f9af54af00d +70, 0xdd5e0b59adcef8a +71, 0x4ff7e4f2ab18554c +72, 0x3fa22c8a02634587 +73, 0x1db8e1a9442fe300 +74, 0x40cf15953ad3d3e7 +75, 0x92af15fe1a9f6f0a +76, 0xab4a0e466fb0cfd +77, 0x944f1555a06cca82 +78, 0x10cf48412f1f6066 +79, 0x7f51f9a455f9e8e1 +80, 0x47ee93530f024c7e +81, 0x36cf2f0413e0f6f2 +82, 0xa315e23731969407 +83, 0xd8e2796327cf5f87 +84, 0xa86072696a555c34 +85, 0xee3f0b8804feaab7 +86, 0x41e80dc858f8360b +87, 0x31ec2e9b78f5b29 +88, 0xd397fb9b8561344c +89, 0x28081e724e649b74 +90, 0x5c135fc3fc672348 +91, 0x9a276ca70ce9caa0 +92, 0x9216da059229050a +93, 0xcf7d375ed68007b0 +94, 0xa68ad1963724a770 +95, 0xd4350de8d3b6787c +96, 0xee7d2c2cc275b6d2 +97, 0x71645ec738749735 +98, 0x45abdf8c68d33dbb +99, 0xe71cadb692c705ea +100, 0x60af6f061fd90622 +101, 0x1eabe2072632c99d +102, 0x947dda995a402cb6 +103, 0xbb19f49a3454f3b +104, 0xe6e43e907407758c +105, 0xfe2b67016bd6873a +106, 0x7fdb4dd8ab30a722 +107, 0x39d3265b0ff1a45b +108, 0xed24c0e4fce8d0c2 +109, 0xf6e074f86faf669d +110, 0x9142040df8dc2a79 +111, 0x9682ab16bc939a9c +112, 0x6a4e80c378d971c8 +113, 0x31309c2c7fc2d3d6 +114, 0xb7237ec682993339 +115, 0x6a30c06bb83dccd9 +116, 0x21c8e9b6d8e7c382 +117, 0x258a24ae6f086a19 +118, 0xb76edb5be7df5c35 +119, 0x3c11d7d5c16e7175 +120, 0xbdfc34c31eff66e1 +121, 0x8af66e44be8bf3a2 +122, 0x3053292e193dec28 +123, 0xd0cc44545b454995 +124, 0x408ac01a9289d56 +125, 0x4e02d34318ec2e85 +126, 0x9413ff3777c6eb6b +127, 0xa3a301f8e37eb3df +128, 0x14e6306bd8d8f9f9 +129, 0xd3ea06ce16c4a653 +130, 0x170abe5429122982 +131, 0x7f9e6fddc6cacb85 +132, 0xa41b93e10a10a4c8 +133, 0x239216f9d5b6d0b5 +134, 0x985fcb6cb4190d98 +135, 0xb45e3e7c68f480c6 +136, 0xc1b2fc2e0446211c +137, 0x4596adb28858c498 +138, 0x2dd706f3458ddc75 +139, 0x29c988c86f75464 +140, 0xac33a65aa679a60 +141, 0xa28fef762d39d938 +142, 0x541e6fa48647f53 +143, 0x27838d56b2649735 +144, 0x8e143d318a796212 +145, 0xaea6097745f586b8 +146, 0x636143330f8ee2e6 +147, 0xc2d05fd8b945b172 +148, 0x6e355f9eb4353055 +149, 0xeb64ca42e8bf282e +150, 0xe8202dfd9da0fe5 +151, 0x7305689c9d790cba +152, 0xf122f8b1bef32970 +153, 0x9562887e38c32ba5 +154, 0xf9cd9be121b738d +155, 0x6238e0c398307913 +156, 0x5f2e79bb07c30f47 +157, 0x8ce8e45c465006e +158, 0x39281fe1e99e2441 +159, 0xafb10c2ca2874fea +160, 0x6e52f91633f83cf +161, 0x8ff12c1ac73c4494 +162, 0xe48608a09365af59 +163, 0xefd9bbc7e76e6a33 +164, 0xbe16a39d5c38ec92 +165, 0x6a6ffbcaf5a2330f +166, 0xdd5d6ac7d998d43d +167, 0x207bf978226d4f11 +168, 0xf8eec56bd2a0f62e +169, 0xa5bccf05dce0d975 +170, 0x93cf3ec1afe457a6 +171, 0x38651466d201f736 +172, 0x3ad21473985c9184 +173, 0xc6407a3bd38c92a6 +174, 0xb1ec42c7afa90a25 +175, 0xbdeca984df8b7dd3 +176, 0xb6926b1d00aa6c55 +177, 0x86141d0022352d49 +178, 0x169316256135ee09 +179, 0xffb1c7767af02a5c +180, 0x502af38ad19f5c91 +181, 0xfbf6cbc080086658 +182, 0x33cf9b219edae501 +183, 0x46e69bebd77b8862 +184, 0xf11e0cc91125d041 +185, 0xb4cd1649f85e078f +186, 0xb49be408db4e952 +187, 0xb0b8db46140cce3c +188, 0xba647f2174012be7 +189, 0x4f0a09e406970ac9 +190, 0xf868c7aec9890a5c +191, 0xde4c8fa7498ea090 +192, 0x872ceb197978c1d4 +193, 0x1eb5cd9c3269b258 +194, 0x3ea189f91724f014 +195, 0x41379656f7746f2c +196, 0x7bd18493aca60e51 +197, 0x5380c23b0cbbf15e +198, 0x920b72835f88246b +199, 0x24d7f734a4548b8e +200, 0x9944edb57e5aa145 +201, 0x4628e136ebb8afe1 +202, 0xb4ee6a776356e2a7 +203, 0x481cbe9744ccf7d7 +204, 0x7e8d67e8b0b995d9 +205, 0xeeacde100af7b47e +206, 0x103da08f2487dab7 +207, 0x6b9890a91d831459 +208, 0xd0c5beae37b572c7 +209, 0xfdccc371ee73fcc +210, 0x65438f0a367a2003 +211, 0x5d23b2c818a7e943 +212, 0x9a8ed45ac04b58b3 +213, 0xdaf3c3f1695dce10 +214, 0x5960eec706fa2bc0 +215, 0x98ca652facb80d40 +216, 0x72970ae5e2194143 +217, 0x18c6374d878c5c94 +218, 0x20fa51f997381900 +219, 0x3af253dba26d6e1d +220, 0x1b23d65db15c7f78 +221, 0x9f53ae976259b0e3 +222, 0x9a6addb28dc92d49 +223, 0x1e085c4accd0a7d7 +224, 0xe9d3f4cc9bad6ce5 +225, 0xe018fad78b5b1059 +226, 0x5ef7682232b4b95 +227, 0xb2242aa649f5de80 +228, 0x8f3e6d8dd99b9e4e +229, 0xb9be6cc22949d62a +230, 0xecbdc7beaa5ff1fe +231, 0xd388db43a855bdf0 +232, 0xd71ee3238852568d +233, 0x85ab3056304c04b5 +234, 0x2ed7ae7ad3cfc3cb +235, 0x781d1b03d40b6c48 +236, 0x7d3c740886657e6d +237, 0x982cfa6828daa6b0 +238, 0x278579599c529464 +239, 0x773adecfae9f0e08 +240, 0x63a243ea4b85c5d7 +241, 0x59940074fc3709e1 +242, 0xc914a2eed58a6363 +243, 0x2602b04274dd724c +244, 0xdf636eb7636c2c42 +245, 0x891a334d0d26c547 +246, 0xde8cd586d499e22d +247, 0x3ea1aa4d9b7035b6 +248, 0xd085cff6f9501523 +249, 0xe82a872f374959e +250, 0x55cb495bbd42cc53 +251, 0x5f42b3226e56ca97 +252, 0xea463f6f203493a3 +253, 0xeef3718e57731737 +254, 0x1bd4f9d62b7f9f3c +255, 0x19284f5e74817511 +256, 0xaf6e842c7450ca87 +257, 0x1d27d2b08a6b3600 +258, 0xfb4b912b396a52e3 +259, 0x30804d4c5c710121 +260, 0x4907e82564e36338 +261, 0x6441cf3b2900ddb7 +262, 0xd76de6f51988dc66 +263, 0x4f298ef96fd5e6d2 +264, 0x65432960c009f83d +265, 0x65ebed07e1d2e3df +266, 0xf83ee8078febca20 +267, 0x7bb18e9d74fc5b29 +268, 0x597b5fbc2261d91 +269, 0xea4f8ed0732b15b2 +270, 0xba2267f74f458268 +271, 0x3f304acabd746bbb +272, 0x7bd187af85659a82 +273, 0x88e20dbdb7a08ea3 +274, 0x2a2dc948c772fcb4 +275, 0x87784fec2993c867 +276, 0x89163933cd362d4e +277, 0xfd7b24f04302f957 +278, 0x9bdd544405dfb153 +279, 0xddee0fac58ffc611 +280, 0xa8e8993417e71ec1 +281, 0x55e0ab46ff7757af +282, 0x53e7645f08d3d7df +283, 0xbf78e563bc656ba2 +284, 0x1d162253b45ee2de +285, 0x15e2bfefedf29eb4 +286, 0x4e2a4584aa394702 +287, 0xa89fb12b01525897 +288, 0x825bd98f0544e4df +289, 0xfc6c50da6750700 +290, 0xc24aaabde7d28423 +291, 0x79d6f4660fcb19e5 +292, 0xee7d4fb40c8d659f +293, 0x70bc281b462e811d +294, 0x23ed4dc9636519a7 +295, 0xcb7c3f5a5711b935 +296, 0xe73090e0508c5d9d +297, 0xb25a331f375952a6 +298, 0xa64c86e0c04740f6 +299, 0xb8f3ffc8d56ac124 +300, 0x2479266fc5ee6b15 +301, 0x8d5792d27f5ffbcb +302, 0xb064298be946cd52 +303, 0xf0934a98912ffe26 +304, 0xbe805682c6634d98 +305, 0xe0e6e2c010012b4f +306, 0x58c47d475f75976 +307, 0x358c9a6e646b2b4a +308, 0x7e7c4ffca5b17ba7 +309, 0x43585c8c9a24a04c +310, 0x5154ddbcd68d5c2c +311, 0x4a2b062d3742a5e +312, 0xca5691191da2b946 +313, 0x696a542109457466 +314, 0x9eb5d658a5022ba5 +315, 0x8158cf6b599ab8dc +316, 0x1b95391eaa4af4a6 +317, 0x9953e79bd0fc3107 +318, 0x8639690086748123 +319, 0x2d35781c287c6842 +320, 0x393ef0001cd7bc8f +321, 0xe3a61be8c5f2c22a +322, 0x5e4ff21b847cc29b +323, 0x4c9c9389a370eb84 +324, 0xd43a25a8fc3635fa +325, 0xf6790e4a85385508 +326, 0x37edf0c81cb95e1d +327, 0x52db00d6e6e79af8 +328, 0x3b202bceeb7f096 +329, 0x2a164a1c776136bb +330, 0x73e03ee3fd80fd1b +331, 0xd2c58c0746b8d858 +332, 0x2ed2cb0038153d22 +333, 0x98996d0fc8ceeacc +334, 0xa4ed0589936b37f +335, 0x5f61cf41a6d2c172 +336, 0xa6d4afb538c110d7 +337, 0xe85834541baadf1a +338, 0x4c8967107fd49212 +339, 0x49bafb762ab1a8c1 +340, 0x45d540e2a834bf17 +341, 0x1c0ec8b4ed671dac +342, 0x3d503ce2c83fe883 +343, 0x437bfffd95f42022 +344, 0xc82d1e3d5c2bc8d2 +345, 0x7a0a9cbfcb0d3f24 +346, 0xc0a4f00251b7a3be +347, 0xb5be24e74bb6a1c6 +348, 0xa3104b94b57545b1 +349, 0x86de7d0c4b97b361 +350, 0x879c1483f26538a6 +351, 0xd74c87557f6accfb +352, 0x2f9be40dbf0fe8a1 +353, 0x445a93398f608d89 +354, 0x7b3cb8a7211d7fdc +355, 0xe86cc51290d031e7 +356, 0x33ef3594052ad79f +357, 0xc61911d241dbb590 +358, 0x37cccb0c0e3de461 +359, 0xb75259124080b48b +360, 0xd81e8961beb4abe5 +361, 0xf4542deb84a754e +362, 0x6ea036d00385f02e +363, 0xa7b60b0ac3b88681 +364, 0x108a6c36ca30baf5 +365, 0x4a2adc5bbfe2bf07 +366, 0x4079501f892a5342 +367, 0x55e113963c5448f0 +368, 0x8019ff4903b37242 +369, 0x109c6dcdb7ec6618 +370, 0x1239ac50944da450 +371, 0xe1399c7f94c651c1 +372, 0x5a6bbbae388d365a +373, 0x4d72be57b8810929 +374, 0x3f067df24384e1fb +375, 0x4f8b9e0f7f6c7be +376, 0x202492c342a3b08 +377, 0x250753192af93a3 +378, 0xfba1159d9de2cb8e +379, 0xba964497ab05505c +380, 0x1329ec5d8a709dca +381, 0x32927cacb6cd22bb +382, 0x6b4d7db904187d56 +383, 0xe76adccf8e841e02 +384, 0x8c4bf4b6a788202 +385, 0x3013a3b409831651 +386, 0x7427d125c475412f +387, 0x84dcc4bb2bf43202 +388, 0x117526f1101372a5 +389, 0xfe95d64b8984bd72 +390, 0x524e129934cc55c1 +391, 0xc3db4b0418c36d30 +392, 0xe1cb2047e9c19f7a +393, 0xea43d6c8d8982795 +394, 0xe80ac8a37df89ed +395, 0xfecc2104329ed306 +396, 0xa5c38aac9c1d51ea +397, 0x3abe5d1c01e4fe17 +398, 0x717a805d97fcc7ac +399, 0x94441f8207a1fb78 +400, 0x22d7869c5f002607 +401, 0x349e899f28c3a1b9 +402, 0x5639950cdea92b75 +403, 0x7e08450497c375b +404, 0x94bf898b475d211d +405, 0x75c761a402375104 +406, 0x1930920ec9d2a1e7 +407, 0xb774ba1bc6f6e4e2 +408, 0xf715602412e5d900 +409, 0x87bb995f4a13f0ba +410, 0xa3c787868dfa9c8d +411, 0xa17fd42a5a4f0987 +412, 0x4a9f7d435242b86 +413, 0x240364aff88f8aef +414, 0xe7cd4cf4bf39f144 +415, 0xd030f313ca4c2692 +416, 0xc46696f4e03ec1e9 +417, 0x22c60f1ec21060b3 +418, 0x16c88058fd68986f +419, 0x69ca448e8e6bde3f +420, 0x3466c2cdec218abd +421, 0x837ac4d05e6b117d +422, 0x911210e154690191 +423, 0x9ece851d6fa358b7 +424, 0x42f79cb0c45e7897 +425, 0xbf7583babd7c499b +426, 0x2059fe8031c6e0b9 +427, 0xabbec8fc00f7e51d +428, 0x88809d86a3a256e1 +429, 0xd36056df829fdcb5 +430, 0x515632b6cb914c64 +431, 0xba76d06c2558874 +432, 0x632c54ca4214d253 +433, 0xadec487adf2cb215 +434, 0x521e663e1940513d +435, 0xb1b638b548806694 +436, 0xbe2d5bfbe57d2c72 +437, 0x8b89e7719db02f7 +438, 0x90ba5281c1d56e63 +439, 0x899e1b92fceea102 +440, 0xf90d918e15182fa6 +441, 0x94a489ce96c948c4 +442, 0xad34db453517fcd4 +443, 0xc5264eb2de15930f +444, 0x101b4e6603a21cee +445, 0xef9b6258d6e85fff +446, 0x6075c7d6c048bd7a +447, 0x6f03232c64e438aa +448, 0x18c983d7105ee469 +449, 0x3ffc23f5c1375879 +450, 0xbc1b4a00afb1f9f +451, 0x5afa6b2bb8c6b46e +452, 0xe7fce4af2f2c152a +453, 0x5b00ab5c4b3982c7 +454, 0x2d4b0c9c0eb4bd0c +455, 0x61d926270642f1f2 +456, 0x7219c485c23a2377 +457, 0x7e471c752fecd895 +458, 0x23c4d30a4d17ba1f +459, 0x65cb277fe565ca22 +460, 0xcbb56ed9c701363b +461, 0xfd04ab3a6eba8282 +462, 0x19c9e5c8bab38500 +463, 0xea4c15227676b65b +464, 0x20f3412606c8da6f +465, 0xb06782d3bf61a239 +466, 0xf96e02d5276a9a31 +467, 0x835d256b42aa52a6 +468, 0x25b09151747f39c1 +469, 0x64507386e1103eda +470, 0x51cbc05716ef88e4 +471, 0x998cd9b7989e81cc +472, 0x9d7115416bec28d1 +473, 0xc992ca39de97906b +474, 0xd571e6f7ca598214 +475, 0xafc7fb6ccd9abbf8 +476, 0x88ef456febff7bf4 +477, 0xdbe87ccc55b157d2 +478, 0xaab95e405f8a4f6d +479, 0xad586a385e74af4f +480, 0x23cd15225c8485aa +481, 0x370940bf47900ac7 +482, 0xefd6afda1a4b0ead +483, 0x9cb1a4c90993dd7a +484, 0xff7893e8b2f70b11 +485, 0xb09e1807c0638e8e +486, 0xb10915dcb4978f74 +487, 0x88212ab0051a85eb +488, 0x7af41b76e1ec793f +489, 0x2e5c486406d3fefd +490, 0xebe54eff67f513cc +491, 0xab6c90d0876a79b8 +492, 0x224df82f93fe9089 +493, 0xc51c1ce053dc9cd2 +494, 0x5ef35a4d8a633ee7 +495, 0x4aca033459c2585f +496, 0xd066932c6eefb23d +497, 0x5309768aab9a7591 +498, 0xa2a3e33823df37f9 +499, 0xcec77ff6a359ee9 +500, 0x784dc62d999d3483 +501, 0x84e789fb8acc985d +502, 0xd590237e86aa60f +503, 0x737e2ffe1c8ad600 +504, 0xc019c3a39a99eab8 +505, 0x6a39e9836964c516 +506, 0xe0fe43129535d9da +507, 0xdfc5f603d639d4de +508, 0x7b9a7d048a9c03b6 +509, 0xbb5aa520faa27fdd +510, 0x2a09b4200f398fa2 +511, 0x38cc88107904064e +512, 0xa9a90d0b2d92bb25 +513, 0x9419762f87e987e3 +514, 0x1a52c525153dedcd +515, 0xc26d9973dd65ae99 +516, 0x8e89bd9d0dc6e6a1 +517, 0x2f30868dc01bfb53 +518, 0x20f09d99b46501c4 +519, 0x78b468a563b8f1e9 +520, 0xcccf34b0b6c380c7 +521, 0xf554e7dc815297e6 +522, 0x332a585cfb4a50ef +523, 0xa9fb64a2b6da41d7 +524, 0xdcd2a5a337391ce0 +525, 0x8a9bd3e324c6463d +526, 0x9f4487d725503bdd +527, 0xf72282d82f1d0ff +528, 0x308f4160abb72d42 +529, 0x648de1db3a601b08 +530, 0x36cab5192e7ebd39 +531, 0x7975fbe4ab6a1c66 +532, 0xd515b4d72243864e +533, 0x43a568f8b915e895 +534, 0x15fa9f2057bdb91d +535, 0x7a43858ef7a222dc +536, 0x17b4a9175ac074fe +537, 0xa932c833b8d0f8f8 +538, 0x1d2db93a9a587678 +539, 0x98abd1d146124d27 +540, 0xf0ab0431671740aa +541, 0xa9d182467540ad33 +542, 0x41c8a6cfc331b7fc +543, 0xa52c6bd0fcd1d228 +544, 0x2773c29a34dc6fa3 +545, 0x3098230746fc1f37 +546, 0xd63311bb4f23fabe +547, 0x6712bf530cd2faec +548, 0x342e8f342e42c4dd +549, 0xfbd83331851cdcad +550, 0xe903be1361bbc34d +551, 0xd94372e5077e3ef9 +552, 0x95aaa234f194bd8 +553, 0x20c0c8fb11e27538 +554, 0xfaf47dc90462b30b +555, 0x8ddc6d144147682a +556, 0xf626833fd926af55 +557, 0x5df93c34290d1793 +558, 0xb06a903e6e9fca5e +559, 0x10c792dc851d77ca +560, 0xd9b1b817b18e56cb +561, 0x3a81730c408eb408 +562, 0x65052c04a8d4b63c +563, 0x3328546598e33742 +564, 0xeca44a13f62d156d +565, 0x69f83d1d86b20170 +566, 0x937764200412027d +567, 0xc57eb1b58df0f191 +568, 0xa1c7d67dce81bc41 +569, 0x8e709c59a6a579ce +570, 0x776a2f5155d46c70 +571, 0xd92906fbbc373aa5 +572, 0xe97ad478a2a98bf6 +573, 0xc296c8819ac815f +574, 0x613ede67ba70e93e +575, 0xe145222498f99cde +576, 0xafcdfa7a3c1cf9bf +577, 0x1c89252176db670d +578, 0xad245eda5c0865ff +579, 0x249463d3053eb917 +580, 0xc9be16d337517c0b +581, 0xefcc82bf67b8f731 +582, 0x1e01577d029e0d00 +583, 0xad9c24b2a4f3d418 +584, 0xed2cceb510db4d0f +585, 0xbddadcdb92400c70 +586, 0x67d6b0476ef82186 +587, 0xbc7662ff7bf19f73 +588, 0x9d94452a729e6e92 +589, 0x6b278d8594f55428 +590, 0x6c4b31cceb1b2109 +591, 0xccc6c3a726701e9 +592, 0x6bc28ece07df8925 +593, 0xc0422b7bf150ccc4 +594, 0xab7158f044e73479 +595, 0xdf3347546d9ed83f +596, 0x3b3235a02c70dff4 +597, 0x2551c49c14ea8d77 +598, 0xee2f7f5bb3cc228e +599, 0x39b87bfe8c882d39 +600, 0x7dd420fad380b51c +601, 0xffe64976af093f96 +602, 0x4a4f48dc6e7eaa5f +603, 0x85f2514d32fdc8cc +604, 0x1ab1215fd7f94801 +605, 0x4cd1200fc795b774 +606, 0xcf8af463a38942ee +607, 0x319caa7ce3022721 +608, 0x8cd9798a76d1aea4 +609, 0x2bd3933ac7afd34e +610, 0x85d4c323403cf811 +611, 0xd7b956d3064efa30 +612, 0x67a078dbf1f13068 +613, 0x665fa6c83e87c290 +614, 0x9333ac2416d2469b +615, 0xdfb1fd21a0094977 +616, 0xa1962a6e2c25f8ff +617, 0x1f3b10a7ed5287cf +618, 0x70641efb3d362713 +619, 0xe527a2cf85d00918 +620, 0x9741e45d3f9890a3 +621, 0x6cb74b5d4d36db4b +622, 0xf24734d622bd2209 +623, 0xadd6d94f78e9d378 +624, 0xc3bbdb59225cca7f +625, 0x5ad36614275b30cd +626, 0x495568dd74eea434 +627, 0xf35de47e0ffe1f2d +628, 0xefa209dca719ab18 +629, 0x844ddcaeb5b99ae8 +630, 0x37449670a1dc7b19 +631, 0x5a4612c166f845c1 +632, 0xe70f7782f2087947 +633, 0x98d484deac365721 +634, 0x705302198cf52457 +635, 0x7135ae0f5b77df41 +636, 0x342ac6e44a9b6fc3 +637, 0x2713fd2a59af5826 +638, 0x6e1a3f90f84efa75 +639, 0x9fb3b4dd446ca040 +640, 0x530044ae91e6bd49 +641, 0xe984c4183974dc3e +642, 0x40c1fa961997d066 +643, 0xb7868250d8c21559 +644, 0x8bc929fa085fd1de +645, 0x7bdb63288dc8733e +646, 0xac4faad24326a468 +647, 0x1c6e799833aea0b1 +648, 0xcc8a749e94f20f36 +649, 0x4e7abfd0443547c5 +650, 0xb661c73bb8caa358 +651, 0x4a800f5728ff2351 +652, 0x8c15e15189b9f7ed +653, 0xab367846b811362c +654, 0x4ba7508f0851ca2a +655, 0xe9af891acbafc356 +656, 0xbdebe183989601f8 +657, 0x4c665ea496afc061 +658, 0x3ca1d14a5f2ed7c +659, 0xfbdff10a1027dd21 +660, 0xdfd28f77c8cff968 +661, 0xc4fbaadf8a3e9c77 +662, 0xdac7e448b218c589 +663, 0xb26390b5befd19e2 +664, 0xd2ef14916c66dba9 +665, 0xfab600284b0ff86b +666, 0xf04a1c229b58dabb +667, 0xc21c45637e452476 +668, 0xd1435966f75e0791 +669, 0xc1f28522eda4a2d0 +670, 0x52332ae8f1222185 +671, 0x81c6c0790c0bf47e +672, 0xfebd215e7d8ffb86 +673, 0x68c5dce55dbe962b +674, 0x231d09cb0d2531d1 +675, 0x3218fba199dbbc6b +676, 0x8f23c535f8ea0bf6 +677, 0x6c228963e1df8bd9 +678, 0x9843c7722ed153e3 +679, 0xd032d99e419bddec +680, 0xe2dca88aa7814cab +681, 0x4d53fb8c6a59cdc2 +682, 0x8fb3abc46157b68b +683, 0xa3e733087e09b8e +684, 0x6bdc1aee029d6b96 +685, 0x4089667a8906d65b +686, 0x8f3026a52d39dd03 +687, 0x6d2e0ccb567bae84 +688, 0x74bad450199e464 +689, 0xf114fb68a8f300d5 +690, 0xc7a5cc7b374c7d10 +691, 0xf0e93da639b279d1 +692, 0xb9943841ad493166 +693, 0x77a69290455a3664 +694, 0x41530da2ebea054b +695, 0xe8f9fab03ea24abf +696, 0xaa931f0c9f55a57a +697, 0xb4d68a75d56f97ae +698, 0x3d58ff898b6ba297 +699, 0x49d81e08faf5a3f5 +700, 0xfc5207b9f3697f3b +701, 0xa25911abb3cf19b7 +702, 0x6b8908eb67c3a41 +703, 0xd63ef402e2e3fa33 +704, 0x728e75d3f33b14c5 +705, 0x248cb1b8bc6f379a +706, 0x3aa3d6d2b8c72996 +707, 0x49cc50bd2d3d2860 +708, 0xb4e1387647c72075 +709, 0x435a1630a4a81ed3 +710, 0xa5ea13005d2460cf +711, 0xc7a613df37d159ec +712, 0x95721ccc218b857e +713, 0xd4b70d8c86b124d3 +714, 0x2b82bcc4b612d494 +715, 0xaf13062885276050 +716, 0xcbd8fcf571a33d9c +717, 0x3f7f67ca1125fc15 +718, 0xddf4bb45aac81b4c +719, 0x23606da62de9c040 +720, 0xa3a172375666b636 +721, 0x292f87387a6c6c3c +722, 0xd1d10d00c5496fe1 +723, 0x86b0411ce8a25550 +724, 0x38e0487872e33976 +725, 0x363e49f88ddfd42c +726, 0x45bdf1e9f6b66b0a +727, 0x8a6fff3de394f9b5 +728, 0x8502158bb03f6209 +729, 0x22e24d16dba42907 +730, 0x3fe3ba427cc2b779 +731, 0x77144793f66b3d7e +732, 0xcf8912ccb29b8af9 +733, 0xdc856caff2abd670 +734, 0xe6d3ae0b0d9d4c8b +735, 0xb8f5d40e454c539f +736, 0x79ca953114fbc6b7 +737, 0x478d6f4bbfa38837 +738, 0x9babae1a3ffdc340 +739, 0x40edd56802bae613 +740, 0x97a56c2dcccf0641 +741, 0xafc250257f027f8e +742, 0x8da41ef1edf69125 +743, 0x6574b0280ff9d309 +744, 0x197c776151b8f820 +745, 0x6b03e077c9dac3b6 +746, 0x24a40ebbc5c341c5 +747, 0x50e585169a6a1c4b +748, 0x37783a5a6a3e4e02 +749, 0xb3de81ee6fbad647 +750, 0xf4f292f57ca4591e +751, 0x6214e9e7d44d30a +752, 0x5920190c56d21c12 +753, 0x9ac163419b5e0c9b +754, 0xfc2328761ae8ed93 +755, 0xc68f945b545508c6 +756, 0x687c49a17ce0a5e2 +757, 0x276d8f53d30d4ab4 +758, 0x8201804970343ce1 +759, 0x1b5d323cc2e7fb7e +760, 0x6f351ef04fd904b +761, 0x6c793a7d455d5198 +762, 0x46f5d108430ae91f +763, 0xac16a15b2a0cf77f +764, 0xa0d479d9e4122b9d +765, 0x3afd94604307f19 +766, 0x2573ed6d39d38dbf +767, 0xa58e14ba60b4294b +768, 0xe69c1aed5840d156 +769, 0x4cf6fda7f04855c2 +770, 0x2fb65a56ef5f22da +771, 0xf95819434d5dc220 +772, 0x29c65133623dafba +773, 0x8e997bd018467523 +774, 0xfd08ba9d498461a7 +775, 0xdd52243bc78a5592 +776, 0x39c30108f6db88b3 +777, 0x38af8e1894f259b9 +778, 0x97eedf3b4ae5f6de +779, 0x757825add80c5ece +780, 0xf0fdd90ac14edb14 +781, 0xbbb19d4cc8cac6d4 +782, 0x9a82234edfae05e3 +783, 0x704401c61d1edf1c +784, 0x8b0eb481fb3a1fb2 +785, 0xef6f36e7cc06c002 +786, 0x7a208b17e04b8cd7 +787, 0xf20e33d498838fe9 +788, 0xc2bdb22117058326 +789, 0x6ec31939eb4ca543 +790, 0x6f1654838f507a21 +791, 0xc65ab81a955d2b93 +792, 0x40b1420fdd9531b8 +793, 0xe31f221cab9f4f40 +794, 0x798cdd414c1deb7a +795, 0x9c84e9c7d41cd983 +796, 0x63d6b1ae3b60b7fa +797, 0xb42bfdd1a2f78ffa +798, 0x37e431eaccaaa8e9 +799, 0x7508142a0f73eac9 +800, 0x91662a023df5893a +801, 0x59782070e2fe3031 +802, 0xb2acd589a8ce7961 +803, 0xa224743fa877b292 +804, 0xaa5362aa27e6ed9e +805, 0xa394a4e520c0c1c7 +806, 0xe49b16d2018ffb6f +807, 0xb8074b9f2f1e762b +808, 0xcf5f86143d5c23a7 +809, 0xfd838785db987087 +810, 0x31b1889df389aff8 +811, 0x30aaca876a4383b +812, 0x1731bb71c4c38d4f +813, 0x9a83a65395e05458 +814, 0x99cd0c8d67c8f4fc +815, 0xfbd9fdc849b761a5 +816, 0x82c04834fc466889 +817, 0xdeef9d6e715e8c97 +818, 0x549c281c16da6078 +819, 0x2d70661254ad599d +820, 0x57995793a72acac +821, 0xf1727005116183ba +822, 0xa22bb38945285de3 +823, 0x4f2d687fe45131ff +824, 0x5666c87ddbbc981f +825, 0xbcb4b2d4e7a517d0 +826, 0x5e794dd2e20b785d +827, 0x449ad020149e093c +828, 0x7704ee0412d106f5 +829, 0x83cbdf257b072ac1 +830, 0xae5c4fc9f638b0da +831, 0x7b9e5a64e372ed47 +832, 0x7eddbbb22c2cdf57 +833, 0x3f19ebfa155b08e +834, 0x91d991154dfd7177 +835, 0x611ae74b952d387f +836, 0x3fdf7a335bda36ee +837, 0xdf182433fc7a7c05 +838, 0x62c78598d1f8db0a +839, 0xc3750c69d2c5c1f0 +840, 0xf1318024709efdee +841, 0xaa3fd360d224dc29 +842, 0x62af53b2f307c19 +843, 0xdf527683c58120c2 +844, 0x3281deecc496f93d +845, 0x4f704ad31527ef08 +846, 0x127a14a5e07cfdfc +847, 0x90d0b1f549255c92 +848, 0xbc3406b212c5e1fc +849, 0x4e89f39379dba91d +850, 0x1290ef43c4998e6e +851, 0xecfeb1a1cb1c6e1b +852, 0x2067e90403003bf1 +853, 0x38ae04be30bdbeba +854, 0x8a3537f298baedda +855, 0xd07f3b825cdb2936 +856, 0xea020b5aebae8b45 +857, 0xfcd614ab031132b0 +858, 0x5fb682a4ff2268f5 +859, 0xd1c4662ce65596f4 +860, 0x7026b8270dd0b8dc +861, 0x8101ec4b4beae45a +862, 0xa0e9dc87940610a6 +863, 0x83ec33679d83165b +864, 0x981847ca82e86d41 +865, 0xda84c188a304a0b7 +866, 0x3c37529c5a5bbbb8 +867, 0x34a8491ce3e19a5a +868, 0xd36ad716a2fa6cb8 +869, 0xfd1d1d6a5189a15c +870, 0x9716eb47851e8d8d +871, 0x7dfb13ea3b15c5aa +872, 0xbdf6e707f45113a5 +873, 0xb8118261b04bd097 +874, 0x6191f9895881bec6 +875, 0x7aac257ae11acf9b +876, 0x35a491e1537ff120 +877, 0xe078943432efa71c +878, 0xb3338485dd3dc2b9 +879, 0x456060975d2bb3b5 +880, 0xaddc4c451bdfc44c +881, 0x18bfa7beacf96430 +882, 0x8802ebcaf0f67498 +883, 0xad922a5a825bd780 +884, 0x9fb4587d748f4efa +885, 0xdb2a445136cd5e7 +886, 0xb98b3676ea8e96ac +887, 0xb02d8d244d784878 +888, 0xa1a8442b18860abb +889, 0x6a3029ba1361e5d1 +890, 0xf426d5fac161eb1 +891, 0xfa5ac2b87acecb23 +892, 0xaa659896e50535df +893, 0xf40dd7a3d3c5c8ed +894, 0x3f8367abecb705bc +895, 0x2d60e7525873358f +896, 0xc4a9d3948a0c3937 +897, 0x5ecc04fef6003909 +898, 0x7a865004918cba2 +899, 0x47ae110a678ec10b +900, 0xa0f02f629d91aa67 +901, 0x4848b99e7fac9347 +902, 0xaa858346d63b80ac +903, 0xeb5bf42ee161eeef +904, 0x4d35d723d3c6ba37 +905, 0xdf22ca6ca93b64a7 +906, 0x9d198520f97b25b1 +907, 0x3068415350778efe +908, 0xf3709f2e8793c2fe +909, 0xd1517bac8dd9f16f +910, 0xfb99bccaa15861dc +911, 0xa9ad607d796a2521 +912, 0x55d3793d36bd22e4 +913, 0xf99270d891ff7401 +914, 0x401750a5c4aa8238 +915, 0xd84b3003e6f28309 +916, 0x8a23798b5fa7c98b +917, 0xadd58bbc8f43e399 +918, 0xbd8c741ada62c6a8 +919, 0xbdc6937bc55b49fa +920, 0x4aefa82201b8502 +921, 0x17adf29a717b303 +922, 0xa6ed2197be168f6c +923, 0x1ba47543f4359a95 +924, 0xe34299949ac01ae9 +925, 0x711c76cffc9b62f3 +926, 0xbac259895508a4b7 +927, 0x3c8b3b3626b0d900 +928, 0x1a8d23fbe2ae71bf +929, 0xca984fa3b5a5c3a1 +930, 0xb1986ab7521a9c93 +931, 0xd6b5b2c8d47a75b5 +932, 0xc7f1c4a88afb4957 +933, 0xdeb58033a3acd6cc +934, 0xabe49ddfe1167e67 +935, 0x8d559c10205c06e3 +936, 0xea07a1a7de67a651 +937, 0xcbef60db15b6fef8 +938, 0xbfca142cff280e7 +939, 0x362693eba0732221 +940, 0x7463237e134db103 +941, 0x45574ddb5035e17a +942, 0xfc65e0cb9b94a1aa +943, 0x3154c55f1d86b36d +944, 0x2d93a96dd6ab2d8b +945, 0xbe3bc1d1f2542a25 +946, 0xdd4b541f7385bdaa +947, 0x3b56b919d914e3f8 +948, 0x82fd51468a21895f +949, 0x8988cf120731b916 +950, 0xa06a61db5fb93e32 +951, 0x6ed66c1b36f68623 +952, 0x875ae844d2f01c59 +953, 0x17ccd7ac912e5925 +954, 0x12fe2a66b8e40cb1 +955, 0xf843e5e3923ad791 +956, 0xa17560f2fd4ef48 +957, 0x27a2968191a8ee07 +958, 0xa9aab4d22ff44a3c +959, 0x63cd0dcc3bb083ae +960, 0x7a30b48c6160bf85 +961, 0x956160fb572503b3 +962, 0xc47f6b7546640257 +963, 0xaf4b625f7f49153 +964, 0x2f5c86a790e0c7e8 +965, 0xb52e0610ae07f0b8 +966, 0x38a589292c3d849e +967, 0xc3e9ef655d30b4ef +968, 0xb5695f765cda998a +969, 0xde5d5e692a028e91 +970, 0x839476721555f72e +971, 0x48b20679b17d9ebf +972, 0xe3d4c6b2c26fb0df +973, 0xce5a9834f0b4e71f +974, 0x533abb253d5d420e +975, 0x9eac5ad9aed34627 +976, 0xc0f2a01ab3c90dbb +977, 0x6528eda93f6a066c +978, 0xc16a1b625e467ade +979, 0x1a4a320fb5e8b098 +980, 0x8819cccd8b4ab32f +981, 0x42daa88531fd0bfd +982, 0xcf732226409be17c +983, 0xfddcdb25ccbf378c +984, 0x9b15b603bf589fc1 +985, 0x2436066b95d366fe +986, 0x8d42eff2e9cbda90 +987, 0x694b2fc8a4e8303c +988, 0x8e207f98aaea3ccd +989, 0x4730d7a620f822d9 +990, 0x468dc9ca30fe2fd4 +991, 0x74b36d8a1c0f031b +992, 0x3c1aac1c488c1a94 +993, 0x19d0101042444585 +994, 0x8ec50c56d0c8adf4 +995, 0x721ec629e4d66394 +996, 0x3ca5ad93abeac4a4 +997, 0xaaebc76e71592623 +998, 0x969cc319e3ed6058 +999, 0xc0a277e3b2bfc3de diff --git a/numpy/random/tests/test_direct.py b/numpy/random/tests/test_direct.py index d602b36b4..29054b70b 100644 --- a/numpy/random/tests/test_direct.py +++ b/numpy/random/tests/test_direct.py @@ -8,8 +8,8 @@ from numpy.testing import (assert_equal, assert_allclose, assert_array_equal, import pytest from numpy.random import ( - Generator, MT19937, PCG64, Philox, RandomState, SeedSequence, SFC64, - default_rng + Generator, MT19937, PCG64, PCG64DXSM, Philox, RandomState, SeedSequence, + SFC64, default_rng ) from numpy.random._common import interface @@ -359,6 +359,34 @@ class TestPCG64(Base): assert val_big == val_pos +class TestPCG64DXSM(Base): + @classmethod + def setup_class(cls): + cls.bit_generator = PCG64DXSM + cls.bits = 64 + cls.dtype = np.uint64 + cls.data1 = cls._read_csv(join(pwd, './data/pcg64dxsm-testset-1.csv')) + cls.data2 = cls._read_csv(join(pwd, './data/pcg64dxsm-testset-2.csv')) + cls.seed_error_type = (ValueError, TypeError) + cls.invalid_init_types = [(3.2,), ([None],), (1, None)] + cls.invalid_init_values = [(-1,)] + + def test_advance_symmetry(self): + rs = Generator(self.bit_generator(*self.data1['seed'])) + state = rs.bit_generator.state + step = -0x9e3779b97f4a7c150000000000000000 + rs.bit_generator.advance(step) + val_neg = rs.integers(10) + rs.bit_generator.state = state + rs.bit_generator.advance(2**128 + step) + val_pos = rs.integers(10) + rs.bit_generator.state = state + rs.bit_generator.advance(10 * 2**128 + step) + val_big = rs.integers(10) + assert val_neg == val_pos + assert val_big == val_pos + + class TestMT19937(Base): @classmethod def setup_class(cls): diff --git a/numpy/random/tests/test_smoke.py b/numpy/random/tests/test_smoke.py index 909bfaa8d..9becc434d 100644 --- a/numpy/random/tests/test_smoke.py +++ b/numpy/random/tests/test_smoke.py @@ -4,7 +4,7 @@ from functools import partial import numpy as np import pytest from numpy.testing import assert_equal, assert_, assert_array_equal -from numpy.random import (Generator, MT19937, PCG64, Philox, SFC64) +from numpy.random import (Generator, MT19937, PCG64, PCG64DXSM, Philox, SFC64) @pytest.fixture(scope='module', params=(np.bool_, np.int8, np.int16, np.int32, np.int64, @@ -774,6 +774,18 @@ class TestPCG64(RNG): cls._extra_setup() +class TestPCG64DXSM(RNG): + @classmethod + def setup_class(cls): + cls.bit_generator = PCG64DXSM + cls.advance = 2**63 + 2**31 + 2**15 + 1 + cls.seed = [12345] + cls.rg = Generator(cls.bit_generator(*cls.seed)) + cls.initial_state = cls.rg.bit_generator.state + cls.seed_vector_bits = 64 + cls._extra_setup() + + class TestDefaultRNG(RNG): @classmethod def setup_class(cls): diff --git a/numpy/testing/__init__.pyi b/numpy/testing/__init__.pyi index efb6bcd91..395626f6b 100644 --- a/numpy/testing/__init__.pyi +++ b/numpy/testing/__init__.pyi @@ -7,12 +7,18 @@ if sys.version_info >= (3, 8): else: from typing_extensions import Final +from unittest import ( + TestCase as TestCase, +) + from unittest.case import ( SkipTest as SkipTest, ) __all__: List[str] +def run_module_suite(file_to_run=..., argv=...): ... + class KnownFailureException(Exception): ... class IgnoreException(Exception): ... diff --git a/numpy/typing/__init__.py b/numpy/typing/__init__.py index d71ec0719..a2d4c60fb 100644 --- a/numpy/typing/__init__.py +++ b/numpy/typing/__init__.py @@ -140,6 +140,20 @@ Timedelta64 The `~numpy.timedelta64` class is not considered a subclass of `~numpy.signedinteger`, the former only inheriting from `~numpy.generic` while static type checking. +0D arrays +~~~~~~~~~ + +During runtime numpy aggressively casts any passed 0D arrays into their +corresponding `~numpy.generic` instance. Until the introduction of shape +typing (see :pep:`646`) it is unfortunately not possible to make the +necessary distinction between 0D and >0D arrays. While thus not strictly +correct, all operations are that can potentially perform a 0D-array -> scalar +cast are currently annotated as exclusively returning an `ndarray`. + +If it is known in advance that an operation _will_ perform a +0D-array -> scalar cast, then one can consider manually remedying the +situation with either `typing.cast` or a ``# type: ignore`` comment. + API --- @@ -326,7 +340,6 @@ from ._array_like import ( _RecursiveSequence, _SupportsArray, _ArrayND, - _ArrayOrScalar, _ArrayLikeInt, _ArrayLikeBool_co, _ArrayLikeUInt_co, diff --git a/numpy/typing/_array_like.py b/numpy/typing/_array_like.py index eb8d3f4e1..582d3db9a 100644 --- a/numpy/typing/_array_like.py +++ b/numpy/typing/_array_like.py @@ -132,7 +132,5 @@ _ArrayLikeInt = _ArrayLike[ if TYPE_CHECKING: _ArrayND = ndarray[Any, dtype[_ScalarType]] - _ArrayOrScalar = Union[_ScalarType, _ArrayND[_ScalarType]] else: _ArrayND = Any - _ArrayOrScalar = Any diff --git a/numpy/typing/_callable.py b/numpy/typing/_callable.py index 23cabd47a..30c210b62 100644 --- a/numpy/typing/_callable.py +++ b/numpy/typing/_callable.py @@ -47,7 +47,7 @@ from ._scalars import ( _NumberLike_co, ) from . import NBitBase -from ._array_like import ArrayLike, _ArrayOrScalar +from ._array_like import ArrayLike, _ArrayND if sys.version_info >= (3, 8): from typing import Protocol @@ -168,7 +168,7 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload def __call__( self, __other: Union[int, signedinteger[Any]] - ) -> Union[signedinteger[Any], float64]: ... + ) -> Any: ... @overload def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... @overload @@ -198,7 +198,7 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload def __call__( self, __other: Union[int, signedinteger[Any]] - ) -> Union[signedinteger[Any], float64]: ... + ) -> Any: ... @overload def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... @overload @@ -212,7 +212,7 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload def __call__( self, __other: Union[int, signedinteger[Any]] - ) -> Union[_2Tuple[signedinteger[Any]], _2Tuple[float64]]: ... + ) -> _2Tuple[Any]: ... @overload def __call__(self, __other: float) -> _2Tuple[floating[Union[_NBit1, _NBitDouble]]]: ... @overload @@ -336,7 +336,7 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload def __call__(self, __other: _T1) -> bool_: ... @overload - def __call__(self, __other: _T2) -> _ArrayOrScalar[bool_]: ... + def __call__(self, __other: _T2) -> _ArrayND[bool_]: ... else: _BoolOp = Any diff --git a/numpy/typing/tests/data/fail/fromnumeric.py b/numpy/typing/tests/data/fail/fromnumeric.py index c9156895d..d8f7a5d69 100644 --- a/numpy/typing/tests/data/fail/fromnumeric.py +++ b/numpy/typing/tests/data/fail/fromnumeric.py @@ -7,17 +7,17 @@ A.setflags(write=False) a = np.bool_(True) -np.take(a, None) # E: No overload variant of "take" matches argument type -np.take(a, axis=1.0) # E: No overload variant of "take" matches argument type -np.take(A, out=1) # E: No overload variant of "take" matches argument type -np.take(A, mode="bob") # E: No overload variant of "take" matches argument type +np.take(a, None) # E: incompatible type +np.take(a, axis=1.0) # E: incompatible type +np.take(A, out=1) # E: incompatible type +np.take(A, mode="bob") # E: incompatible type np.reshape(a, None) # E: Argument 2 to "reshape" has incompatible type np.reshape(A, 1, order="bob") # E: Argument "order" to "reshape" has incompatible type -np.choose(a, None) # E: No overload variant of "choose" matches argument type -np.choose(a, out=1.0) # E: No overload variant of "choose" matches argument type -np.choose(A, mode="bob") # E: No overload variant of "choose" matches argument type +np.choose(a, None) # E: incompatible type +np.choose(a, out=1.0) # E: incompatible type +np.choose(A, mode="bob") # E: incompatible type np.repeat(a, None) # E: Argument 2 to "repeat" has incompatible type np.repeat(A, 1, axis=1.0) # E: Argument "axis" to "repeat" has incompatible type @@ -38,14 +38,14 @@ np.partition( A, 0, order=range(5) # E: Argument "order" to "partition" has incompatible type ) -np.argpartition( # E: No overload variant of "argpartition" matches argument type - a, None +np.argpartition( + a, None # E: incompatible type ) -np.argpartition( # E: No overload variant of "argpartition" matches argument type - a, 0, axis="bob" +np.argpartition( + a, 0, axis="bob" # E: incompatible type ) -np.argpartition( # E: No overload variant of "argpartition" matches argument type - A, 0, kind="bob" +np.argpartition( + A, 0, kind="bob" # E: incompatible type ) np.argpartition( A, 0, order=range(5) # E: Argument "order" to "argpartition" has incompatible type @@ -93,62 +93,62 @@ np.compress( np.clip(a, 1, 2, out=1) # E: No overload variant of "clip" matches argument type np.clip(1, None, None) # E: No overload variant of "clip" matches argument type -np.sum(a, axis=1.0) # E: No overload variant of "sum" matches argument type -np.sum(a, keepdims=1.0) # E: No overload variant of "sum" matches argument type -np.sum(a, initial=[1]) # E: No overload variant of "sum" matches argument type +np.sum(a, axis=1.0) # E: incompatible type +np.sum(a, keepdims=1.0) # E: incompatible type +np.sum(a, initial=[1]) # E: incompatible type -np.all(a, axis=1.0) # E: No overload variant of "all" matches argument type -np.all(a, keepdims=1.0) # E: No overload variant of "all" matches argument type -np.all(a, out=1.0) # E: No overload variant of "all" matches argument type +np.all(a, axis=1.0) # E: No overload variant +np.all(a, keepdims=1.0) # E: No overload variant +np.all(a, out=1.0) # E: No overload variant -np.any(a, axis=1.0) # E: No overload variant of "any" matches argument type -np.any(a, keepdims=1.0) # E: No overload variant of "any" matches argument type -np.any(a, out=1.0) # E: No overload variant of "any" matches argument type +np.any(a, axis=1.0) # E: No overload variant +np.any(a, keepdims=1.0) # E: No overload variant +np.any(a, out=1.0) # E: No overload variant -np.cumsum(a, axis=1.0) # E: Argument "axis" to "cumsum" has incompatible type -np.cumsum(a, dtype=1.0) # E: Argument "dtype" to "cumsum" has incompatible type -np.cumsum(a, out=1.0) # E: Argument "out" to "cumsum" has incompatible type +np.cumsum(a, axis=1.0) # E: incompatible type +np.cumsum(a, dtype=1.0) # E: incompatible type +np.cumsum(a, out=1.0) # E: incompatible type -np.ptp(a, axis=1.0) # E: No overload variant of "ptp" matches argument type -np.ptp(a, keepdims=1.0) # E: No overload variant of "ptp" matches argument type -np.ptp(a, out=1.0) # E: No overload variant of "ptp" matches argument type +np.ptp(a, axis=1.0) # E: incompatible type +np.ptp(a, keepdims=1.0) # E: incompatible type +np.ptp(a, out=1.0) # E: incompatible type -np.amax(a, axis=1.0) # E: No overload variant of "amax" matches argument type -np.amax(a, keepdims=1.0) # E: No overload variant of "amax" matches argument type -np.amax(a, out=1.0) # E: No overload variant of "amax" matches argument type -np.amax(a, initial=[1.0]) # E: No overload variant of "amax" matches argument type +np.amax(a, axis=1.0) # E: incompatible type +np.amax(a, keepdims=1.0) # E: incompatible type +np.amax(a, out=1.0) # E: incompatible type +np.amax(a, initial=[1.0]) # E: incompatible type np.amax(a, where=[1.0]) # E: List item 0 has incompatible type -np.amin(a, axis=1.0) # E: No overload variant of "amin" matches argument type -np.amin(a, keepdims=1.0) # E: No overload variant of "amin" matches argument type -np.amin(a, out=1.0) # E: No overload variant of "amin" matches argument type -np.amin(a, initial=[1.0]) # E: No overload variant of "amin" matches argument type +np.amin(a, axis=1.0) # E: incompatible type +np.amin(a, keepdims=1.0) # E: incompatible type +np.amin(a, out=1.0) # E: incompatible type +np.amin(a, initial=[1.0]) # E: incompatible type np.amin(a, where=[1.0]) # E: List item 0 has incompatible type -np.prod(a, axis=1.0) # E: No overload variant of "prod" matches argument type -np.prod(a, out=False) # E: No overload variant of "prod" matches argument type -np.prod(a, keepdims=1.0) # E: No overload variant of "prod" matches argument type -np.prod(a, initial=int) # E: No overload variant of "prod" matches argument type -np.prod(a, where=1.0) # E: No overload variant of "prod" matches argument type +np.prod(a, axis=1.0) # E: incompatible type +np.prod(a, out=False) # E: incompatible type +np.prod(a, keepdims=1.0) # E: incompatible type +np.prod(a, initial=int) # E: incompatible type +np.prod(a, where=1.0) # E: incompatible type np.cumprod(a, axis=1.0) # E: Argument "axis" to "cumprod" has incompatible type np.cumprod(a, out=False) # E: Argument "out" to "cumprod" has incompatible type np.size(a, axis=1.0) # E: Argument "axis" to "size" has incompatible type -np.around(a, decimals=1.0) # E: No overload variant of "around" matches argument type -np.around(a, out=type) # E: No overload variant of "around" matches argument type +np.around(a, decimals=1.0) # E: incompatible type +np.around(a, out=type) # E: incompatible type -np.mean(a, axis=1.0) # E: No overload variant of "mean" matches argument type -np.mean(a, out=False) # E: No overload variant of "mean" matches argument type -np.mean(a, keepdims=1.0) # E: No overload variant of "mean" matches argument type +np.mean(a, axis=1.0) # E: incompatible type +np.mean(a, out=False) # E: incompatible type +np.mean(a, keepdims=1.0) # E: incompatible type -np.std(a, axis=1.0) # E: No overload variant of "std" matches argument type -np.std(a, out=False) # E: No overload variant of "std" matches argument type -np.std(a, ddof='test') # E: No overload variant of "std" matches argument type -np.std(a, keepdims=1.0) # E: No overload variant of "std" matches argument type +np.std(a, axis=1.0) # E: incompatible type +np.std(a, out=False) # E: incompatible type +np.std(a, ddof='test') # E: incompatible type +np.std(a, keepdims=1.0) # E: incompatible type -np.var(a, axis=1.0) # E: No overload variant of "var" matches argument type -np.var(a, out=False) # E: No overload variant of "var" matches argument type -np.var(a, ddof='test') # E: No overload variant of "var" matches argument type -np.var(a, keepdims=1.0) # E: No overload variant of "var" matches argument type +np.var(a, axis=1.0) # E: incompatible type +np.var(a, out=False) # E: incompatible type +np.var(a, ddof='test') # E: incompatible type +np.var(a, keepdims=1.0) # E: incompatible type diff --git a/numpy/typing/tests/data/fail/index_tricks.py b/numpy/typing/tests/data/fail/index_tricks.py index cbc43fd54..c508bf3ae 100644 --- a/numpy/typing/tests/data/fail/index_tricks.py +++ b/numpy/typing/tests/data/fail/index_tricks.py @@ -5,7 +5,7 @@ AR_LIKE_i: List[int] AR_LIKE_f: List[float] np.unravel_index(AR_LIKE_f, (1, 2, 3)) # E: incompatible type -np.ravel_multi_index(AR_LIKE_i, (1, 2, 3), mode="bob") # E: incompatible type +np.ravel_multi_index(AR_LIKE_i, (1, 2, 3), mode="bob") # E: No overload variant np.mgrid[1] # E: Invalid index type np.mgrid[...] # E: Invalid index type np.ogrid[1] # E: Invalid index type diff --git a/numpy/typing/tests/data/fail/lib_utils.py b/numpy/typing/tests/data/fail/lib_utils.py new file mode 100644 index 000000000..e16c926aa --- /dev/null +++ b/numpy/typing/tests/data/fail/lib_utils.py @@ -0,0 +1,13 @@ +import numpy as np + +np.deprecate(1) # E: No overload variant + +np.deprecate_with_doc(1) # E: incompatible type + +np.byte_bounds(1) # E: incompatible type + +np.who(1) # E: incompatible type + +np.lookfor(None) # E: incompatible type + +np.safe_eval(None) # E: incompatible type diff --git a/numpy/typing/tests/data/pass/lib_utils.py b/numpy/typing/tests/data/pass/lib_utils.py new file mode 100644 index 000000000..c602923d9 --- /dev/null +++ b/numpy/typing/tests/data/pass/lib_utils.py @@ -0,0 +1,26 @@ +from __future__ import annotations + +from io import StringIO +from typing import Any + +import numpy as np + +FILE = StringIO() +AR: np.ndarray[Any, np.dtype[np.float64]] = np.arange(10).astype(np.float64) + +def func(a: int) -> bool: ... + +np.deprecate(func) +np.deprecate() + +np.deprecate_with_doc("test") +np.deprecate_with_doc(None) + +np.byte_bounds(AR) +np.byte_bounds(np.float64()) + +np.info(1, output=FILE) + +np.source(np.interp, output=FILE) + +np.lookfor("binary representation", output=FILE) diff --git a/numpy/typing/tests/data/reveal/arithmetic.py b/numpy/typing/tests/data/reveal/arithmetic.py index 53a3a846d..f5d185206 100644 --- a/numpy/typing/tests/data/reveal/arithmetic.py +++ b/numpy/typing/tests/data/reveal/arithmetic.py @@ -45,104 +45,104 @@ AR_LIKE_O: List[np.object_] # Array subtraction -reveal_type(AR_b - AR_LIKE_u) # E: Union[numpy.unsignedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]] -reveal_type(AR_b - AR_LIKE_i) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_b - AR_LIKE_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_b - AR_LIKE_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_b - AR_LIKE_m) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] +reveal_type(AR_b - AR_LIKE_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]] +reveal_type(AR_b - AR_LIKE_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_b - AR_LIKE_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_b - AR_LIKE_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_b - AR_LIKE_m) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] reveal_type(AR_b - AR_LIKE_O) # E: Any -reveal_type(AR_LIKE_u - AR_b) # E: Union[numpy.unsignedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]] -reveal_type(AR_LIKE_i - AR_b) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_LIKE_f - AR_b) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_LIKE_c - AR_b) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_LIKE_m - AR_b) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] -reveal_type(AR_LIKE_M - AR_b) # E: Union[numpy.datetime64, numpy.ndarray[Any, numpy.dtype[numpy.datetime64]]] +reveal_type(AR_LIKE_u - AR_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]] +reveal_type(AR_LIKE_i - AR_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_LIKE_f - AR_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_LIKE_c - AR_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_LIKE_m - AR_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] +reveal_type(AR_LIKE_M - AR_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.datetime64]] reveal_type(AR_LIKE_O - AR_b) # E: Any -reveal_type(AR_u - AR_LIKE_b) # E: Union[numpy.unsignedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]] -reveal_type(AR_u - AR_LIKE_u) # E: Union[numpy.unsignedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]] -reveal_type(AR_u - AR_LIKE_i) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_u - AR_LIKE_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_u - AR_LIKE_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_u - AR_LIKE_m) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] +reveal_type(AR_u - AR_LIKE_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]] +reveal_type(AR_u - AR_LIKE_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]] +reveal_type(AR_u - AR_LIKE_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_u - AR_LIKE_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_u - AR_LIKE_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_u - AR_LIKE_m) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] reveal_type(AR_u - AR_LIKE_O) # E: Any -reveal_type(AR_LIKE_b - AR_u) # E: Union[numpy.unsignedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]] -reveal_type(AR_LIKE_u - AR_u) # E: Union[numpy.unsignedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]] -reveal_type(AR_LIKE_i - AR_u) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_LIKE_f - AR_u) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_LIKE_c - AR_u) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_LIKE_m - AR_u) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] -reveal_type(AR_LIKE_M - AR_u) # E: Union[numpy.datetime64, numpy.ndarray[Any, numpy.dtype[numpy.datetime64]]] +reveal_type(AR_LIKE_b - AR_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]] +reveal_type(AR_LIKE_u - AR_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]] +reveal_type(AR_LIKE_i - AR_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_LIKE_f - AR_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_LIKE_c - AR_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_LIKE_m - AR_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] +reveal_type(AR_LIKE_M - AR_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.datetime64]] reveal_type(AR_LIKE_O - AR_u) # E: Any -reveal_type(AR_i - AR_LIKE_b) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_i - AR_LIKE_u) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_i - AR_LIKE_i) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_i - AR_LIKE_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_i - AR_LIKE_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_i - AR_LIKE_m) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] +reveal_type(AR_i - AR_LIKE_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_i - AR_LIKE_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_i - AR_LIKE_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_i - AR_LIKE_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_i - AR_LIKE_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_i - AR_LIKE_m) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] reveal_type(AR_i - AR_LIKE_O) # E: Any -reveal_type(AR_LIKE_b - AR_i) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_LIKE_u - AR_i) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_LIKE_i - AR_i) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_LIKE_f - AR_i) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_LIKE_c - AR_i) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_LIKE_m - AR_i) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] -reveal_type(AR_LIKE_M - AR_i) # E: Union[numpy.datetime64, numpy.ndarray[Any, numpy.dtype[numpy.datetime64]]] +reveal_type(AR_LIKE_b - AR_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_LIKE_u - AR_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_LIKE_i - AR_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_LIKE_f - AR_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_LIKE_c - AR_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_LIKE_m - AR_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] +reveal_type(AR_LIKE_M - AR_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.datetime64]] reveal_type(AR_LIKE_O - AR_i) # E: Any -reveal_type(AR_f - AR_LIKE_b) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_f - AR_LIKE_u) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_f - AR_LIKE_i) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_f - AR_LIKE_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_f - AR_LIKE_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] +reveal_type(AR_f - AR_LIKE_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_f - AR_LIKE_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_f - AR_LIKE_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_f - AR_LIKE_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_f - AR_LIKE_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] reveal_type(AR_f - AR_LIKE_O) # E: Any -reveal_type(AR_LIKE_b - AR_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_LIKE_u - AR_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_LIKE_i - AR_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_LIKE_f - AR_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_LIKE_c - AR_f) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] +reveal_type(AR_LIKE_b - AR_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_LIKE_u - AR_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_LIKE_i - AR_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_LIKE_f - AR_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_LIKE_c - AR_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] reveal_type(AR_LIKE_O - AR_f) # E: Any -reveal_type(AR_c - AR_LIKE_b) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_c - AR_LIKE_u) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_c - AR_LIKE_i) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_c - AR_LIKE_f) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_c - AR_LIKE_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] +reveal_type(AR_c - AR_LIKE_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_c - AR_LIKE_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_c - AR_LIKE_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_c - AR_LIKE_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_c - AR_LIKE_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] reveal_type(AR_c - AR_LIKE_O) # E: Any -reveal_type(AR_LIKE_b - AR_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_LIKE_u - AR_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_LIKE_i - AR_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_LIKE_f - AR_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_LIKE_c - AR_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] +reveal_type(AR_LIKE_b - AR_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_LIKE_u - AR_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_LIKE_i - AR_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_LIKE_f - AR_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_LIKE_c - AR_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] reveal_type(AR_LIKE_O - AR_c) # E: Any -reveal_type(AR_m - AR_LIKE_b) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] -reveal_type(AR_m - AR_LIKE_u) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] -reveal_type(AR_m - AR_LIKE_i) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] -reveal_type(AR_m - AR_LIKE_m) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] +reveal_type(AR_m - AR_LIKE_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] +reveal_type(AR_m - AR_LIKE_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] +reveal_type(AR_m - AR_LIKE_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] +reveal_type(AR_m - AR_LIKE_m) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] reveal_type(AR_m - AR_LIKE_O) # E: Any -reveal_type(AR_LIKE_b - AR_m) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] -reveal_type(AR_LIKE_u - AR_m) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] -reveal_type(AR_LIKE_i - AR_m) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] -reveal_type(AR_LIKE_m - AR_m) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] -reveal_type(AR_LIKE_M - AR_m) # E: Union[numpy.datetime64, numpy.ndarray[Any, numpy.dtype[numpy.datetime64]]] +reveal_type(AR_LIKE_b - AR_m) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] +reveal_type(AR_LIKE_u - AR_m) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] +reveal_type(AR_LIKE_i - AR_m) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] +reveal_type(AR_LIKE_m - AR_m) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] +reveal_type(AR_LIKE_M - AR_m) # E: numpy.ndarray[Any, numpy.dtype[numpy.datetime64]] reveal_type(AR_LIKE_O - AR_m) # E: Any -reveal_type(AR_M - AR_LIKE_b) # E: Union[numpy.datetime64, numpy.ndarray[Any, numpy.dtype[numpy.datetime64]]] -reveal_type(AR_M - AR_LIKE_u) # E: Union[numpy.datetime64, numpy.ndarray[Any, numpy.dtype[numpy.datetime64]]] -reveal_type(AR_M - AR_LIKE_i) # E: Union[numpy.datetime64, numpy.ndarray[Any, numpy.dtype[numpy.datetime64]]] -reveal_type(AR_M - AR_LIKE_m) # E: Union[numpy.datetime64, numpy.ndarray[Any, numpy.dtype[numpy.datetime64]]] -reveal_type(AR_M - AR_LIKE_M) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] +reveal_type(AR_M - AR_LIKE_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.datetime64]] +reveal_type(AR_M - AR_LIKE_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.datetime64]] +reveal_type(AR_M - AR_LIKE_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.datetime64]] +reveal_type(AR_M - AR_LIKE_m) # E: numpy.ndarray[Any, numpy.dtype[numpy.datetime64]] +reveal_type(AR_M - AR_LIKE_M) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] reveal_type(AR_M - AR_LIKE_O) # E: Any -reveal_type(AR_LIKE_M - AR_M) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] +reveal_type(AR_LIKE_M - AR_M) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] reveal_type(AR_LIKE_O - AR_M) # E: Any reveal_type(AR_O - AR_LIKE_b) # E: Any @@ -165,86 +165,86 @@ reveal_type(AR_LIKE_O - AR_O) # E: Any # Array floor division -reveal_type(AR_b // AR_LIKE_b) # E: Union[{int8}, numpy.ndarray[Any, numpy.dtype[{int8}]]] -reveal_type(AR_b // AR_LIKE_u) # E: Union[numpy.unsignedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]] -reveal_type(AR_b // AR_LIKE_i) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_b // AR_LIKE_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_b // AR_LIKE_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] +reveal_type(AR_b // AR_LIKE_b) # E: numpy.ndarray[Any, numpy.dtype[{int8}]] +reveal_type(AR_b // AR_LIKE_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]] +reveal_type(AR_b // AR_LIKE_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_b // AR_LIKE_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_b // AR_LIKE_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] reveal_type(AR_b // AR_LIKE_O) # E: Any -reveal_type(AR_LIKE_b // AR_b) # E: Union[{int8}, numpy.ndarray[Any, numpy.dtype[{int8}]]] -reveal_type(AR_LIKE_u // AR_b) # E: Union[numpy.unsignedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]] -reveal_type(AR_LIKE_i // AR_b) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_LIKE_f // AR_b) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_LIKE_c // AR_b) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] +reveal_type(AR_LIKE_b // AR_b) # E: numpy.ndarray[Any, numpy.dtype[{int8}]] +reveal_type(AR_LIKE_u // AR_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]] +reveal_type(AR_LIKE_i // AR_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_LIKE_f // AR_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_LIKE_c // AR_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] reveal_type(AR_LIKE_O // AR_b) # E: Any -reveal_type(AR_u // AR_LIKE_b) # E: Union[numpy.unsignedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]] -reveal_type(AR_u // AR_LIKE_u) # E: Union[numpy.unsignedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]] -reveal_type(AR_u // AR_LIKE_i) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_u // AR_LIKE_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_u // AR_LIKE_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] +reveal_type(AR_u // AR_LIKE_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]] +reveal_type(AR_u // AR_LIKE_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]] +reveal_type(AR_u // AR_LIKE_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_u // AR_LIKE_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_u // AR_LIKE_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] reveal_type(AR_u // AR_LIKE_O) # E: Any -reveal_type(AR_LIKE_b // AR_u) # E: Union[numpy.unsignedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]] -reveal_type(AR_LIKE_u // AR_u) # E: Union[numpy.unsignedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]]] -reveal_type(AR_LIKE_i // AR_u) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_LIKE_f // AR_u) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_LIKE_c // AR_u) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_LIKE_m // AR_u) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] +reveal_type(AR_LIKE_b // AR_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]] +reveal_type(AR_LIKE_u // AR_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]] +reveal_type(AR_LIKE_i // AR_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_LIKE_f // AR_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_LIKE_c // AR_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_LIKE_m // AR_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] reveal_type(AR_LIKE_O // AR_u) # E: Any -reveal_type(AR_i // AR_LIKE_b) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_i // AR_LIKE_u) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_i // AR_LIKE_i) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_i // AR_LIKE_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_i // AR_LIKE_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] +reveal_type(AR_i // AR_LIKE_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_i // AR_LIKE_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_i // AR_LIKE_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_i // AR_LIKE_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_i // AR_LIKE_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] reveal_type(AR_i // AR_LIKE_O) # E: Any -reveal_type(AR_LIKE_b // AR_i) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_LIKE_u // AR_i) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_LIKE_i // AR_i) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] -reveal_type(AR_LIKE_f // AR_i) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_LIKE_c // AR_i) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_LIKE_m // AR_i) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] +reveal_type(AR_LIKE_b // AR_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_LIKE_u // AR_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_LIKE_i // AR_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] +reveal_type(AR_LIKE_f // AR_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_LIKE_c // AR_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_LIKE_m // AR_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] reveal_type(AR_LIKE_O // AR_i) # E: Any -reveal_type(AR_f // AR_LIKE_b) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_f // AR_LIKE_u) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_f // AR_LIKE_i) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_f // AR_LIKE_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_f // AR_LIKE_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] +reveal_type(AR_f // AR_LIKE_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_f // AR_LIKE_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_f // AR_LIKE_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_f // AR_LIKE_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_f // AR_LIKE_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] reveal_type(AR_f // AR_LIKE_O) # E: Any -reveal_type(AR_LIKE_b // AR_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_LIKE_u // AR_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_LIKE_i // AR_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_LIKE_f // AR_f) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(AR_LIKE_c // AR_f) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_LIKE_m // AR_f) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] +reveal_type(AR_LIKE_b // AR_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_LIKE_u // AR_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_LIKE_i // AR_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_LIKE_f // AR_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(AR_LIKE_c // AR_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_LIKE_m // AR_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] reveal_type(AR_LIKE_O // AR_f) # E: Any -reveal_type(AR_c // AR_LIKE_b) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_c // AR_LIKE_u) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_c // AR_LIKE_i) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_c // AR_LIKE_f) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_c // AR_LIKE_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] +reveal_type(AR_c // AR_LIKE_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_c // AR_LIKE_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_c // AR_LIKE_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_c // AR_LIKE_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_c // AR_LIKE_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] reveal_type(AR_c // AR_LIKE_O) # E: Any -reveal_type(AR_LIKE_b // AR_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_LIKE_u // AR_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_LIKE_i // AR_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_LIKE_f // AR_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] -reveal_type(AR_LIKE_c // AR_c) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]] +reveal_type(AR_LIKE_b // AR_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_LIKE_u // AR_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_LIKE_i // AR_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_LIKE_f // AR_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(AR_LIKE_c // AR_c) # E: numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] reveal_type(AR_LIKE_O // AR_c) # E: Any -reveal_type(AR_m // AR_LIKE_u) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] -reveal_type(AR_m // AR_LIKE_i) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] -reveal_type(AR_m // AR_LIKE_f) # E: Union[numpy.timedelta64, numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] -reveal_type(AR_m // AR_LIKE_m) # E: Union[{int64}, numpy.ndarray[Any, numpy.dtype[{int64}]]] +reveal_type(AR_m // AR_LIKE_u) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] +reveal_type(AR_m // AR_LIKE_i) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] +reveal_type(AR_m // AR_LIKE_f) # E: numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]] +reveal_type(AR_m // AR_LIKE_m) # E: numpy.ndarray[Any, numpy.dtype[{int64}]] reveal_type(AR_m // AR_LIKE_O) # E: Any -reveal_type(AR_LIKE_m // AR_m) # E: Union[{int64}, numpy.ndarray[Any, numpy.dtype[{int64}]]] +reveal_type(AR_LIKE_m // AR_m) # E: numpy.ndarray[Any, numpy.dtype[{int64}]] reveal_type(AR_LIKE_O // AR_m) # E: Any reveal_type(AR_O // AR_LIKE_b) # E: Any @@ -472,9 +472,9 @@ reveal_type(AR_f + f4) # E: Any # Int reveal_type(i8 + i8) # E: {int64} -reveal_type(i8 + u8) # E: Union[numpy.signedinteger[Any], {float64}] +reveal_type(i8 + u8) # E: Any reveal_type(i8 + i4) # E: {int64} -reveal_type(i8 + u4) # E: Union[numpy.signedinteger[Any], {float64}] +reveal_type(i8 + u4) # E: Any reveal_type(i8 + b_) # E: {int64} reveal_type(i8 + b) # E: {int64} reveal_type(i8 + c) # E: {complex128} @@ -483,19 +483,19 @@ reveal_type(i8 + i) # E: {int64} reveal_type(i8 + AR_f) # E: Any reveal_type(u8 + u8) # E: {uint64} -reveal_type(u8 + i4) # E: Union[numpy.signedinteger[Any], {float64}] +reveal_type(u8 + i4) # E: Any reveal_type(u8 + u4) # E: {uint64} reveal_type(u8 + b_) # E: {uint64} reveal_type(u8 + b) # E: {uint64} reveal_type(u8 + c) # E: {complex128} reveal_type(u8 + f) # E: {float64} -reveal_type(u8 + i) # E: Union[numpy.signedinteger[Any], {float64}] +reveal_type(u8 + i) # E: Any reveal_type(u8 + AR_f) # E: Any reveal_type(i8 + i8) # E: {int64} -reveal_type(u8 + i8) # E: Union[numpy.signedinteger[Any], {float64}] +reveal_type(u8 + i8) # E: Any reveal_type(i4 + i8) # E: {int64} -reveal_type(u4 + i8) # E: Union[numpy.signedinteger[Any], {float64}] +reveal_type(u4 + i8) # E: Any reveal_type(b_ + i8) # E: {int64} reveal_type(b + i8) # E: {int64} reveal_type(c + i8) # E: {complex128} @@ -504,13 +504,13 @@ reveal_type(i + i8) # E: {int64} reveal_type(AR_f + i8) # E: Any reveal_type(u8 + u8) # E: {uint64} -reveal_type(i4 + u8) # E: Union[numpy.signedinteger[Any], {float64}] +reveal_type(i4 + u8) # E: Any reveal_type(u4 + u8) # E: {uint64} reveal_type(b_ + u8) # E: {uint64} reveal_type(b + u8) # E: {uint64} reveal_type(c + u8) # E: {complex128} reveal_type(f + u8) # E: {float64} -reveal_type(i + u8) # E: Union[numpy.signedinteger[Any], {float64}] +reveal_type(i + u8) # E: Any reveal_type(AR_f + u8) # E: Any reveal_type(i4 + i8) # E: {int64} @@ -520,11 +520,11 @@ reveal_type(i4 + b_) # E: {int32} reveal_type(i4 + b) # E: {int32} reveal_type(i4 + AR_f) # E: Any -reveal_type(u4 + i8) # E: Union[numpy.signedinteger[Any], {float64}] -reveal_type(u4 + i4) # E: Union[numpy.signedinteger[Any], {float64}] +reveal_type(u4 + i8) # E: Any +reveal_type(u4 + i4) # E: Any reveal_type(u4 + u8) # E: {uint64} reveal_type(u4 + u4) # E: {uint32} -reveal_type(u4 + i) # E: Union[numpy.signedinteger[Any], {float64}] +reveal_type(u4 + i) # E: Any reveal_type(u4 + b_) # E: {uint32} reveal_type(u4 + b) # E: {uint32} reveal_type(u4 + AR_f) # E: Any @@ -536,11 +536,11 @@ reveal_type(b_ + i4) # E: {int32} reveal_type(b + i4) # E: {int32} reveal_type(AR_f + i4) # E: Any -reveal_type(i8 + u4) # E: Union[numpy.signedinteger[Any], {float64}] -reveal_type(i4 + u4) # E: Union[numpy.signedinteger[Any], {float64}] +reveal_type(i8 + u4) # E: Any +reveal_type(i4 + u4) # E: Any reveal_type(u8 + u4) # E: {uint64} reveal_type(u4 + u4) # E: {uint32} reveal_type(b_ + u4) # E: {uint32} reveal_type(b + u4) # E: {uint32} -reveal_type(i + u4) # E: Union[numpy.signedinteger[Any], {float64}] +reveal_type(i + u4) # E: Any reveal_type(AR_f + u4) # E: Any diff --git a/numpy/typing/tests/data/reveal/array_constructors.py b/numpy/typing/tests/data/reveal/array_constructors.py index 04d5cd229..2e803a365 100644 --- a/numpy/typing/tests/data/reveal/array_constructors.py +++ b/numpy/typing/tests/data/reveal/array_constructors.py @@ -41,7 +41,7 @@ reveal_type(np.require(B, requirements="A")) # E: SubClass reveal_type(np.require(C)) # E: numpy.ndarray[Any, Any] reveal_type(np.linspace(0, 10)) # E: numpy.ndarray[Any, Any] -reveal_type(np.linspace(0, 10, retstep=True)) # E: Tuple[numpy.ndarray[Any, Any], numpy.inexact[Any]] +reveal_type(np.linspace(0, 10, retstep=True)) # E: Tuple[numpy.ndarray[Any, Any], Any] reveal_type(np.logspace(0, 10)) # E: numpy.ndarray[Any, Any] reveal_type(np.geomspace(1, 10)) # E: numpy.ndarray[Any, Any] diff --git a/numpy/typing/tests/data/reveal/comparisons.py b/numpy/typing/tests/data/reveal/comparisons.py index 5053a9e82..16f21cc39 100644 --- a/numpy/typing/tests/data/reveal/comparisons.py +++ b/numpy/typing/tests/data/reveal/comparisons.py @@ -34,12 +34,12 @@ reveal_type(td > i) # E: numpy.bool_ reveal_type(td > i4) # E: numpy.bool_ reveal_type(td > i8) # E: numpy.bool_ -reveal_type(td > AR) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(td > SEQ) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(AR > SEQ) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(AR > td) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(SEQ > td) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(SEQ > AR) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(td > AR) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(td > SEQ) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(AR > SEQ) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(AR > td) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(SEQ > td) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(SEQ > AR) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] # boolean @@ -56,8 +56,8 @@ reveal_type(b_ > f4) # E: numpy.bool_ reveal_type(b_ > c) # E: numpy.bool_ reveal_type(b_ > c16) # E: numpy.bool_ reveal_type(b_ > c8) # E: numpy.bool_ -reveal_type(b_ > AR) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(b_ > SEQ) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(b_ > AR) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(b_ > SEQ) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] # Complex @@ -72,8 +72,8 @@ reveal_type(c16 > b) # E: numpy.bool_ reveal_type(c16 > c) # E: numpy.bool_ reveal_type(c16 > f) # E: numpy.bool_ reveal_type(c16 > i) # E: numpy.bool_ -reveal_type(c16 > AR) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(c16 > SEQ) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(c16 > AR) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(c16 > SEQ) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] reveal_type(c16 > c16) # E: numpy.bool_ reveal_type(f8 > c16) # E: numpy.bool_ @@ -86,8 +86,8 @@ reveal_type(b > c16) # E: numpy.bool_ reveal_type(c > c16) # E: numpy.bool_ reveal_type(f > c16) # E: numpy.bool_ reveal_type(i > c16) # E: numpy.bool_ -reveal_type(AR > c16) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(SEQ > c16) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(AR > c16) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(SEQ > c16) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] reveal_type(c8 > c16) # E: numpy.bool_ reveal_type(c8 > f8) # E: numpy.bool_ @@ -100,8 +100,8 @@ reveal_type(c8 > b) # E: numpy.bool_ reveal_type(c8 > c) # E: numpy.bool_ reveal_type(c8 > f) # E: numpy.bool_ reveal_type(c8 > i) # E: numpy.bool_ -reveal_type(c8 > AR) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(c8 > SEQ) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(c8 > AR) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(c8 > SEQ) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] reveal_type(c16 > c8) # E: numpy.bool_ reveal_type(f8 > c8) # E: numpy.bool_ @@ -114,8 +114,8 @@ reveal_type(b > c8) # E: numpy.bool_ reveal_type(c > c8) # E: numpy.bool_ reveal_type(f > c8) # E: numpy.bool_ reveal_type(i > c8) # E: numpy.bool_ -reveal_type(AR > c8) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(SEQ > c8) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(AR > c8) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(SEQ > c8) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] # Float @@ -128,8 +128,8 @@ reveal_type(f8 > b) # E: numpy.bool_ reveal_type(f8 > c) # E: numpy.bool_ reveal_type(f8 > f) # E: numpy.bool_ reveal_type(f8 > i) # E: numpy.bool_ -reveal_type(f8 > AR) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(f8 > SEQ) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(f8 > AR) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(f8 > SEQ) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] reveal_type(f8 > f8) # E: numpy.bool_ reveal_type(i8 > f8) # E: numpy.bool_ @@ -140,8 +140,8 @@ reveal_type(b > f8) # E: numpy.bool_ reveal_type(c > f8) # E: numpy.bool_ reveal_type(f > f8) # E: numpy.bool_ reveal_type(i > f8) # E: numpy.bool_ -reveal_type(AR > f8) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(SEQ > f8) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(AR > f8) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(SEQ > f8) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] reveal_type(f4 > f8) # E: numpy.bool_ reveal_type(f4 > i8) # E: numpy.bool_ @@ -152,8 +152,8 @@ reveal_type(f4 > b) # E: numpy.bool_ reveal_type(f4 > c) # E: numpy.bool_ reveal_type(f4 > f) # E: numpy.bool_ reveal_type(f4 > i) # E: numpy.bool_ -reveal_type(f4 > AR) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(f4 > SEQ) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(f4 > AR) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(f4 > SEQ) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] reveal_type(f8 > f4) # E: numpy.bool_ reveal_type(i8 > f4) # E: numpy.bool_ @@ -164,8 +164,8 @@ reveal_type(b > f4) # E: numpy.bool_ reveal_type(c > f4) # E: numpy.bool_ reveal_type(f > f4) # E: numpy.bool_ reveal_type(i > f4) # E: numpy.bool_ -reveal_type(AR > f4) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(SEQ > f4) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(AR > f4) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(SEQ > f4) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] # Int @@ -178,8 +178,8 @@ reveal_type(i8 > b) # E: numpy.bool_ reveal_type(i8 > c) # E: numpy.bool_ reveal_type(i8 > f) # E: numpy.bool_ reveal_type(i8 > i) # E: numpy.bool_ -reveal_type(i8 > AR) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(i8 > SEQ) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(i8 > AR) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(i8 > SEQ) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] reveal_type(u8 > u8) # E: numpy.bool_ reveal_type(u8 > i4) # E: numpy.bool_ @@ -189,8 +189,8 @@ reveal_type(u8 > b) # E: numpy.bool_ reveal_type(u8 > c) # E: numpy.bool_ reveal_type(u8 > f) # E: numpy.bool_ reveal_type(u8 > i) # E: numpy.bool_ -reveal_type(u8 > AR) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(u8 > SEQ) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(u8 > AR) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(u8 > SEQ) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] reveal_type(i8 > i8) # E: numpy.bool_ reveal_type(u8 > i8) # E: numpy.bool_ @@ -201,8 +201,8 @@ reveal_type(b > i8) # E: numpy.bool_ reveal_type(c > i8) # E: numpy.bool_ reveal_type(f > i8) # E: numpy.bool_ reveal_type(i > i8) # E: numpy.bool_ -reveal_type(AR > i8) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(SEQ > i8) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(AR > i8) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(SEQ > i8) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] reveal_type(u8 > u8) # E: numpy.bool_ reveal_type(i4 > u8) # E: numpy.bool_ @@ -212,16 +212,16 @@ reveal_type(b > u8) # E: numpy.bool_ reveal_type(c > u8) # E: numpy.bool_ reveal_type(f > u8) # E: numpy.bool_ reveal_type(i > u8) # E: numpy.bool_ -reveal_type(AR > u8) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(SEQ > u8) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(AR > u8) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(SEQ > u8) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] reveal_type(i4 > i8) # E: numpy.bool_ reveal_type(i4 > i4) # E: numpy.bool_ reveal_type(i4 > i) # E: numpy.bool_ reveal_type(i4 > b_) # E: numpy.bool_ reveal_type(i4 > b) # E: numpy.bool_ -reveal_type(i4 > AR) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(i4 > SEQ) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(i4 > AR) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(i4 > SEQ) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] reveal_type(u4 > i8) # E: numpy.bool_ reveal_type(u4 > i4) # E: numpy.bool_ @@ -230,16 +230,16 @@ reveal_type(u4 > u4) # E: numpy.bool_ reveal_type(u4 > i) # E: numpy.bool_ reveal_type(u4 > b_) # E: numpy.bool_ reveal_type(u4 > b) # E: numpy.bool_ -reveal_type(u4 > AR) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(u4 > SEQ) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(u4 > AR) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(u4 > SEQ) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] reveal_type(i8 > i4) # E: numpy.bool_ reveal_type(i4 > i4) # E: numpy.bool_ reveal_type(i > i4) # E: numpy.bool_ reveal_type(b_ > i4) # E: numpy.bool_ reveal_type(b > i4) # E: numpy.bool_ -reveal_type(AR > i4) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(SEQ > i4) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(AR > i4) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(SEQ > i4) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] reveal_type(i8 > u4) # E: numpy.bool_ reveal_type(i4 > u4) # E: numpy.bool_ @@ -248,5 +248,5 @@ reveal_type(u4 > u4) # E: numpy.bool_ reveal_type(b_ > u4) # E: numpy.bool_ reveal_type(b > u4) # E: numpy.bool_ reveal_type(i > u4) # E: numpy.bool_ -reveal_type(AR > u4) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(SEQ > u4) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(AR > u4) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(SEQ > u4) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] diff --git a/numpy/typing/tests/data/reveal/einsumfunc.py b/numpy/typing/tests/data/reveal/einsumfunc.py index 18c192b0b..f1a90428d 100644 --- a/numpy/typing/tests/data/reveal/einsumfunc.py +++ b/numpy/typing/tests/data/reveal/einsumfunc.py @@ -10,17 +10,17 @@ AR_LIKE_U: List[str] OUT_f: np.ndarray[Any, np.dtype[np.float64]] -reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_b)) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]] -reveal_type(np.einsum("i,i->i", AR_LIKE_u, AR_LIKE_u)) # E: Union[numpy.unsignedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.unsignedinteger[Any]]] -reveal_type(np.einsum("i,i->i", AR_LIKE_i, AR_LIKE_i)) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] -reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f)) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] -reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c)) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] -reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_i)) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] -reveal_type(np.einsum("i,i,i,i->i", AR_LIKE_b, AR_LIKE_u, AR_LIKE_i, AR_LIKE_c)) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_b)) # E: Any +reveal_type(np.einsum("i,i->i", AR_LIKE_u, AR_LIKE_u)) # E: Any +reveal_type(np.einsum("i,i->i", AR_LIKE_i, AR_LIKE_i)) # E: Any +reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f)) # E: Any +reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c)) # E: Any +reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_i)) # E: Any +reveal_type(np.einsum("i,i,i,i->i", AR_LIKE_b, AR_LIKE_u, AR_LIKE_i, AR_LIKE_c)) # E: Any reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c, out=OUT_f)) # E: numpy.ndarray[Any, numpy.dtype[{float64}] reveal_type(np.einsum("i,i->i", AR_LIKE_U, AR_LIKE_U, dtype=bool, casting="unsafe", out=OUT_f)) # E: numpy.ndarray[Any, numpy.dtype[{float64}] -reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f, dtype="c16")) # E: Union[numpy.complexfloating[Any, Any], numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]] +reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f, dtype="c16")) # E: Any reveal_type(np.einsum("i,i->i", AR_LIKE_U, AR_LIKE_U, dtype=bool, casting="unsafe")) # E: Any reveal_type(np.einsum_path("i,i->i", AR_LIKE_b, AR_LIKE_b)) # E: Tuple[builtins.list[Any], builtins.str] diff --git a/numpy/typing/tests/data/reveal/fromnumeric.py b/numpy/typing/tests/data/reveal/fromnumeric.py index 2b58f019f..bbcfbb85a 100644 --- a/numpy/typing/tests/data/reveal/fromnumeric.py +++ b/numpy/typing/tests/data/reveal/fromnumeric.py @@ -12,27 +12,13 @@ b = np.float32(1.0) c = 1.0 d = np.array(1.0, dtype=np.float32) # writeable -reveal_type(np.take(a, 0)) # E: numpy.bool_ -reveal_type(np.take(b, 0)) # E: {float32} -reveal_type( - np.take(c, 0) # E: Union[numpy.generic, datetime.datetime, datetime.timedelta] -) -reveal_type( - np.take(A, 0) # E: Union[numpy.generic, datetime.datetime, datetime.timedelta] -) -reveal_type( - np.take(B, 0) # E: Union[numpy.generic, datetime.datetime, datetime.timedelta] -) -reveal_type( - np.take( # E: Union[Union[numpy.generic, datetime.datetime, datetime.timedelta], numpy.ndarray[Any, Any]] - A, [0] - ) -) -reveal_type( - np.take( # E: Union[Union[numpy.generic, datetime.datetime, datetime.timedelta], numpy.ndarray[Any, Any]] - B, [0] - ) -) +reveal_type(np.take(a, 0)) # E: Any +reveal_type(np.take(b, 0)) # E: Any +reveal_type(np.take(c, 0)) # E: Any +reveal_type(np.take(A, 0)) # E: Any +reveal_type(np.take(B, 0)) # E: Any +reveal_type(np.take(A, [0])) # E: Any +reveal_type(np.take(B, [0])) # E: Any reveal_type(np.reshape(a, 1)) # E: numpy.ndarray[Any, Any] reveal_type(np.reshape(b, 1)) # E: numpy.ndarray[Any, Any] @@ -40,8 +26,8 @@ reveal_type(np.reshape(c, 1)) # E: numpy.ndarray[Any, Any] reveal_type(np.reshape(A, 1)) # E: numpy.ndarray[Any, Any] reveal_type(np.reshape(B, 1)) # E: numpy.ndarray[Any, Any] -reveal_type(np.choose(a, [True, True])) # E: numpy.bool_ -reveal_type(np.choose(A, [True, True])) # E: numpy.ndarray[Any, Any] +reveal_type(np.choose(a, [True, True])) # E: Any +reveal_type(np.choose(A, [True, True])) # E: Any reveal_type(np.repeat(a, 1)) # E: numpy.ndarray[Any, Any] reveal_type(np.repeat(b, 1)) # E: numpy.ndarray[Any, Any] @@ -66,11 +52,11 @@ reveal_type(np.partition(c, 0, axis=None)) # E: numpy.ndarray[Any, Any] reveal_type(np.partition(A, 0)) # E: numpy.ndarray[Any, Any] reveal_type(np.partition(B, 0)) # E: numpy.ndarray[Any, Any] -reveal_type(np.argpartition(a, 0)) # E: {intp} -reveal_type(np.argpartition(b, 0)) # E: {intp} -reveal_type(np.argpartition(c, 0)) # E: numpy.ndarray[Any, Any] -reveal_type(np.argpartition(A, 0)) # E: numpy.ndarray[Any, Any] -reveal_type(np.argpartition(B, 0)) # E: numpy.ndarray[Any, Any] +reveal_type(np.argpartition(a, 0)) # E: Any +reveal_type(np.argpartition(b, 0)) # E: Any +reveal_type(np.argpartition(c, 0)) # E: Any +reveal_type(np.argpartition(A, 0)) # E: Any +reveal_type(np.argpartition(B, 0)) # E: Any reveal_type(np.sort(A, 0)) # E: numpy.ndarray[Any, Any] reveal_type(np.sort(B, 0)) # E: numpy.ndarray[Any, Any] @@ -80,13 +66,13 @@ reveal_type(np.argsort(B, 0)) # E: numpy.ndarray[Any, Any] reveal_type(np.argmax(A)) # E: {intp} reveal_type(np.argmax(B)) # E: {intp} -reveal_type(np.argmax(A, axis=0)) # E: Union[numpy.ndarray[Any, Any], {intp}] -reveal_type(np.argmax(B, axis=0)) # E: Union[numpy.ndarray[Any, Any], {intp}] +reveal_type(np.argmax(A, axis=0)) # E: Any +reveal_type(np.argmax(B, axis=0)) # E: Any reveal_type(np.argmin(A)) # E: {intp} reveal_type(np.argmin(B)) # E: {intp} -reveal_type(np.argmin(A, axis=0)) # E: Union[numpy.ndarray[Any, Any], {intp}] -reveal_type(np.argmin(B, axis=0)) # E: Union[numpy.ndarray[Any, Any], {intp}] +reveal_type(np.argmin(A, axis=0)) # E: Any +reveal_type(np.argmin(B, axis=0)) # E: Any reveal_type(np.searchsorted(A[0], 0)) # E: {intp} reveal_type(np.searchsorted(B[0], 0)) # E: {intp} @@ -108,8 +94,8 @@ reveal_type(np.squeeze(B)) # E: numpy.ndarray[Any, Any] reveal_type(np.diagonal(A)) # E: numpy.ndarray[Any, Any] reveal_type(np.diagonal(B)) # E: numpy.ndarray[Any, Any] -reveal_type(np.trace(A)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.trace(B)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] +reveal_type(np.trace(A)) # E: Any +reveal_type(np.trace(B)) # E: Any reveal_type(np.ravel(a)) # E: numpy.ndarray[Any, Any] reveal_type(np.ravel(b)) # E: numpy.ndarray[Any, Any] @@ -135,39 +121,39 @@ reveal_type(np.compress([True], c)) # E: numpy.ndarray[Any, Any] reveal_type(np.compress([True], A)) # E: numpy.ndarray[Any, Any] reveal_type(np.compress([True], B)) # E: numpy.ndarray[Any, Any] -reveal_type(np.clip(a, 0, 1.0)) # E: numpy.number[Any] -reveal_type(np.clip(b, -1, 1)) # E: {float32} -reveal_type(np.clip(c, 0, 1)) # E: numpy.number[Any] -reveal_type(np.clip(A, 0, 1)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.clip(B, 0, 1)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] +reveal_type(np.clip(a, 0, 1.0)) # E: Any +reveal_type(np.clip(b, -1, 1)) # E: Any +reveal_type(np.clip(c, 0, 1)) # E: Any +reveal_type(np.clip(A, 0, 1)) # E: Any +reveal_type(np.clip(B, 0, 1)) # E: Any -reveal_type(np.sum(a)) # E: numpy.number[Any] -reveal_type(np.sum(b)) # E: {float32} -reveal_type(np.sum(c)) # E: numpy.number[Any] -reveal_type(np.sum(A)) # E: numpy.number[Any] -reveal_type(np.sum(B)) # E: numpy.number[Any] -reveal_type(np.sum(A, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.sum(B, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] +reveal_type(np.sum(a)) # E: Any +reveal_type(np.sum(b)) # E: Any +reveal_type(np.sum(c)) # E: Any +reveal_type(np.sum(A)) # E: Any +reveal_type(np.sum(B)) # E: Any +reveal_type(np.sum(A, axis=0)) # E: Any +reveal_type(np.sum(B, axis=0)) # E: Any reveal_type(np.all(a)) # E: numpy.bool_ reveal_type(np.all(b)) # E: numpy.bool_ reveal_type(np.all(c)) # E: numpy.bool_ reveal_type(np.all(A)) # E: numpy.bool_ reveal_type(np.all(B)) # E: numpy.bool_ -reveal_type(np.all(A, axis=0)) # E: Union[numpy.bool_, numpy.ndarray[Any, Any]] -reveal_type(np.all(B, axis=0)) # E: Union[numpy.bool_, numpy.ndarray[Any, Any]] -reveal_type(np.all(A, keepdims=True)) # E: Union[numpy.bool_, numpy.ndarray[Any, Any]] -reveal_type(np.all(B, keepdims=True)) # E: Union[numpy.bool_, numpy.ndarray[Any, Any]] +reveal_type(np.all(A, axis=0)) # E: Any +reveal_type(np.all(B, axis=0)) # E: Any +reveal_type(np.all(A, keepdims=True)) # E: Any +reveal_type(np.all(B, keepdims=True)) # E: Any reveal_type(np.any(a)) # E: numpy.bool_ reveal_type(np.any(b)) # E: numpy.bool_ reveal_type(np.any(c)) # E: numpy.bool_ reveal_type(np.any(A)) # E: numpy.bool_ reveal_type(np.any(B)) # E: numpy.bool_ -reveal_type(np.any(A, axis=0)) # E: Union[numpy.bool_, numpy.ndarray[Any, Any]] -reveal_type(np.any(B, axis=0)) # E: Union[numpy.bool_, numpy.ndarray[Any, Any]] -reveal_type(np.any(A, keepdims=True)) # E: Union[numpy.bool_, numpy.ndarray[Any, Any]] -reveal_type(np.any(B, keepdims=True)) # E: Union[numpy.bool_, numpy.ndarray[Any, Any]] +reveal_type(np.any(A, axis=0)) # E: Any +reveal_type(np.any(B, axis=0)) # E: Any +reveal_type(np.any(A, keepdims=True)) # E: Any +reveal_type(np.any(B, keepdims=True)) # E: Any reveal_type(np.cumsum(a)) # E: numpy.ndarray[Any, Any] reveal_type(np.cumsum(b)) # E: numpy.ndarray[Any, Any] @@ -175,47 +161,47 @@ reveal_type(np.cumsum(c)) # E: numpy.ndarray[Any, Any] reveal_type(np.cumsum(A)) # E: numpy.ndarray[Any, Any] reveal_type(np.cumsum(B)) # E: numpy.ndarray[Any, Any] -reveal_type(np.ptp(a)) # E: numpy.number[Any] -reveal_type(np.ptp(b)) # E: {float32} -reveal_type(np.ptp(c)) # E: numpy.number[Any] -reveal_type(np.ptp(A)) # E: numpy.number[Any] -reveal_type(np.ptp(B)) # E: numpy.number[Any] -reveal_type(np.ptp(A, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.ptp(B, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.ptp(A, keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.ptp(B, keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] - -reveal_type(np.amax(a)) # E: numpy.number[Any] -reveal_type(np.amax(b)) # E: {float32} -reveal_type(np.amax(c)) # E: numpy.number[Any] -reveal_type(np.amax(A)) # E: numpy.number[Any] -reveal_type(np.amax(B)) # E: numpy.number[Any] -reveal_type(np.amax(A, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.amax(B, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.amax(A, keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.amax(B, keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] - -reveal_type(np.amin(a)) # E: numpy.number[Any] -reveal_type(np.amin(b)) # E: {float32} -reveal_type(np.amin(c)) # E: numpy.number[Any] -reveal_type(np.amin(A)) # E: numpy.number[Any] -reveal_type(np.amin(B)) # E: numpy.number[Any] -reveal_type(np.amin(A, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.amin(B, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.amin(A, keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.amin(B, keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] - -reveal_type(np.prod(a)) # E: numpy.number[Any] -reveal_type(np.prod(b)) # E: {float32} -reveal_type(np.prod(c)) # E: numpy.number[Any] -reveal_type(np.prod(A)) # E: numpy.number[Any] -reveal_type(np.prod(B)) # E: numpy.number[Any] -reveal_type(np.prod(A, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.prod(B, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.prod(A, keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.prod(B, keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.prod(b, out=d)) # E: numpy.ndarray[Any, Any] -reveal_type(np.prod(B, out=d)) # E: numpy.ndarray[Any, Any] +reveal_type(np.ptp(a)) # E: Any +reveal_type(np.ptp(b)) # E: Any +reveal_type(np.ptp(c)) # E: Any +reveal_type(np.ptp(A)) # E: Any +reveal_type(np.ptp(B)) # E: Any +reveal_type(np.ptp(A, axis=0)) # E: Any +reveal_type(np.ptp(B, axis=0)) # E: Any +reveal_type(np.ptp(A, keepdims=True)) # E: Any +reveal_type(np.ptp(B, keepdims=True)) # E: Any + +reveal_type(np.amax(a)) # E: Any +reveal_type(np.amax(b)) # E: Any +reveal_type(np.amax(c)) # E: Any +reveal_type(np.amax(A)) # E: Any +reveal_type(np.amax(B)) # E: Any +reveal_type(np.amax(A, axis=0)) # E: Any +reveal_type(np.amax(B, axis=0)) # E: Any +reveal_type(np.amax(A, keepdims=True)) # E: Any +reveal_type(np.amax(B, keepdims=True)) # E: Any + +reveal_type(np.amin(a)) # E: Any +reveal_type(np.amin(b)) # E: Any +reveal_type(np.amin(c)) # E: Any +reveal_type(np.amin(A)) # E: Any +reveal_type(np.amin(B)) # E: Any +reveal_type(np.amin(A, axis=0)) # E: Any +reveal_type(np.amin(B, axis=0)) # E: Any +reveal_type(np.amin(A, keepdims=True)) # E: Any +reveal_type(np.amin(B, keepdims=True)) # E: Any + +reveal_type(np.prod(a)) # E: Any +reveal_type(np.prod(b)) # E: Any +reveal_type(np.prod(c)) # E: Any +reveal_type(np.prod(A)) # E: Any +reveal_type(np.prod(B)) # E: Any +reveal_type(np.prod(A, axis=0)) # E: Any +reveal_type(np.prod(B, axis=0)) # E: Any +reveal_type(np.prod(A, keepdims=True)) # E: Any +reveal_type(np.prod(B, keepdims=True)) # E: Any +reveal_type(np.prod(b, out=d)) # E: Any +reveal_type(np.prod(B, out=d)) # E: Any reveal_type(np.cumprod(a)) # E: numpy.ndarray[Any, Any] reveal_type(np.cumprod(b)) # E: numpy.ndarray[Any, Any] @@ -235,44 +221,44 @@ reveal_type(np.size(c)) # E: int reveal_type(np.size(A)) # E: int reveal_type(np.size(B)) # E: int -reveal_type(np.around(a)) # E: numpy.number[Any] -reveal_type(np.around(b)) # E: {float32} -reveal_type(np.around(c)) # E: numpy.number[Any] -reveal_type(np.around(A)) # E: numpy.ndarray[Any, Any] -reveal_type(np.around(B)) # E: numpy.ndarray[Any, Any] - -reveal_type(np.mean(a)) # E: numpy.number[Any] -reveal_type(np.mean(b)) # E: numpy.number[Any] -reveal_type(np.mean(c)) # E: numpy.number[Any] -reveal_type(np.mean(A)) # E: numpy.number[Any] -reveal_type(np.mean(B)) # E: numpy.number[Any] -reveal_type(np.mean(A, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.mean(B, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.mean(A, keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.mean(B, keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.mean(b, out=d)) # E: numpy.ndarray[Any, Any] -reveal_type(np.mean(B, out=d)) # E: numpy.ndarray[Any, Any] - -reveal_type(np.std(a)) # E: numpy.number[Any] -reveal_type(np.std(b)) # E: numpy.number[Any] -reveal_type(np.std(c)) # E: numpy.number[Any] -reveal_type(np.std(A)) # E: numpy.number[Any] -reveal_type(np.std(B)) # E: numpy.number[Any] -reveal_type(np.std(A, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.std(B, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.std(A, keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.std(B, keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.std(b, out=d)) # E: numpy.ndarray[Any, Any] -reveal_type(np.std(B, out=d)) # E: numpy.ndarray[Any, Any] - -reveal_type(np.var(a)) # E: numpy.number[Any] -reveal_type(np.var(b)) # E: numpy.number[Any] -reveal_type(np.var(c)) # E: numpy.number[Any] -reveal_type(np.var(A)) # E: numpy.number[Any] -reveal_type(np.var(B)) # E: numpy.number[Any] -reveal_type(np.var(A, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.var(B, axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.var(A, keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.var(B, keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(np.var(b, out=d)) # E: numpy.ndarray[Any, Any] -reveal_type(np.var(B, out=d)) # E: numpy.ndarray[Any, Any] +reveal_type(np.around(a)) # E: Any +reveal_type(np.around(b)) # E: Any +reveal_type(np.around(c)) # E: Any +reveal_type(np.around(A)) # E: Any +reveal_type(np.around(B)) # E: Any + +reveal_type(np.mean(a)) # E: Any +reveal_type(np.mean(b)) # E: Any +reveal_type(np.mean(c)) # E: Any +reveal_type(np.mean(A)) # E: Any +reveal_type(np.mean(B)) # E: Any +reveal_type(np.mean(A, axis=0)) # E: Any +reveal_type(np.mean(B, axis=0)) # E: Any +reveal_type(np.mean(A, keepdims=True)) # E: Any +reveal_type(np.mean(B, keepdims=True)) # E: Any +reveal_type(np.mean(b, out=d)) # E: Any +reveal_type(np.mean(B, out=d)) # E: Any + +reveal_type(np.std(a)) # E: Any +reveal_type(np.std(b)) # E: Any +reveal_type(np.std(c)) # E: Any +reveal_type(np.std(A)) # E: Any +reveal_type(np.std(B)) # E: Any +reveal_type(np.std(A, axis=0)) # E: Any +reveal_type(np.std(B, axis=0)) # E: Any +reveal_type(np.std(A, keepdims=True)) # E: Any +reveal_type(np.std(B, keepdims=True)) # E: Any +reveal_type(np.std(b, out=d)) # E: Any +reveal_type(np.std(B, out=d)) # E: Any + +reveal_type(np.var(a)) # E: Any +reveal_type(np.var(b)) # E: Any +reveal_type(np.var(c)) # E: Any +reveal_type(np.var(A)) # E: Any +reveal_type(np.var(B)) # E: Any +reveal_type(np.var(A, axis=0)) # E: Any +reveal_type(np.var(B, axis=0)) # E: Any +reveal_type(np.var(A, keepdims=True)) # E: Any +reveal_type(np.var(B, keepdims=True)) # E: Any +reveal_type(np.var(b, out=d)) # E: Any +reveal_type(np.var(B, out=d)) # E: Any diff --git a/numpy/typing/tests/data/reveal/index_tricks.py b/numpy/typing/tests/data/reveal/index_tricks.py index ec2013025..863d60220 100644 --- a/numpy/typing/tests/data/reveal/index_tricks.py +++ b/numpy/typing/tests/data/reveal/index_tricks.py @@ -27,15 +27,16 @@ reveal_type(iter(np.ndenumerate(AR_LIKE_U))) # E: Iterator[Tuple[builtins.tuple reveal_type(iter(np.ndindex(1, 2, 3))) # E: Iterator[builtins.tuple[builtins.int]] reveal_type(next(np.ndindex(1, 2, 3))) # E: builtins.tuple[builtins.int] -reveal_type(np.unravel_index([22, 41, 37], (7, 6))) # E: tuple[Union[{intp}, numpy.ndarray[Any, numpy.dtype[{intp}]]]] -reveal_type(np.unravel_index([31, 41, 13], (7, 6), order="F")) # E: tuple[Union[{intp}, numpy.ndarray[Any, numpy.dtype[{intp}]]]] -reveal_type(np.unravel_index(1621, (6, 7, 8, 9))) # E: tuple[Union[{intp}, numpy.ndarray[Any, numpy.dtype[{intp}]]]] - -reveal_type(np.ravel_multi_index(AR_LIKE_i, (7, 6))) # E: Union[{intp}, numpy.ndarray[Any, numpy.dtype[{intp}]]] -reveal_type(np.ravel_multi_index(AR_LIKE_i, (7, 6), order="F")) # E: Union[{intp}, numpy.ndarray[Any, numpy.dtype[{intp}]]] -reveal_type(np.ravel_multi_index(AR_LIKE_i, (4, 6), mode="clip")) # E: Union[{intp}, numpy.ndarray[Any, numpy.dtype[{intp}]]] -reveal_type(np.ravel_multi_index(AR_LIKE_i, (4, 4), mode=("clip", "wrap"))) # E: Union[{intp}, numpy.ndarray[Any, numpy.dtype[{intp}]]] -reveal_type(np.ravel_multi_index((3, 1, 4, 1), (6, 7, 8, 9))) # E: Union[{intp}, numpy.ndarray[Any, numpy.dtype[{intp}]]] +reveal_type(np.unravel_index([22, 41, 37], (7, 6))) # E: tuple[numpy.ndarray[Any, numpy.dtype[{intp}]]] +reveal_type(np.unravel_index([31, 41, 13], (7, 6), order="F")) # E: tuple[numpy.ndarray[Any, numpy.dtype[{intp}]]] +reveal_type(np.unravel_index(1621, (6, 7, 8, 9))) # E: tuple[{intp}] + +reveal_type(np.ravel_multi_index([[1]], (7, 6))) # E: numpy.ndarray[Any, numpy.dtype[{intp}]] +reveal_type(np.ravel_multi_index(AR_LIKE_i, (7, 6))) # E: {intp} +reveal_type(np.ravel_multi_index(AR_LIKE_i, (7, 6), order="F")) # E: {intp} +reveal_type(np.ravel_multi_index(AR_LIKE_i, (4, 6), mode="clip")) # E: {intp} +reveal_type(np.ravel_multi_index(AR_LIKE_i, (4, 4), mode=("clip", "wrap"))) # E: {intp} +reveal_type(np.ravel_multi_index((3, 1, 4, 1), (6, 7, 8, 9))) # E: {intp} reveal_type(np.mgrid[1:1:2]) # E: numpy.ndarray[Any, numpy.dtype[Any]] reveal_type(np.mgrid[1:1:2, None:10]) # E: numpy.ndarray[Any, numpy.dtype[Any]] diff --git a/numpy/typing/tests/data/reveal/lib_utils.py b/numpy/typing/tests/data/reveal/lib_utils.py new file mode 100644 index 000000000..d82012707 --- /dev/null +++ b/numpy/typing/tests/data/reveal/lib_utils.py @@ -0,0 +1,30 @@ +from io import StringIO +from typing import Any, Dict + +import numpy as np + +AR: np.ndarray[Any, np.dtype[np.float64]] +AR_DICT: Dict[str, np.ndarray[Any, np.dtype[np.float64]]] +FILE: StringIO + +def func(a: int) -> bool: ... + +reveal_type(np.deprecate(func)) # E: def (a: builtins.int) -> builtins.bool +reveal_type(np.deprecate()) # E: _Deprecate + +reveal_type(np.deprecate_with_doc("test")) # E: _Deprecate +reveal_type(np.deprecate_with_doc(None)) # E: _Deprecate + +reveal_type(np.byte_bounds(AR)) # E: Tuple[builtins.int, builtins.int] +reveal_type(np.byte_bounds(np.float64())) # E: Tuple[builtins.int, builtins.int] + +reveal_type(np.who(None)) # E: None +reveal_type(np.who(AR_DICT)) # E: None + +reveal_type(np.info(1, output=FILE)) # E: None + +reveal_type(np.source(np.interp, output=FILE)) # E: None + +reveal_type(np.lookfor("binary representation", output=FILE)) # E: None + +reveal_type(np.safe_eval("1 + 1")) # E: Any diff --git a/numpy/typing/tests/data/reveal/mod.py b/numpy/typing/tests/data/reveal/mod.py index 4a913f11a..bf45b8c58 100644 --- a/numpy/typing/tests/data/reveal/mod.py +++ b/numpy/typing/tests/data/reveal/mod.py @@ -26,8 +26,8 @@ reveal_type(AR_m % td) # E: Any reveal_type(td % AR_m) # E: Any reveal_type(divmod(td, td)) # E: Tuple[{int64}, numpy.timedelta64] -reveal_type(divmod(AR_m, td)) # E: Union[Tuple[numpy.signedinteger[numpy.typing._64Bit], numpy.timedelta64], Tuple[numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[numpy.typing._64Bit]]], numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]]] -reveal_type(divmod(td, AR_m)) # E: Union[Tuple[numpy.signedinteger[numpy.typing._64Bit], numpy.timedelta64], Tuple[numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[numpy.typing._64Bit]]], numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]]] +reveal_type(divmod(AR_m, td)) # E: Tuple[numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[numpy.typing._64Bit]]], numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] +reveal_type(divmod(td, AR_m)) # E: Tuple[numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[numpy.typing._64Bit]]], numpy.ndarray[Any, numpy.dtype[numpy.timedelta64]]] # Bool @@ -38,7 +38,7 @@ reveal_type(b_ % b_) # E: {int8} reveal_type(b_ % i8) # E: {int64} reveal_type(b_ % u8) # E: {uint64} reveal_type(b_ % f8) # E: {float64} -reveal_type(b_ % AR_b) # E: Union[{int8}, numpy.ndarray[Any, numpy.dtype[{int8}]]] +reveal_type(b_ % AR_b) # E: numpy.ndarray[Any, numpy.dtype[{int8}]] reveal_type(divmod(b_, b)) # E: Tuple[{int8}, {int8}] reveal_type(divmod(b_, i)) # E: Tuple[{int_}, {int_}] @@ -47,7 +47,7 @@ reveal_type(divmod(b_, b_)) # E: Tuple[{int8}, {int8}] reveal_type(divmod(b_, i8)) # E: Tuple[{int64}, {int64}] reveal_type(divmod(b_, u8)) # E: Tuple[{uint64}, {uint64}] reveal_type(divmod(b_, f8)) # E: Tuple[{float64}, {float64}] -reveal_type(divmod(b_, AR_b)) # E: Tuple[Union[{int8}, numpy.ndarray[Any, numpy.dtype[{int8}]]], Union[{int8}, numpy.ndarray[Any, numpy.dtype[{int8}]]]] +reveal_type(divmod(b_, AR_b)) # E: numpy.ndarray[Any, numpy.dtype[{int8}]], numpy.ndarray[Any, numpy.dtype[{int8}]]] reveal_type(b % b_) # E: {int8} reveal_type(i % b_) # E: {int_} @@ -56,7 +56,7 @@ reveal_type(b_ % b_) # E: {int8} reveal_type(i8 % b_) # E: {int64} reveal_type(u8 % b_) # E: {uint64} reveal_type(f8 % b_) # E: {float64} -reveal_type(AR_b % b_) # E: Union[{int8}, numpy.ndarray[Any, numpy.dtype[{int8}]]] +reveal_type(AR_b % b_) # E: numpy.ndarray[Any, numpy.dtype[{int8}]] reveal_type(divmod(b, b_)) # E: Tuple[{int8}, {int8}] reveal_type(divmod(i, b_)) # E: Tuple[{int_}, {int_}] @@ -65,7 +65,7 @@ reveal_type(divmod(b_, b_)) # E: Tuple[{int8}, {int8}] reveal_type(divmod(i8, b_)) # E: Tuple[{int64}, {int64}] reveal_type(divmod(u8, b_)) # E: Tuple[{uint64}, {uint64}] reveal_type(divmod(f8, b_)) # E: Tuple[{float64}, {float64}] -reveal_type(divmod(AR_b, b_)) # E: Tuple[Union[{int8}, numpy.ndarray[Any, numpy.dtype[{int8}]]], Union[{int8}, numpy.ndarray[Any, numpy.dtype[{int8}]]]] +reveal_type(divmod(AR_b, b_)) # E: numpy.ndarray[Any, numpy.dtype[{int8}]], numpy.ndarray[Any, numpy.dtype[{int8}]]] # int @@ -78,7 +78,7 @@ reveal_type(i4 % i8) # E: {int64} reveal_type(i4 % f8) # E: {float64} reveal_type(i4 % i4) # E: {int32} reveal_type(i4 % f4) # E: {float32} -reveal_type(i8 % AR_b) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] +reveal_type(i8 % AR_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] reveal_type(divmod(i8, b)) # E: Tuple[{int64}, {int64}] reveal_type(divmod(i8, i)) # E: Tuple[{int64}, {int64}] @@ -89,7 +89,7 @@ reveal_type(divmod(i8, i4)) # E: Tuple[{int64}, {int64}] reveal_type(divmod(i8, f4)) # E: Tuple[{float64}, {float64}] reveal_type(divmod(i4, i4)) # E: Tuple[{int32}, {int32}] reveal_type(divmod(i4, f4)) # E: Tuple[{float32}, {float32}] -reveal_type(divmod(i8, AR_b)) # E: Tuple[Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]], Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]]] +reveal_type(divmod(i8, AR_b)) # E: Tuple[numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] reveal_type(b % i8) # E: {int64} reveal_type(i % i8) # E: {int64} @@ -100,7 +100,7 @@ reveal_type(i8 % i4) # E: {int64} reveal_type(f8 % i4) # E: {float64} reveal_type(i4 % i4) # E: {int32} reveal_type(f4 % i4) # E: {float32} -reveal_type(AR_b % i8) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] +reveal_type(AR_b % i8) # E: numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]] reveal_type(divmod(b, i8)) # E: Tuple[{int64}, {int64}] reveal_type(divmod(i, i8)) # E: Tuple[{int64}, {int64}] @@ -111,7 +111,7 @@ reveal_type(divmod(i4, i8)) # E: Tuple[{int64}, {int64}] reveal_type(divmod(f4, i8)) # E: Tuple[{float64}, {float64}] reveal_type(divmod(i4, i4)) # E: Tuple[{int32}, {int32}] reveal_type(divmod(f4, i4)) # E: Tuple[{float32}, {float32}] -reveal_type(divmod(AR_b, i8)) # E: Tuple[Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]], Union[numpy.signedinteger[Any], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]]] +reveal_type(divmod(AR_b, i8)) # E: Tuple[numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]], numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]] # float @@ -120,7 +120,7 @@ reveal_type(f8 % i) # E: {float64} reveal_type(f8 % f) # E: {float64} reveal_type(i8 % f4) # E: {float64} reveal_type(f4 % f4) # E: {float32} -reveal_type(f8 % AR_b) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] +reveal_type(f8 % AR_b) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] reveal_type(divmod(f8, b)) # E: Tuple[{float64}, {float64}] reveal_type(divmod(f8, i)) # E: Tuple[{float64}, {float64}] @@ -128,7 +128,7 @@ reveal_type(divmod(f8, f)) # E: Tuple[{float64}, {float64}] reveal_type(divmod(f8, f8)) # E: Tuple[{float64}, {float64}] reveal_type(divmod(f8, f4)) # E: Tuple[{float64}, {float64}] reveal_type(divmod(f4, f4)) # E: Tuple[{float32}, {float32}] -reveal_type(divmod(f8, AR_b)) # E: Tuple[Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]], Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]]] +reveal_type(divmod(f8, AR_b)) # E: Tuple[numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] reveal_type(b % f8) # E: {float64} reveal_type(i % f8) # E: {float64} @@ -136,7 +136,7 @@ reveal_type(f % f8) # E: {float64} reveal_type(f8 % f8) # E: {float64} reveal_type(f8 % f8) # E: {float64} reveal_type(f4 % f4) # E: {float32} -reveal_type(AR_b % f8) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] +reveal_type(AR_b % f8) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] reveal_type(divmod(b, f8)) # E: Tuple[{float64}, {float64}] reveal_type(divmod(i, f8)) # E: Tuple[{float64}, {float64}] @@ -144,4 +144,4 @@ reveal_type(divmod(f, f8)) # E: Tuple[{float64}, {float64}] reveal_type(divmod(f8, f8)) # E: Tuple[{float64}, {float64}] reveal_type(divmod(f4, f8)) # E: Tuple[{float64}, {float64}] reveal_type(divmod(f4, f4)) # E: Tuple[{float32}, {float32}] -reveal_type(divmod(AR_b, f8)) # E: Tuple[Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]], Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]]] +reveal_type(divmod(AR_b, f8)) # E: Tuple[numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] diff --git a/numpy/typing/tests/data/reveal/ndarray_misc.py b/numpy/typing/tests/data/reveal/ndarray_misc.py index 0f7345358..e0f44bcbc 100644 --- a/numpy/typing/tests/data/reveal/ndarray_misc.py +++ b/numpy/typing/tests/data/reveal/ndarray_misc.py @@ -16,24 +16,24 @@ B: SubClass reveal_type(f8.all()) # E: numpy.bool_ reveal_type(A.all()) # E: numpy.bool_ -reveal_type(A.all(axis=0)) # E: Union[numpy.bool_, numpy.ndarray[Any, Any]] -reveal_type(A.all(keepdims=True)) # E: Union[numpy.bool_, numpy.ndarray[Any, Any]] +reveal_type(A.all(axis=0)) # E: Any +reveal_type(A.all(keepdims=True)) # E: Any reveal_type(A.all(out=B)) # E: SubClass reveal_type(f8.any()) # E: numpy.bool_ reveal_type(A.any()) # E: numpy.bool_ -reveal_type(A.any(axis=0)) # E: Union[numpy.bool_, numpy.ndarray[Any, Any]] -reveal_type(A.any(keepdims=True)) # E: Union[numpy.bool_, numpy.ndarray[Any, Any]] +reveal_type(A.any(axis=0)) # E: Any +reveal_type(A.any(keepdims=True)) # E: Any reveal_type(A.any(out=B)) # E: SubClass reveal_type(f8.argmax()) # E: {intp} reveal_type(A.argmax()) # E: {intp} -reveal_type(A.argmax(axis=0)) # E: Union[numpy.ndarray[Any, Any], {intp}] +reveal_type(A.argmax(axis=0)) # E: Any reveal_type(A.argmax(out=B)) # E: SubClass reveal_type(f8.argmin()) # E: {intp} reveal_type(A.argmin()) # E: {intp} -reveal_type(A.argmin(axis=0)) # E: Union[numpy.ndarray[Any, Any], {intp}] +reveal_type(A.argmin(axis=0)) # E: Any reveal_type(A.argmin(out=B)) # E: SubClass reveal_type(f8.argsort()) # E: numpy.ndarray[Any, Any] @@ -43,9 +43,9 @@ reveal_type(f8.astype(np.int64).choose([()])) # E: numpy.ndarray[Any, Any] reveal_type(A.choose([0])) # E: numpy.ndarray[Any, Any] reveal_type(A.choose([0], out=B)) # E: SubClass -reveal_type(f8.clip(1)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(A.clip(1)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(A.clip(None, 1)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] +reveal_type(f8.clip(1)) # E: Any +reveal_type(A.clip(1)) # E: Any +reveal_type(A.clip(None, 1)) # E: Any reveal_type(A.clip(1, out=B)) # E: SubClass reveal_type(A.clip(None, 1, out=B)) # E: SubClass @@ -69,38 +69,38 @@ reveal_type(f8.cumsum()) # E: numpy.ndarray[Any, Any] reveal_type(A.cumsum()) # E: numpy.ndarray[Any, Any] reveal_type(A.cumsum(out=B)) # E: SubClass -reveal_type(f8.max()) # E: numpy.number[Any] -reveal_type(A.max()) # E: numpy.number[Any] -reveal_type(A.max(axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(A.max(keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] +reveal_type(f8.max()) # E: Any +reveal_type(A.max()) # E: Any +reveal_type(A.max(axis=0)) # E: Any +reveal_type(A.max(keepdims=True)) # E: Any reveal_type(A.max(out=B)) # E: SubClass -reveal_type(f8.mean()) # E: numpy.number[Any] -reveal_type(A.mean()) # E: numpy.number[Any] -reveal_type(A.mean(axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(A.mean(keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] +reveal_type(f8.mean()) # E: Any +reveal_type(A.mean()) # E: Any +reveal_type(A.mean(axis=0)) # E: Any +reveal_type(A.mean(keepdims=True)) # E: Any reveal_type(A.mean(out=B)) # E: SubClass -reveal_type(f8.min()) # E: numpy.number[Any] -reveal_type(A.min()) # E: numpy.number[Any] -reveal_type(A.min(axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(A.min(keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] +reveal_type(f8.min()) # E: Any +reveal_type(A.min()) # E: Any +reveal_type(A.min(axis=0)) # E: Any +reveal_type(A.min(keepdims=True)) # E: Any reveal_type(A.min(out=B)) # E: SubClass reveal_type(f8.newbyteorder()) # E: {float64} reveal_type(A.newbyteorder()) # E: numpy.ndarray[Any, Any] reveal_type(B.newbyteorder('|')) # E: SubClass -reveal_type(f8.prod()) # E: numpy.number[Any] -reveal_type(A.prod()) # E: numpy.number[Any] -reveal_type(A.prod(axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(A.prod(keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] +reveal_type(f8.prod()) # E: Any +reveal_type(A.prod()) # E: Any +reveal_type(A.prod(axis=0)) # E: Any +reveal_type(A.prod(keepdims=True)) # E: Any reveal_type(A.prod(out=B)) # E: SubClass -reveal_type(f8.ptp()) # E: numpy.number[Any] -reveal_type(A.ptp()) # E: numpy.number[Any] -reveal_type(A.ptp(axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(A.ptp(keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] +reveal_type(f8.ptp()) # E: Any +reveal_type(A.ptp()) # E: Any +reveal_type(A.ptp(axis=0)) # E: Any +reveal_type(A.ptp(keepdims=True)) # E: Any reveal_type(A.ptp(out=B)) # E: SubClass reveal_type(f8.round()) # E: {float64} @@ -111,40 +111,40 @@ reveal_type(f8.repeat(1)) # E: numpy.ndarray[Any, Any] reveal_type(A.repeat(1)) # E: numpy.ndarray[Any, Any] reveal_type(B.repeat(1)) # E: numpy.ndarray[Any, Any] -reveal_type(f8.std()) # E: numpy.number[Any] -reveal_type(A.std()) # E: numpy.number[Any] -reveal_type(A.std(axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(A.std(keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] +reveal_type(f8.std()) # E: Any +reveal_type(A.std()) # E: Any +reveal_type(A.std(axis=0)) # E: Any +reveal_type(A.std(keepdims=True)) # E: Any reveal_type(A.std(out=B)) # E: SubClass -reveal_type(f8.sum()) # E: numpy.number[Any] -reveal_type(A.sum()) # E: numpy.number[Any] -reveal_type(A.sum(axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(A.sum(keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] +reveal_type(f8.sum()) # E: Any +reveal_type(A.sum()) # E: Any +reveal_type(A.sum(axis=0)) # E: Any +reveal_type(A.sum(keepdims=True)) # E: Any reveal_type(A.sum(out=B)) # E: SubClass -reveal_type(f8.take(0)) # E: numpy.generic -reveal_type(A.take(0)) # E: numpy.generic +reveal_type(f8.take(0)) # E: Any +reveal_type(A.take(0)) # E: Any reveal_type(A.take([0])) # E: numpy.ndarray[Any, Any] reveal_type(A.take(0, out=B)) # E: SubClass reveal_type(A.take([0], out=B)) # E: SubClass -reveal_type(f8.var()) # E: numpy.number[Any] -reveal_type(A.var()) # E: numpy.number[Any] -reveal_type(A.var(axis=0)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] -reveal_type(A.var(keepdims=True)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] +reveal_type(f8.var()) # E: Any +reveal_type(A.var()) # E: Any +reveal_type(A.var(axis=0)) # E: Any +reveal_type(A.var(keepdims=True)) # E: Any reveal_type(A.var(out=B)) # E: SubClass reveal_type(A.argpartition([0])) # E: numpy.ndarray[Any, Any] reveal_type(A.diagonal()) # E: numpy.ndarray[Any, Any] -reveal_type(A.dot(1)) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] +reveal_type(A.dot(1)) # E: Any reveal_type(A.dot(1, out=B)) # E: SubClass reveal_type(A.nonzero()) # E: tuple[numpy.ndarray[Any, Any]] reveal_type(A.searchsorted([1])) # E: numpy.ndarray[Any, Any] -reveal_type(A.trace()) # E: Union[numpy.number[Any], numpy.ndarray[Any, Any]] +reveal_type(A.trace()) # E: Any reveal_type(A.trace(out=B)) # E: SubClass diff --git a/numpy/typing/tests/data/reveal/numeric.py b/numpy/typing/tests/data/reveal/numeric.py index 78e5c1d61..ec6e47ca0 100644 --- a/numpy/typing/tests/data/reveal/numeric.py +++ b/numpy/typing/tests/data/reveal/numeric.py @@ -20,8 +20,8 @@ C: SubClass reveal_type(np.count_nonzero(i8)) # E: int reveal_type(np.count_nonzero(A)) # E: int reveal_type(np.count_nonzero(B)) # E: int -reveal_type(np.count_nonzero(A, keepdims=True)) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, Any]] -reveal_type(np.count_nonzero(A, axis=0)) # E: Union[numpy.signedinteger[Any], numpy.ndarray[Any, Any]] +reveal_type(np.count_nonzero(A, keepdims=True)) # E: Any +reveal_type(np.count_nonzero(A, axis=0)) # E: Any reveal_type(np.isfortran(i8)) # E: bool reveal_type(np.isfortran(A)) # E: bool @@ -76,9 +76,9 @@ reveal_type(np.allclose(i8, A)) # E: bool reveal_type(np.allclose(B, A)) # E: bool reveal_type(np.allclose(A, A)) # E: bool -reveal_type(np.isclose(i8, A)) # E: Union[numpy.bool_, numpy.ndarray[Any, Any]] -reveal_type(np.isclose(B, A)) # E: Union[numpy.bool_, numpy.ndarray[Any, Any]] -reveal_type(np.isclose(A, A)) # E: Union[numpy.bool_, numpy.ndarray[Any, Any]] +reveal_type(np.isclose(i8, A)) # E: Any +reveal_type(np.isclose(B, A)) # E: Any +reveal_type(np.isclose(A, A)) # E: Any reveal_type(np.array_equal(i8, A)) # E: bool reveal_type(np.array_equal(B, A)) # E: bool diff --git a/numpy/typing/tests/data/reveal/ufunclike.py b/numpy/typing/tests/data/reveal/ufunclike.py index 35e45a824..8b3aea7ce 100644 --- a/numpy/typing/tests/data/reveal/ufunclike.py +++ b/numpy/typing/tests/data/reveal/ufunclike.py @@ -9,21 +9,21 @@ AR_LIKE_O: List[np.object_] AR_U: np.ndarray[Any, np.dtype[np.str_]] -reveal_type(np.fix(AR_LIKE_b)) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(np.fix(AR_LIKE_u)) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(np.fix(AR_LIKE_i)) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] -reveal_type(np.fix(AR_LIKE_f)) # E: Union[numpy.floating[Any], numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]]] +reveal_type(np.fix(AR_LIKE_b)) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(np.fix(AR_LIKE_u)) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(np.fix(AR_LIKE_i)) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] +reveal_type(np.fix(AR_LIKE_f)) # E: numpy.ndarray[Any, numpy.dtype[numpy.floating[Any]]] reveal_type(np.fix(AR_LIKE_O)) # E: Any reveal_type(np.fix(AR_LIKE_f, out=AR_U)) # E: numpy.ndarray[Any, numpy.dtype[numpy.str_]] -reveal_type(np.isposinf(AR_LIKE_b)) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(np.isposinf(AR_LIKE_u)) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(np.isposinf(AR_LIKE_i)) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(np.isposinf(AR_LIKE_f)) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(np.isposinf(AR_LIKE_b)) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(np.isposinf(AR_LIKE_u)) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(np.isposinf(AR_LIKE_i)) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(np.isposinf(AR_LIKE_f)) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] reveal_type(np.isposinf(AR_LIKE_f, out=AR_U)) # E: numpy.ndarray[Any, numpy.dtype[numpy.str_]] -reveal_type(np.isneginf(AR_LIKE_b)) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(np.isneginf(AR_LIKE_u)) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(np.isneginf(AR_LIKE_i)) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] -reveal_type(np.isneginf(AR_LIKE_f)) # E: Union[numpy.bool_, numpy.ndarray[Any, numpy.dtype[numpy.bool_]]] +reveal_type(np.isneginf(AR_LIKE_b)) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(np.isneginf(AR_LIKE_u)) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(np.isneginf(AR_LIKE_i)) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] +reveal_type(np.isneginf(AR_LIKE_f)) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]] reveal_type(np.isneginf(AR_LIKE_f, out=AR_U)) # E: numpy.ndarray[Any, numpy.dtype[numpy.str_]] diff --git a/tools/changelog.py b/tools/changelog.py index 920f5b87f..9da330500 100755 --- a/tools/changelog.py +++ b/tools/changelog.py @@ -66,10 +66,14 @@ def get_authors(revision_range): pre = set(re.findall(pat, this_repo.git.shortlog('-s', lst_release), re.M)) - # Homu is the author of auto merges, clean him out. + # Ignore the bot Homu. cur.discard('Homu') pre.discard('Homu') + # Ignore the bot dependabot-preview + cur.discard('dependabot-preview') + pre.discard('dependabot-preview') + # Append '+' to new authors. authors = [s + u' +' for s in cur - pre] + [s for s in cur & pre] authors.sort() @@ -92,8 +96,8 @@ def get_pull_requests(repo, revision_range): # From fast forward squash-merges commits = this_repo.git.log( '--oneline', '--no-merges', '--first-parent', revision_range) - issues = re.findall(u'^.*\\(\\#(\\d+)\\)$', commits, re.M) - prnums.extend(int(s) for s in issues) + issues = re.findall(u'^.*\\((\\#|gh-|gh-\\#)(\\d+)\\)$', commits, re.M) + prnums.extend(int(s[1]) for s in issues) # get PR data from github repo prnums.sort() diff --git a/tools/lint_diff.ini b/tools/lint_diff.ini index ba091468e..3b66d3c3e 100644 --- a/tools/lint_diff.ini +++ b/tools/lint_diff.ini @@ -1,5 +1,4 @@ [pycodestyle] max_line_length = 79 statistics = True -ignore = E121,E122,E123,E125,E126,E127,E128,E226,E251,E265,E266,E302,E402,E712,E721,E731,E741,W291,W293,W391,W503,W504 -exclude = numpy/__config__.py +ignore = E121,E122,E123,E125,E126,E127,E128,E226,E251,E265,E266,E302,E402,E704,E712,E721,E731,E741,W291,W293,W391,W503,W504 diff --git a/tools/linter.py b/tools/linter.py index b1bab2b70..fd229dbef 100644 --- a/tools/linter.py +++ b/tools/linter.py @@ -9,6 +9,14 @@ CONFIG = os.path.join( 'lint_diff.ini', ) +# NOTE: The `diff` and `exclude` options of pycodestyle seem to be +# incompatible, so instead just exclude the necessary files when +# computing the diff itself. +EXCLUDE = ( + "numpy/typing/tests/data/", + "numpy/__config__.py", +) + class DiffLinter: def __init__(self, branch): @@ -29,11 +37,15 @@ class DiffLinter: print(f"Branch with name `{self.branch}` does not exist") sys.exit(1) + exclude = [f':(exclude){i}' for i in EXCLUDE] if uncommitted: - diff = self.repo.git.diff(self.head, '--unified=0', '***.py') + diff = self.repo.git.diff( + self.head, '--unified=0', '***.py', *exclude + ) else: - diff = self.repo.git.diff(commit, self.head, - '--unified=0', '***.py') + diff = self.repo.git.diff( + commit, self.head, '--unified=0', '***.py', *exclude + ) return diff def run_pycodestyle(self, diff): |