Python x64: +selenium 3.141 +opencv 4.1.1 ( The script f2py.exe is installed in 'C:\Abs\Archive\scopeSrcUL\OpenRPA\Resources\WPy64-3720\python-3.7.2.amd64\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.) +pytesseract 0.3.0 (The script pytesseract.exe is installed in 'C:\Abs\Archive\scopeSrcUL\OpenRPA\Resources\WPy64-3720\python-3.7.2.amd64\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed pytesseract-0.3.0)dev-linux
parent
f2dbe5174f
commit
355839a6b3
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016-2018 Olli-Pekka Heinisuo and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -0,0 +1,8 @@
|
||||
import importlib
|
||||
|
||||
from .cv2 import *
|
||||
from .data import *
|
||||
|
||||
# wildcard import above does not import "private" variables like __version__
|
||||
# this makes them available
|
||||
globals().update(importlib.import_module('cv2.cv2').__dict__)
|
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
import os
|
||||
|
||||
haarcascades = os.path.join(os.path.dirname(__file__), '')
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -0,0 +1 @@
|
||||
pip
|
@ -0,0 +1,27 @@
|
||||
The NumPy repository and source distributions bundle several libraries that are
|
||||
compatibly licensed. We list these here.
|
||||
|
||||
Name: Numpydoc
|
||||
Files: doc/sphinxext/numpydoc/*
|
||||
License: 2-clause BSD
|
||||
For details, see doc/sphinxext/LICENSE.txt
|
||||
|
||||
Name: scipy-sphinx-theme
|
||||
Files: doc/scipy-sphinx-theme/*
|
||||
License: 3-clause BSD, PSF and Apache 2.0
|
||||
For details, see doc/scipy-sphinx-theme/LICENSE.txt
|
||||
|
||||
Name: lapack-lite
|
||||
Files: numpy/linalg/lapack_lite/*
|
||||
License: 3-clause BSD
|
||||
For details, see numpy/linalg/lapack_lite/LICENSE.txt
|
||||
|
||||
Name: tempita
|
||||
Files: tools/npy_tempita/*
|
||||
License: BSD derived
|
||||
For details, see tools/npy_tempita/license.txt
|
||||
|
||||
Name: dragon4
|
||||
Files: numpy/core/src/multiarray/dragon4.c
|
||||
License: MIT
|
||||
For license text, see numpy/core/src/multiarray/dragon4.c
|
@ -0,0 +1,54 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: numpy
|
||||
Version: 1.17.2
|
||||
Summary: NumPy is the fundamental package for array computing with Python.
|
||||
Home-page: https://www.numpy.org
|
||||
Author: Travis E. Oliphant et al.
|
||||
Maintainer: NumPy Developers
|
||||
Maintainer-email: numpy-discussion@python.org
|
||||
License: BSD
|
||||
Download-URL: https://pypi.python.org/pypi/numpy
|
||||
Project-URL: Bug Tracker, https://github.com/numpy/numpy/issues
|
||||
Project-URL: Documentation, https://docs.scipy.org/doc/numpy/
|
||||
Project-URL: Source Code, https://github.com/numpy/numpy
|
||||
Platform: Windows
|
||||
Platform: Linux
|
||||
Platform: Solaris
|
||||
Platform: Mac OS-X
|
||||
Platform: Unix
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Intended Audience :: Science/Research
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved
|
||||
Classifier: Programming Language :: C
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.5
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: Programming Language :: Python :: Implementation :: CPython
|
||||
Classifier: Topic :: Software Development
|
||||
Classifier: Topic :: Scientific/Engineering
|
||||
Classifier: Operating System :: Microsoft :: Windows
|
||||
Classifier: Operating System :: POSIX
|
||||
Classifier: Operating System :: Unix
|
||||
Classifier: Operating System :: MacOS
|
||||
Requires-Python: >=3.5
|
||||
|
||||
It provides:
|
||||
|
||||
- a powerful N-dimensional array object
|
||||
- sophisticated (broadcasting) functions
|
||||
- tools for integrating C/C++ and Fortran code
|
||||
- useful linear algebra, Fourier transform, and random number capabilities
|
||||
- and much more
|
||||
|
||||
Besides its obvious scientific uses, NumPy can also be used as an efficient
|
||||
multi-dimensional container of generic data. Arbitrary data-types can be
|
||||
defined. This allows NumPy to seamlessly and speedily integrate with a wide
|
||||
variety of databases.
|
||||
|
||||
All NumPy wheels distributed on PyPI are BSD licensed.
|
||||
|
||||
|
||||
|
@ -0,0 +1,856 @@
|
||||
../../Scripts/f2py.exe,sha256=1bgbMhx4IDOCBKhoWkzQIdChbQmPEl7sMYCQwIcl1h8,102735
|
||||
numpy-1.17.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
numpy-1.17.2.dist-info/LICENSE.txt,sha256=m4e_tsjUKs6r5T8X8yplpzRTAwRS4vytymyIFmhYrtU,47843
|
||||
numpy-1.17.2.dist-info/LICENSES_bundled.txt,sha256=ydG_75MZCg1PsYBvcktxRNC4Vc0PcXEi1qn32OyorYo,765
|
||||
numpy-1.17.2.dist-info/METADATA,sha256=HUNI3z-5GBQWs37WI6FmJkQLEjaC7-GGmW7E4FdkDsI,1951
|
||||
numpy-1.17.2.dist-info/RECORD,,
|
||||
numpy-1.17.2.dist-info/WHEEL,sha256=uaZe_9gV-4T_d4AskuIQkCgcY8wMc0UXsVFnf0_mBGs,106
|
||||
numpy-1.17.2.dist-info/entry_points.txt,sha256=cOAXaHCx7qU-bvE9TStTTZW46RN-s-i6Mz9smnWkL3g,49
|
||||
numpy-1.17.2.dist-info/top_level.txt,sha256=4J9lbBMLnAiyxatxh8iRKV5Entd_6-oqbO7pzJjMsPw,6
|
||||
numpy/.libs/libopenblas.TXA6YQSD3GCQQC22GEQ54J2UDCXDXHWN.gfortran-win_amd64.dll,sha256=2UZw7rt25yg-jQuIMUTHEZ9PPSESZPjazlgQACo6nnA,33168680
|
||||
numpy/LICENSE.txt,sha256=m4e_tsjUKs6r5T8X8yplpzRTAwRS4vytymyIFmhYrtU,47843
|
||||
numpy/__config__.py,sha256=f63XAg_8cwJrO2dKUk5GkmQr4IH_0tXzrKOVFcbdbAY,1690
|
||||
numpy/__init__.py,sha256=6bqV6_Ot0ysgHlDh0mhaoowho85c5GC5OEtyZrScd9U,7110
|
||||
numpy/__pycache__/__config__.cpython-37.pyc,,
|
||||
numpy/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/__pycache__/_distributor_init.cpython-37.pyc,,
|
||||
numpy/__pycache__/_globals.cpython-37.pyc,,
|
||||
numpy/__pycache__/_pytesttester.cpython-37.pyc,,
|
||||
numpy/__pycache__/conftest.cpython-37.pyc,,
|
||||
numpy/__pycache__/ctypeslib.cpython-37.pyc,,
|
||||
numpy/__pycache__/dual.cpython-37.pyc,,
|
||||
numpy/__pycache__/matlib.cpython-37.pyc,,
|
||||
numpy/__pycache__/setup.cpython-37.pyc,,
|
||||
numpy/__pycache__/version.cpython-37.pyc,,
|
||||
numpy/_distributor_init.py,sha256=-QrivvN9p_D7K2xAIaCqcXpLpGYTlC_04WooaFHg9oU,1206
|
||||
numpy/_globals.py,sha256=p8xxERZsxjGPUWV9pMY3jz75NZxDLppGeKaHbYGCDqM,2379
|
||||
numpy/_pytesttester.py,sha256=eLWMwBiqamHoev8-VlmtvCaxV_gitqK7js-UkjUW4qs,6854
|
||||
numpy/compat/__init__.py,sha256=MHle4gJcrXh1w4SNv0mz5rbUTAjAzHnyO3rtbSW3AUo,498
|
||||
numpy/compat/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/compat/__pycache__/_inspect.cpython-37.pyc,,
|
||||
numpy/compat/__pycache__/py3k.cpython-37.pyc,,
|
||||
numpy/compat/__pycache__/setup.cpython-37.pyc,,
|
||||
numpy/compat/_inspect.py,sha256=xEImUFhm4VAzT2LJj2Va_yDAHJsdy0RwSi1JwOOhykU,7513
|
||||
numpy/compat/py3k.py,sha256=88l-ZO8zhg2YHR4eHv195lXtBhP_cMTeZoAz1ZihHMA,6760
|
||||
numpy/compat/setup.py,sha256=REJcwNU7EbfwBFS1FHazGJcUhh50_5gYttr3BSczCiM,382
|
||||
numpy/compat/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/compat/tests/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/compat/tests/__pycache__/test_compat.cpython-37.pyc,,
|
||||
numpy/compat/tests/test_compat.py,sha256=KtCVafV8yN5g90tIIe7T9f5ruAs5Y0DNa64d040Rx5s,542
|
||||
numpy/conftest.py,sha256=MQmihxXyjxbn1l9N97DFVewnN1PcFAnWoBO404unCw4,1912
|
||||
numpy/core/__init__.py,sha256=gLe7_8tyq6vWj9dADA_H2zOSomN2qTQyJk4uzJb8ock,4748
|
||||
numpy/core/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/_add_newdocs.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/_aliased_types.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/_asarray.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/_dtype.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/_dtype_ctypes.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/_exceptions.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/_internal.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/_methods.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/_string_helpers.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/_type_aliases.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/_ufunc_config.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/arrayprint.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/cversions.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/defchararray.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/einsumfunc.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/fromnumeric.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/function_base.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/generate_numpy_api.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/getlimits.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/info.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/machar.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/memmap.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/multiarray.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/numeric.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/numerictypes.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/overrides.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/records.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/setup.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/setup_common.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/shape_base.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/umath.cpython-37.pyc,,
|
||||
numpy/core/__pycache__/umath_tests.cpython-37.pyc,,
|
||||
numpy/core/_add_newdocs.py,sha256=BWqbE_Fcjhv9Yrymm5Hx63GSBvPJfIM5DNGse5wMO_g,201718
|
||||
numpy/core/_aliased_types.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/core/_asarray.py,sha256=NH0SPZr_pBMKOJgyy6dsfmKOQPy3r31hlzFG5bP1yYA,9940
|
||||
numpy/core/_dtype.py,sha256=rvaeOf-ypqhRrb4_Aljt2CXX6uZrX0STQ0pQwlXTKv4,9688
|
||||
numpy/core/_dtype_ctypes.py,sha256=EiTjqVsDSibpbS8pkvzres86E9er1aFaflsss9N3Uao,3448
|
||||
numpy/core/_dummy.cp37-win_amd64.pyd,sha256=3QsFef6O-7Hig2IHqQ01XZdDYFe-LEoqwc5QbJbposU,10752
|
||||
numpy/core/_exceptions.py,sha256=6D9-838kaHNNZmm4YPvUvSVJgBDI4i-hDjNK3klB_G4,4606
|
||||
numpy/core/_internal.py,sha256=0JNmERfEq9511atZWu691R8EfOgaDozIEg5Fmi3v8Sw,27276
|
||||
numpy/core/_methods.py,sha256=g8AnOnA3CdC4qe7s7N_pG3OcaW-YKhXmRz8FmLNnpG0,8399
|
||||
numpy/core/_multiarray_tests.cp37-win_amd64.pyd,sha256=fkIoos59UNeccDaY9ZvgxTxKm4dk1K_kyWa5fbVph5w,101376
|
||||
numpy/core/_multiarray_umath.cp37-win_amd64.pyd,sha256=eIJ8dhPllThPZ0dRf9R3q6bZ_45bcIk_lHWbC0soD3Y,2678784
|
||||
numpy/core/_operand_flag_tests.cp37-win_amd64.pyd,sha256=1VxbUtaRVoexeJ7YfhkEARknkBXGwFmWZhC_apqcW4s,13824
|
||||
numpy/core/_rational_tests.cp37-win_amd64.pyd,sha256=18UeSIfKA7-muJ5YlpJctJ9Te2yDtCUkQ27M_r0hqDM,49664
|
||||
numpy/core/_string_helpers.py,sha256=NGGGhaFdU5eGiUAj3GTIBoOgWs4r9aTNlsE2r9NgX6Q,2855
|
||||
numpy/core/_struct_ufunc_tests.cp37-win_amd64.pyd,sha256=btVzcHck_KCtRwVFWJkkbKpc6tovoRP3kK6Vt2RU8F0,14848
|
||||
numpy/core/_type_aliases.py,sha256=FA2Pz5OKqcLl1QKLJNu-ETHIzQ1ii3LH5pSdHhZkfZA,9181
|
||||
numpy/core/_ufunc_config.py,sha256=yQ9RSST7_TagO8EYDZG5g23gz7loX76a0ajCU5HfYRI,14219
|
||||
numpy/core/_umath_tests.cp37-win_amd64.pyd,sha256=OJiVCDJQETo5wAzTANH7iIV0YvCJuw3a-DCjkwdqH-k,25600
|
||||
numpy/core/arrayprint.py,sha256=frVidsGCv-8zQTSHqwnTb7kj22VARR2NyJdo9JhkW08,60821
|
||||
numpy/core/cversions.py,sha256=ukYNpkei0Coi7DOcbroXuDoXc6kl5odxmcy_39pszA0,413
|
||||
numpy/core/defchararray.py,sha256=ApbIeOAkz4ZRknfZ5DQxFVBczvJhPu6mkAER4-heGkU,70996
|
||||
numpy/core/einsumfunc.py,sha256=94J-3sQQWoCzYGwUlsEIHD6B3Qjv481XUD2jd0KClGY,51271
|
||||
numpy/core/fromnumeric.py,sha256=PwvGpsltvKqECUCRASno_GlrmcIHDg-2Vz4sRIHnp8s,115626
|
||||
numpy/core/function_base.py,sha256=n8APTXtdKVwu9Z4_u7zGAcl1b_w0lcf_A0jnN19M12Y,16624
|
||||
numpy/core/generate_numpy_api.py,sha256=0JBYTvekUeJyhp7QMKtWJSK-L6lVNhev16y0F2qX2pU,7470
|
||||
numpy/core/getlimits.py,sha256=X26A-6nrzC1FH1wtCggX-faIw0WMYYkPH1_983h4hCE,18914
|
||||
numpy/core/include/numpy/__multiarray_api.h,sha256=SNdhYA7CqkzbD_vSN128PemqdU_tb1e-En2iXXnH8hU,62652
|
||||
numpy/core/include/numpy/__ufunc_api.h,sha256=1iOWNLJOcFJRr5U2BL6rjxOUZE21_EYSYBJ1oSZRomE,12469
|
||||
numpy/core/include/numpy/_neighborhood_iterator_imp.h,sha256=hNiUJ3gmJRxdjByk5R5jmLeBKpNfaP_29KLHFuTrSIA,1861
|
||||
numpy/core/include/numpy/_numpyconfig.h,sha256=t8Nu7SsABLGlvsWq6fHPOrjNK07gGpTctueLWJup77g,891
|
||||
numpy/core/include/numpy/arrayobject.h,sha256=SXj-2avTHV8mNWvv7sOYHLKkRKcafDG7_HNpQNot1GE,164
|
||||
numpy/core/include/numpy/arrayscalars.h,sha256=vC7QCznlT8vkyvxbIh4QNwi1LR7UkP7GJ1j_0ZiJa1E,3509
|
||||
numpy/core/include/numpy/halffloat.h,sha256=ohvyl3Kz3mB1hW3MRzxwPDH-0L9WWM_eKhvYLjtT_2w,1878
|
||||
numpy/core/include/numpy/multiarray_api.txt,sha256=ctFSMBWK7Us3yJg-w6oDq366zMLmbWa-n1laPnNr-SM,58957
|
||||
numpy/core/include/numpy/ndarrayobject.h,sha256=2ChuMft1XdEPvZ1VAVoZyPhWwpIncT550GmQ7e9ENjw,11502
|
||||
numpy/core/include/numpy/ndarraytypes.h,sha256=9swyN8VeHjc-qOUFYBQ1gRR5cxaq5mFuadM1uPaVHlU,65018
|
||||
numpy/core/include/numpy/noprefix.h,sha256=YE-lWegAdZKI5lf44AW5jiWbnmO6hircWzj_WMFrLT4,6786
|
||||
numpy/core/include/numpy/npy_1_7_deprecated_api.h,sha256=LLeZKLuJADU3RDfT04pu5FCxCBU5cEzY5Q9phR_HL78,4715
|
||||
numpy/core/include/numpy/npy_3kcompat.h,sha256=exFgMT6slmo2Zg3bFsY3mKLUrrkg3KU_66gUmu5IYKk,14666
|
||||
numpy/core/include/numpy/npy_common.h,sha256=o58KYqo6zyg-kxKOmo50kryD-d3s3GsubVc1HUV6U7s,37899
|
||||
numpy/core/include/numpy/npy_cpu.h,sha256=3frXChwN0Cxca-sAeTTOJCiZ6_2q1EuggUwqEotdXLg,3879
|
||||
numpy/core/include/numpy/npy_endian.h,sha256=HHanBydLvLC2anJJySvy6wZ_lYaC_xI6GNwT8cJ78rE,2596
|
||||
numpy/core/include/numpy/npy_interrupt.h,sha256=Eyddk806h30jxgymbr44b7eIZKrHXtNzXpPtUPp2Ng8,3439
|
||||
numpy/core/include/numpy/npy_math.h,sha256=JC37Ga5DukIXkfwEi4I44DcNVnaV8fmcAiA01_MleQ8,21014
|
||||
numpy/core/include/numpy/npy_no_deprecated_api.h,sha256=X-wRYdpuwIuerTnBblKjR7Dqsv8rqxn01RFLVWUHvi8,567
|
||||
numpy/core/include/numpy/npy_os.h,sha256=cEvEvpD92EeFjsjRelw1dXJaHYL-0yPJDuz3VeSJs4E,817
|
||||
numpy/core/include/numpy/numpyconfig.h,sha256=J5BLHoCyhe383tIM4YriMgYDjOPC4xWzRvqBPyNCTOE,1207
|
||||
numpy/core/include/numpy/old_defines.h,sha256=7eiZoi7JrdVT9LXKCoeta5AoIncGa98GcVlWqDrLjwk,6306
|
||||
numpy/core/include/numpy/oldnumeric.h,sha256=Yo-LiSzVfDK2YyhlH41ff4gS0m-lv8XjI4JcAzpdy94,708
|
||||
numpy/core/include/numpy/random/bitgen.h,sha256=9H0tnhAIob4v3cKoKn_QKC-O3646q3xwDSDaHl3VrKk,390
|
||||
numpy/core/include/numpy/ufunc_api.txt,sha256=WhfoJ22HU0WR2yEcG_3aZon2FWYR7rYM6ZZJkDNKjDY,7226
|
||||
numpy/core/include/numpy/ufuncobject.h,sha256=aAlARsaHP07VzhD_6ylMhU3q3hMqcsr9YaB3PT4oW2U,13171
|
||||
numpy/core/include/numpy/utils.h,sha256=KqJzngAvarYV3oZQu5fY0ARPVihUP7FsZjdljysaSUk,729
|
||||
numpy/core/info.py,sha256=SjDs9EfOswEy-ABgUr9f09v83sUdhmwFXRlaZbOGCnA,4692
|
||||
numpy/core/lib/npy-pkg-config/mlib.ini,sha256=mQBSOI6opCVmMZK4vwIhLe5J7YevO3PbaHsI0MlJGHs,151
|
||||
numpy/core/lib/npy-pkg-config/npymath.ini,sha256=5dwvhvbX3a_9toniEDvGPDGChbXIfFiLa36H4YOR-vw,380
|
||||
numpy/core/lib/npymath.lib,sha256=DHqIpUFVa8b6cpieleAaaaXtunN7JWgPwI4iuMD3y18,96648
|
||||
numpy/core/machar.py,sha256=P8Ae9aOzoTUMWWiAXgE0Uf5Vk837DTODV5ndQLvm5zU,10860
|
||||
numpy/core/memmap.py,sha256=RVD10EyH-4jgzrTy3Xc_mXsJrvt-QMGGLmY7Aoqmy7I,11590
|
||||
numpy/core/multiarray.py,sha256=7yvhC6SVcF-MGwX5PwsSmV7jMfObe4gldkNI6lqsyvY,53002
|
||||
numpy/core/numeric.py,sha256=5TU2bmjQufyNKuZKYxfh51Nu3Ki4aqnaUkHzC50QBcU,71964
|
||||
numpy/core/numerictypes.py,sha256=ntCPtS5tVknVX33IHcfxu_sgNZgezrhLxB9srdy1lA4,17917
|
||||
numpy/core/overrides.py,sha256=QSAszCmd2nRZGt3N5Hg9H1IS3OFTgXDyw1PU686zByY,7339
|
||||
numpy/core/records.py,sha256=VQDCzzni7annAHR2t7fwpP5u0hsuBnUeOwsuh0lruNI,30991
|
||||
numpy/core/setup.py,sha256=5nWJhIVPPOmw0jZEwOhX5-IKFjsfAXCiT1VQTNocaEQ,42225
|
||||
numpy/core/setup_common.py,sha256=Q5cAWyNi-2_GiwoUo8Dri-PjxnHF2YunRGERa0iGUqE,17807
|
||||
numpy/core/shape_base.py,sha256=BW2wJcGFaqQKcfU6sWAYCWhDGjPigOi27EEyrQg4zro,28889
|
||||
numpy/core/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/core/tests/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/_locales.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_abc.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_api.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_arrayprint.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_datetime.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_defchararray.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_deprecations.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_dtype.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_einsum.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_errstate.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_extint128.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_function_base.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_getlimits.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_half.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_indexerrors.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_indexing.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_item_selection.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_longdouble.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_machar.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_mem_overlap.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_memmap.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_multiarray.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_nditer.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_numeric.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_numerictypes.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_overrides.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_print.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_records.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_regression.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_scalar_ctors.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_scalar_methods.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_scalarbuffer.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_scalarinherit.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_scalarmath.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_scalarprint.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_shape_base.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_ufunc.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_umath.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_umath_accuracy.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_umath_complex.cpython-37.pyc,,
|
||||
numpy/core/tests/__pycache__/test_unicode.cpython-37.pyc,,
|
||||
numpy/core/tests/_locales.py,sha256=GQro3bha8c5msgQyvNzmDUrNwqS2cGkKKuN4gg4c6tI,2266
|
||||
numpy/core/tests/data/astype_copy.pkl,sha256=lWSzCcvzRB_wpuRGj92spGIw-rNPFcd9hwJaRVvfWdk,716
|
||||
numpy/core/tests/data/recarray_from_file.fits,sha256=NA0kliz31FlLnYxv3ppzeruONqNYkuEvts5wzXEeIc4,8640
|
||||
numpy/core/tests/data/umath-validation-set-README,sha256=-1JRNN1zx8S1x9l4D0786USSRMNt3Dk0nsOMg6O7CiM,959
|
||||
numpy/core/tests/data/umath-validation-set-cos,sha256=qIka8hARvhXZOu9XR3CnGiPnOdrkAaxEgFgEEqus06s,24703
|
||||
numpy/core/tests/data/umath-validation-set-exp,sha256=GZn7cZRKAjskJ4l6tcvDF53I3e9zegQH--GPzYib9_g,4703
|
||||
numpy/core/tests/data/umath-validation-set-log,sha256=gDbicMaonc26BmtHPoyvunUvXrSFLV9BY8L1QVoH5Dw,4088
|
||||
numpy/core/tests/data/umath-validation-set-sin,sha256=fMEynY6dZz18jtuRdpfOJT9KnpRSWd9ilcz0oXMwgCQ,24690
|
||||
numpy/core/tests/test_abc.py,sha256=cpIqt3VFBZLHbuNpO4NuyCGgd--k1zij5aasu7FV77I,2402
|
||||
numpy/core/tests/test_api.py,sha256=CFYe-TYbc3Vs0dvwE6A3mmTHF8wHtMU7QCpPc4VbQkE,19223
|
||||
numpy/core/tests/test_arrayprint.py,sha256=PPUppm9m6cPx2mjU0lQevTdnLSq0_6JIe8LyumN3ujM,34701
|
||||
numpy/core/tests/test_datetime.py,sha256=3nuebvEhPMAxq1MOUzohv7X19a2aTrLb6NYeaXVYEOs,104661
|
||||
numpy/core/tests/test_defchararray.py,sha256=L5EoOBTZVrRU1Vju5IhY8BSUlBOGPzEViKJwyQSlpXo,25481
|
||||
numpy/core/tests/test_deprecations.py,sha256=NicJnSm5QSDTpr6DvjxMyPAqApPj-TRPzyDZeF_HsDU,21855
|
||||
numpy/core/tests/test_dtype.py,sha256=qQGuUf1WrIyhUkdjPVxHy-dBJh3GXluUUyC4gp2iUnM,48889
|
||||
numpy/core/tests/test_einsum.py,sha256=wuPIjp8lPJ-78nnpe0AziEDyMcWHDhGQJ358C9gdCys,44372
|
||||
numpy/core/tests/test_errstate.py,sha256=84S9ragkp2xqJ5s8uNEt1-4SGs99t3pkPVMHYc4QL-s,1505
|
||||
numpy/core/tests/test_extint128.py,sha256=-0zEInkai1qRhXI0bdHCguU_meD3s6Td4vUIBwirYQI,5709
|
||||
numpy/core/tests/test_function_base.py,sha256=pLUQhUHqda7uzs05gp390gl-bDS3qALLLQXc7XrWezs,13165
|
||||
numpy/core/tests/test_getlimits.py,sha256=2fBK7Slo67kP6bThcN9bOKmeX9gGPQVUE17jGVydoXk,4427
|
||||
numpy/core/tests/test_half.py,sha256=83O_R-Frt8mx2-7WEbmoVXLWJ5Dc5SH9n0vyPJ9Wp_I,22301
|
||||
numpy/core/tests/test_indexerrors.py,sha256=0Ku3Sy5jcaE3D2KsyDrFTvgQzMv2dyWja3hc4t5-n_k,4857
|
||||
numpy/core/tests/test_indexing.py,sha256=0-I5M5NCgDgHM58Myxp1vpOaulm7_s3n4K82_BeDihk,51366
|
||||
numpy/core/tests/test_item_selection.py,sha256=0Ocg_RzeQjNqwIaPhb_Zk0ZlmqSjIBY0lHeef_H9l9U,3579
|
||||
numpy/core/tests/test_longdouble.py,sha256=rd-YvOKgY8W0PMEtLHWm4er8dXgoC1STi6QuUGPWiHs,7300
|
||||
numpy/core/tests/test_machar.py,sha256=FrKeGhC7j-z9tApS_uI1E0DUkzieKIdUHMQPfCSM0t8,1141
|
||||
numpy/core/tests/test_mem_overlap.py,sha256=AyBz4pm7HhTDdlW2pq9FR1AO0E5QAYdKpBoWbOdSrco,29505
|
||||
numpy/core/tests/test_memmap.py,sha256=sFJ6uaf6ior1Hzjg7Y-VYzYPHnuZOYmNczOBa-_GgSY,7607
|
||||
numpy/core/tests/test_multiarray.py,sha256=vMXpJ4vsG3jf7EYRWlhp1gB2MN5fzohmQfuu8tLWHkc,313192
|
||||
numpy/core/tests/test_nditer.py,sha256=toVssKFI_nYQNJfkLIxMz_1GjJkuMnEyGkOqOiuiGFg,112097
|
||||
numpy/core/tests/test_numeric.py,sha256=7NTwgPeI0e_QggdoxkTurpnjuf9S4WnH2MVqRG1fBh4,115526
|
||||
numpy/core/tests/test_numerictypes.py,sha256=QdpgkKDXuHLyS-cvkED-kDRZUv9nnjF5zU53m9yBdYg,18601
|
||||
numpy/core/tests/test_overrides.py,sha256=rkP2O-8MYssKR4y6gKkNxz2LyaYvnCuHn6eOEYtJzsc,14619
|
||||
numpy/core/tests/test_print.py,sha256=Q53dqbjQQIlCzRp_1ZY0A-ptP7FlbBZVPeMeMLX0cVg,6876
|
||||
numpy/core/tests/test_records.py,sha256=CJu2VaBWsNQrYpCSS0HAV2aKv8Ow0Zfc5taegRslVW0,19651
|
||||
numpy/core/tests/test_regression.py,sha256=i8jnx_W7VWgA02AX-BMLDNdN_S-wDu5wLd0ssn0O8W4,88978
|
||||
numpy/core/tests/test_scalar_ctors.py,sha256=kjyYllJHyhMQGT49Xbjjc2tuFHXcQIM-PAZExMWczq8,2294
|
||||
numpy/core/tests/test_scalar_methods.py,sha256=n3eNfQ-NS6ODGfJFrww-RSKVm9QzRKeDRp0ae4TzQJ8,4220
|
||||
numpy/core/tests/test_scalarbuffer.py,sha256=M-xSWyn2ts_O4d69kWAuEEzupY6AZ6YpLI31Gxlvjn4,3556
|
||||
numpy/core/tests/test_scalarinherit.py,sha256=iP5lLn-z1vtongCvDt-JBnHwNWNREx4ovu12Iy-mGiA,1838
|
||||
numpy/core/tests/test_scalarmath.py,sha256=wyWKt80diGTE3AtoNiJDALZbQnCw8f-iu2czVWkUFKs,27255
|
||||
numpy/core/tests/test_scalarprint.py,sha256=SPTkscqlnApyqaOUZ5cgC2rDgGED6hPBtdRkWXxXlbE,15470
|
||||
numpy/core/tests/test_shape_base.py,sha256=B4869KCdnSxSTcTmqFhOPU2eRjmzOuG0fwVa3jrGyg8,24993
|
||||
numpy/core/tests/test_ufunc.py,sha256=jnCFBfWk4oS9FSdiitDfp6vff_TGzQfLq197gqmf4iQ,81118
|
||||
numpy/core/tests/test_umath.py,sha256=GByYrUe1zt0aDfj6iBme8SuAJYJrxrzBiBmGY9qjlBc,112344
|
||||
numpy/core/tests/test_umath_accuracy.py,sha256=EapioYRHtg27ZdF4qPKYnwKNAiIuw25VB8f5NmU73yY,2613
|
||||
numpy/core/tests/test_umath_complex.py,sha256=zvjC9COuHSZ_6BL3lz2iP7UppkNWL8ThP04fj0eulUQ,19413
|
||||
numpy/core/tests/test_unicode.py,sha256=PvWt5NLjgwulCgXakHEKMJ2pSpTLbUWgz9dZExEcSJ8,13656
|
||||
numpy/core/umath.py,sha256=KAWy8e3HN7CMF6bPfQ_MCL36bDuU7UeS39tlxaFAeto,1905
|
||||
numpy/core/umath_tests.py,sha256=Sr6VQTbH-sOMlXy-tg1-Unht7MKaaV4wtAYR6mQYNbU,455
|
||||
numpy/ctypeslib.py,sha256=hld7CTfeqoydoIu6n-eeHuS6Nz5pkSSOsMOe4YJ9-h8,17445
|
||||
numpy/distutils/__config__.py,sha256=f63XAg_8cwJrO2dKUk5GkmQr4IH_0tXzrKOVFcbdbAY,1690
|
||||
numpy/distutils/__init__.py,sha256=b93HZiRpHfSC9E-GPiXk6PWDwQ3STJ4rlzvx6PhHH1k,1092
|
||||
numpy/distutils/__pycache__/__config__.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/__version__.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/_shell_utils.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/ccompiler.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/compat.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/conv_template.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/core.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/cpuinfo.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/exec_command.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/extension.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/from_template.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/info.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/intelccompiler.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/lib2def.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/line_endings.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/log.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/mingw32ccompiler.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/misc_util.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/msvc9compiler.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/msvccompiler.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/npy_pkg_config.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/numpy_distribution.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/pathccompiler.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/setup.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/system_info.cpython-37.pyc,,
|
||||
numpy/distutils/__pycache__/unixccompiler.cpython-37.pyc,,
|
||||
numpy/distutils/__version__.py,sha256=SSRZKvGfvg_GpYbXWtI5gaTK0NGW9nBBCyNghaaXBh8,151
|
||||
numpy/distutils/_shell_utils.py,sha256=kMLOIoimB7PdFRgoVxCIyCFsIl1pP3d0hkm_s3E9XdA,2613
|
||||
numpy/distutils/ccompiler.py,sha256=e9yDu-4BNfcrT_RHXJk-a91qWwxrQOrIVXbdj_X22D8,27417
|
||||
numpy/distutils/command/__init__.py,sha256=l5r9aYwIEq1D-JJc8WFUxABk6Ip28FpRK_ok7wSLRZE,1098
|
||||
numpy/distutils/command/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/autodist.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/bdist_rpm.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/build.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/build_clib.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/build_ext.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/build_py.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/build_scripts.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/build_src.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/config.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/config_compiler.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/develop.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/egg_info.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/install.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/install_clib.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/install_data.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/install_headers.cpython-37.pyc,,
|
||||
numpy/distutils/command/__pycache__/sdist.cpython-37.pyc,,
|
||||
numpy/distutils/command/autodist.py,sha256=m5BGbaBPrBjbp3U_lGD35BS_yUxjarB9S9wAwTxgGvw,3041
|
||||
numpy/distutils/command/bdist_rpm.py,sha256=rhhIyFzkd5NGi6lZaft44EBPZB3zZFRDc75klJYnbw8,775
|
||||
numpy/distutils/command/build.py,sha256=6Q9bDubq5WfwR1K5woDFXed692szD0Rq-5Ckv2xpoK4,1618
|
||||
numpy/distutils/command/build_clib.py,sha256=_Y3upI_slekgMk2CI2vplOXj5p1_aEHa-F9_nJ0HOgg,13389
|
||||
numpy/distutils/command/build_ext.py,sha256=zmTIsgzsyQ_hWZVtQ-CyYvgIdeZjTd0k-t4uSR91wrk,25966
|
||||
numpy/distutils/command/build_py.py,sha256=7TBGLz0va0PW6sEX-aUjsXdzvhuSbJGgIrMim1JTwu4,1210
|
||||
numpy/distutils/command/build_scripts.py,sha256=ze19jHBhC3JggKLbL9wgs9I3mG7ls-V2NbykvleNwgQ,1731
|
||||
numpy/distutils/command/build_src.py,sha256=-xNyg6-zkW-1-BQkQwOcxEdZHVPwNo3CAl9uuzrQV0g,30862
|
||||
numpy/distutils/command/config.py,sha256=uQiAYcanXSLOhWtmZVZgPL5ucuuwPWt4m89Jop8EfWI,20481
|
||||
numpy/distutils/command/config_compiler.py,sha256=SKJTEk_Y_Da-dVYOHAdf4c3yXxjlE1dsr-hJxY0m0PU,4435
|
||||
numpy/distutils/command/develop.py,sha256=nYM5yjhKtGKh_3wZwrvEQBLYHKldz64aU-0iSycSkXA,641
|
||||
numpy/distutils/command/egg_info.py,sha256=pdiCFQiQuIpf_xmVk9Njl7iowY9CxGn9KRbU-A9eBfg,987
|
||||
numpy/distutils/command/install.py,sha256=-y7bHvwoQdDCMGdLONawqnOWKtwQzjp5v-vSpZ7PdYU,3144
|
||||
numpy/distutils/command/install_clib.py,sha256=rGCajxbqAZjsYWg3l5B7ZRgcHJzFtYAiUHZH-DO64eU,1465
|
||||
numpy/distutils/command/install_data.py,sha256=7iWTw93ty2sBPwHwg_EEhgQhZSZe6SsKdfTS9RbUR9A,914
|
||||
numpy/distutils/command/install_headers.py,sha256=NbZwt-Joo80z_1TfxA-mIWXm2L9Mmh4ZLht7HAuveoo,985
|
||||
numpy/distutils/command/sdist.py,sha256=tHmlb0RzD8x04dswPXEua9H_b6GuHWY1V3hYkwJDKvA,799
|
||||
numpy/distutils/compat.py,sha256=xzkW8JgJgGTmye34QCYTIkLfsXBvmPu4tvgCwXNdiU0,218
|
||||
numpy/distutils/conv_template.py,sha256=0BFDE5IToW3sMVMzSRjmgENs2PAKyt7Wnvm2gyFrKnU,9750
|
||||
numpy/distutils/core.py,sha256=9GNNyWDTCqfnD7Jp2tzp9vOBVyeJmF8lsgv_xdlt59g,8230
|
||||
numpy/distutils/cpuinfo.py,sha256=AHJuQeg78_P5EReO1kLd-MAohvB-GfV8zuRh7F8hltI,23015
|
||||
numpy/distutils/exec_command.py,sha256=mFDI18qQYbjkQOWV6Yv-tT4Rl9Wrw5m2jjYntKh4hzQ,10919
|
||||
numpy/distutils/extension.py,sha256=q_NjgW-sOoeEBbeSEJwFh411mTgsF7BzGYso61Wf0qg,2967
|
||||
numpy/distutils/fcompiler/__init__.py,sha256=-9uYUvrMwdxy0jetB-T-QHSwmWcobNRL5u0Bbj0Sm4w,40157
|
||||
numpy/distutils/fcompiler/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/absoft.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/compaq.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/environment.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/g95.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/gnu.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/hpux.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/ibm.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/intel.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/lahey.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/mips.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/nag.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/none.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/pathf95.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/pg.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/sun.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/__pycache__/vast.cpython-37.pyc,,
|
||||
numpy/distutils/fcompiler/absoft.py,sha256=AKbj5uGr8dpGDLzRIJbdUnXXAtF_5k4JqnqwTWvy-tQ,5565
|
||||
numpy/distutils/fcompiler/compaq.py,sha256=djulalEdV6b58ofcEw14Uoq5-aNgblJMqLIzNwmJ2SE,4109
|
||||
numpy/distutils/fcompiler/environment.py,sha256=-S6TM5xc_prXB9ks7BFBaUuW0lnYK2Je9mmcwQTUsi8,3457
|
||||
numpy/distutils/fcompiler/g95.py,sha256=K68RRAvOvyKoh-jsD9J4ZDsHltrGnJ_AllxULhy6iOE,1396
|
||||
numpy/distutils/fcompiler/gnu.py,sha256=oHipJDyfisSK9_Kdkv1Av8hDHY3UbLALgWfBO7cXkPA,20804
|
||||
numpy/distutils/fcompiler/hpux.py,sha256=xpNfy7vCKWPnJ5M3JPnjMAewKBAfKN5hFX3hvEL2zaM,1419
|
||||
numpy/distutils/fcompiler/ibm.py,sha256=3q-AZ3TC3VjRxNyvkeIGN81SDWtHDH9iddfd8hqk4x4,3607
|
||||
numpy/distutils/fcompiler/intel.py,sha256=WlsBtvZnLpFke7oTpMCDYFlccNSUWWkB2p422iwQURU,6861
|
||||
numpy/distutils/fcompiler/lahey.py,sha256=pJ0-xgtYwyYXgt8JlN8PFeYYEWB3vOmFkNx6UUFXzuM,1393
|
||||
numpy/distutils/fcompiler/mips.py,sha256=IxLojWR1oi0VW93PxPpHQXRwZcYffD1dunllQW2w19A,1780
|
||||
numpy/distutils/fcompiler/nag.py,sha256=eiTvBopdCgVh5-HDTryVbRrYvf4r_Sqse1mruTt5Blo,2608
|
||||
numpy/distutils/fcompiler/none.py,sha256=N6adoFAf8inIQfCDEBzK5cGI3hLIWWpHmQXux8iJDfA,824
|
||||
numpy/distutils/fcompiler/pathf95.py,sha256=Xf1JMB30PDSoNpA1Y-vKPRBeNO0XfSi0dvVQvvdjfUQ,1127
|
||||
numpy/distutils/fcompiler/pg.py,sha256=G0uNPfedmbkYWfChg1UbxBKqo25RenzSVJN1BUtRDw0,4232
|
||||
numpy/distutils/fcompiler/sun.py,sha256=21DQ6Rprr9rEp4pp7Np8kCwOc0Xfqdxa1iX0O-yPJPM,1643
|
||||
numpy/distutils/fcompiler/vast.py,sha256=LJ21-WIJsiquLtjdDaNsJqblwN5wuM2FZsYl1R40vN8,1733
|
||||
numpy/distutils/from_template.py,sha256=k5PrP9If_X8J5Fsh9vR2h0Tcj2JsZC9EsC2h8fGfaXs,8027
|
||||
numpy/distutils/info.py,sha256=lNxUhbJnzWjA47P2I_9NW-tuVrjGzL62jHDlQJ3pp6E,157
|
||||
numpy/distutils/intelccompiler.py,sha256=1qzr6PMxi0UkR0NUY3rt3gqww9GwJ-Gbe91yxQKlieU,4291
|
||||
numpy/distutils/lib2def.py,sha256=RWD0EpuUHoxIuc9VyyDCH2d73jgsdGG2PBKVisanlVU,3502
|
||||
numpy/distutils/line_endings.py,sha256=jrYG8SnOyMN0lvQim4Kf6ChoHdtaWO0egeTUUHtPoQA,2085
|
||||
numpy/distutils/log.py,sha256=yHzdtNdTg6YtvO50Hu-Le5WJ7Typ2TvaCYabelTaUO0,2745
|
||||
numpy/distutils/mingw/gfortran_vs2003_hack.c,sha256=cbsN3Lk9Hkwzr9c-yOP2xEBg1_ml1X7nwAMDWxGjzc8,77
|
||||
numpy/distutils/mingw32ccompiler.py,sha256=tIYZHU9QlPJN4hf_BHdF-4q-UZoMMDRsn-Zb7plnqWQ,25245
|
||||
numpy/distutils/misc_util.py,sha256=zc1QZq6dCqbpPOgGftKyh_FkhQaR7kqhzhxsgmyeBPo,82828
|
||||
numpy/distutils/msvc9compiler.py,sha256=TuPYjPFp3nYQSIG1goNxuOly7o3VMx-H35POMpycB3k,2258
|
||||
numpy/distutils/msvccompiler.py,sha256=7EUlHbgdKBBJG3AzgE94AQeUFnj0HcD6M7_YPN7vdCs,1994
|
||||
numpy/distutils/npy_pkg_config.py,sha256=k3lxSOC_InRBSGddbfbvMLRTGqnE-LliNXakwdZ3AH8,13154
|
||||
numpy/distutils/numpy_distribution.py,sha256=lbnEW1OxWxC_1n2sKd0Q3fC5QnNdFuAkNAlvXF99zIQ,700
|
||||
numpy/distutils/pathccompiler.py,sha256=FjNouOTL8u4gLMbJW7GdT0RlsD2nXV1_SEBNZj9QdpQ,779
|
||||
numpy/distutils/setup.py,sha256=q3DcCZNkK_jHsC0imocewd4uCKQWWXjkzd4nkBmkMFI,611
|
||||
numpy/distutils/system_info.py,sha256=9X29XpFF2ueqac5X7WcUwNHJbtcaWxQLq-dszI6pIlE,98987
|
||||
numpy/distutils/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/distutils/tests/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/distutils/tests/__pycache__/test_exec_command.cpython-37.pyc,,
|
||||
numpy/distutils/tests/__pycache__/test_fcompiler.cpython-37.pyc,,
|
||||
numpy/distutils/tests/__pycache__/test_fcompiler_gnu.cpython-37.pyc,,
|
||||
numpy/distutils/tests/__pycache__/test_fcompiler_intel.cpython-37.pyc,,
|
||||
numpy/distutils/tests/__pycache__/test_fcompiler_nagfor.cpython-37.pyc,,
|
||||
numpy/distutils/tests/__pycache__/test_from_template.cpython-37.pyc,,
|
||||
numpy/distutils/tests/__pycache__/test_misc_util.cpython-37.pyc,,
|
||||
numpy/distutils/tests/__pycache__/test_npy_pkg_config.cpython-37.pyc,,
|
||||
numpy/distutils/tests/__pycache__/test_shell_utils.cpython-37.pyc,,
|
||||
numpy/distutils/tests/__pycache__/test_system_info.cpython-37.pyc,,
|
||||
numpy/distutils/tests/test_exec_command.py,sha256=U__8FXVF4WwYdf6ucgNzgYHGgUOIKhFWG9qoCr2GxGo,7483
|
||||
numpy/distutils/tests/test_fcompiler.py,sha256=t26JUHwJxl_m-ALPa5XABgVFrMthBw7gRKN4yYX1hYQ,2678
|
||||
numpy/distutils/tests/test_fcompiler_gnu.py,sha256=O57uCEHeQIS0XF8GloEas3OlaOfmIHDWEtgYS_q3x48,2218
|
||||
numpy/distutils/tests/test_fcompiler_intel.py,sha256=fOjd_jv0Od6bZyzFf4YpZMcnFva0OZK7yJV_4Hebb6A,1140
|
||||
numpy/distutils/tests/test_fcompiler_nagfor.py,sha256=5-Num0A3cN7_NS3BlAgYt174S-OGOWRLL9rXtv-h_fA,1176
|
||||
numpy/distutils/tests/test_from_template.py,sha256=SDYoe0XUpAayyEQDq7ZhrvEEz7U9upJDLYzhcdoVifc,1103
|
||||
numpy/distutils/tests/test_misc_util.py,sha256=8LIm12X83HmvgmpvJJ9inaU7FlGt287VwDM-rMKCOv4,3316
|
||||
numpy/distutils/tests/test_npy_pkg_config.py,sha256=wa0QMQ9JAye87t2gDbFaBHp0HGpNFgwxJrJ30ZrHvNk,2639
|
||||
numpy/distutils/tests/test_shell_utils.py,sha256=we9P8AvjCQky1NRDP3sXAJnNUek7rDmMR4Ar9cg9iSk,2030
|
||||
numpy/distutils/tests/test_system_info.py,sha256=gb99F0iX4pbKhjxCcdiby0bvFMzPwuUGlSj_VXnfpWk,8548
|
||||
numpy/distutils/unixccompiler.py,sha256=M7Hn3ANMo8iP-sZtSAebI3RCLp0ViRYxawAbck0hlQM,5177
|
||||
numpy/doc/__init__.py,sha256=BDpxTM0iw2F4thjBkYqjIXX57F5KfIaH8xMd67N6Jh0,574
|
||||
numpy/doc/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/doc/__pycache__/basics.cpython-37.pyc,,
|
||||
numpy/doc/__pycache__/broadcasting.cpython-37.pyc,,
|
||||
numpy/doc/__pycache__/byteswapping.cpython-37.pyc,,
|
||||
numpy/doc/__pycache__/constants.cpython-37.pyc,,
|
||||
numpy/doc/__pycache__/creation.cpython-37.pyc,,
|
||||
numpy/doc/__pycache__/dispatch.cpython-37.pyc,,
|
||||
numpy/doc/__pycache__/glossary.cpython-37.pyc,,
|
||||
numpy/doc/__pycache__/indexing.cpython-37.pyc,,
|
||||
numpy/doc/__pycache__/internals.cpython-37.pyc,,
|
||||
numpy/doc/__pycache__/misc.cpython-37.pyc,,
|
||||
numpy/doc/__pycache__/structured_arrays.cpython-37.pyc,,
|
||||
numpy/doc/__pycache__/subclassing.cpython-37.pyc,,
|
||||
numpy/doc/__pycache__/ufuncs.cpython-37.pyc,,
|
||||
numpy/doc/basics.py,sha256=5RyDQtFmJTpITWDovomr062pDMBTxedZzj38szDJ27w,11253
|
||||
numpy/doc/broadcasting.py,sha256=0uofJxPfkwsaQaTSju8TwiOpsmXSw2F3bzG8CdkKviU,5603
|
||||
numpy/doc/byteswapping.py,sha256=OaEr35v3R__QWWETIlYKfqIyf_qtUm_qxityFIQ0Zrc,5375
|
||||
numpy/doc/constants.py,sha256=_n8_OUw7ZKKod6Ho7jtC_J-tSg1pZOBfMO2avPIz_88,9291
|
||||
numpy/doc/creation.py,sha256=6FUALDWgqPWObcW-ZHDQMAnfo42I60rRR9pDpwb4-YE,5496
|
||||
numpy/doc/dispatch.py,sha256=EUruXLkgiGodYlNcjXde06qHTSGUhKjzrFkGYmTZEQg,10011
|
||||
numpy/doc/glossary.py,sha256=sj5-0X9pjaQEmaTCHAzsqIcVJL_T201E1Ex8v90QiAc,14777
|
||||
numpy/doc/indexing.py,sha256=gF3w0dZp7tCx0vKkOSELIBdNGfL1gPZqfiW3T_vj_4Q,16119
|
||||
numpy/doc/internals.py,sha256=xYp6lv4yyV0ZIo_qCvLCAWxDa0rhu7FNrTmpXY1isO4,9669
|
||||
numpy/doc/misc.py,sha256=JWJqyiYL2qoSMVAb0QC8w_Pm5l7ZLxx2Z9D5ilgU4Uo,6191
|
||||
numpy/doc/structured_arrays.py,sha256=28B7iMDrJvM1vjEHou73gXjRcldI5MAz7r4CaEouxmk,26509
|
||||
numpy/doc/subclassing.py,sha256=AqtEltybX__ghj91b73QgXcGpYd8gGlwoO-R7SQDwe8,28561
|
||||
numpy/doc/ufuncs.py,sha256=vsAkCLEMh7Qa_3x4WbDMY3IQsDCLdOCuB_6P2aEcVLg,5427
|
||||
numpy/dual.py,sha256=q17Lo5-3Y4_wNOkg7c7eqno9EdTTtvnz4XpF75HK2fw,1877
|
||||
numpy/f2py/__init__.py,sha256=nHuShe3wj5HQ2Xyb42DEorG3DK63HaXRNUizZgqB83g,3101
|
||||
numpy/f2py/__main__.py,sha256=mnksAcMyLdK0So_DseQn0zalhnA7LflS7hHvo7QCVjU,134
|
||||
numpy/f2py/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/__main__.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/__version__.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/auxfuncs.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/capi_maps.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/cb_rules.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/cfuncs.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/common_rules.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/crackfortran.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/diagnose.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/f2py2e.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/f2py_testing.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/f90mod_rules.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/func2subr.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/info.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/rules.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/setup.cpython-37.pyc,,
|
||||
numpy/f2py/__pycache__/use_rules.cpython-37.pyc,,
|
||||
numpy/f2py/__version__.py,sha256=rEHB9hlWmpryhNa0EmMnlAlDCGI4GXILC9CZUEV3Wew,254
|
||||
numpy/f2py/auxfuncs.py,sha256=mDvaBo3Y8tYpXLZfq8DCv6UZ3-2JqWc_iNBZRxGesb0,21826
|
||||
numpy/f2py/capi_maps.py,sha256=FgizIHORFdaX5eIVZEQSlC9kVAidh0jfKoJYMK4Z86E,31416
|
||||
numpy/f2py/cb_rules.py,sha256=un1xn8goj4jFL8FzxRwWSAzpr0CVcvwObVUKdIGJyaA,22946
|
||||
numpy/f2py/cfuncs.py,sha256=NRxuXAaryWHOFh5205BvvDjajituolH6FvtsumCltvI,45114
|
||||
numpy/f2py/common_rules.py,sha256=DOCOo4brpFaKNll8hOjG_vCYuOfKyTBYMItaDC_osEc,4981
|
||||
numpy/f2py/crackfortran.py,sha256=onGQnPhpE8DyP4L4XinwHbdPwhXavetgPbKS3SG-REQ,128945
|
||||
numpy/f2py/diagnose.py,sha256=VNuNTGnQaXn9Fn2jlueYt47634CvLQSaAWJWy_Nxwnw,5295
|
||||
numpy/f2py/f2py2e.py,sha256=rVmnPWef7u6XcAfRzytE90Mb-YAkUtMNsBOtKR2AMfg,23995
|
||||
numpy/f2py/f2py_testing.py,sha256=8rkBjUsNhBavpoBgi_bqDS8H8tBdd5BR8hrE6ENsIAo,1523
|
||||
numpy/f2py/f90mod_rules.py,sha256=YFK4MPkGHBxshAInbcapnumX3qlu0h6ya6GQpS8zWLk,9850
|
||||
numpy/f2py/func2subr.py,sha256=Oy12rqUa1vcXvzR6g8yx8jSYDwfKt5Jqiebf1QaWX1o,9224
|
||||
numpy/f2py/info.py,sha256=Mk1-neqpqYQ6njoVUCKHmMkyFkAqYeWH4cGZr8NfKiI,136
|
||||
numpy/f2py/rules.py,sha256=lvekf6i1NaGlAzg4vrs0ZOIO5ebBxYrKBtbR1CjjM-w,58707
|
||||
numpy/f2py/setup.py,sha256=qNCIqRPcpEUhJBjihtEXEe4Iil4XDYVRAI_sZm7xZhM,2444
|
||||
numpy/f2py/src/fortranobject.c,sha256=hrghwQ5cPUOMoWJO55oc1jAEJZeRl77QhZ_wYLLIUyk,36038
|
||||
numpy/f2py/src/fortranobject.h,sha256=ltMxueNeETQtEYSA_E7bpRtF8Jj1xuOBS-YNhjBMfOw,5227
|
||||
numpy/f2py/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/f2py/tests/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_array_from_pyobj.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_assumed_shape.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_block_docstring.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_callback.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_common.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_compile_function.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_kind.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_mixed.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_parameter.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_quoted_character.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_regression.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_return_character.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_return_complex.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_return_integer.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_return_logical.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_return_real.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_semicolon_split.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_size.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/test_string.cpython-37.pyc,,
|
||||
numpy/f2py/tests/__pycache__/util.cpython-37.pyc,,
|
||||
numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c,sha256=L_Z0GMyfYIoRiS0FIBlzy_nxlFoNbkLAatObVmKeGsk,9025
|
||||
numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap,sha256=But9r9m4iL7EGq_haMW8IiQ4VivH0TgUozxX4pPvdpE,29
|
||||
numpy/f2py/tests/src/assumed_shape/foo_free.f90,sha256=oBwbGSlbr9MkFyhVO2aldjc01dr9GHrMrSiRQek8U64,460
|
||||
numpy/f2py/tests/src/assumed_shape/foo_mod.f90,sha256=rfzw3QdI-eaDSl-hslCgGpd5tHftJOVhXvb21Y9Gf6M,499
|
||||
numpy/f2py/tests/src/assumed_shape/foo_use.f90,sha256=rmT9k4jP9Ru1PLcGqepw9Jc6P9XNXM0axY7o4hi9lUw,269
|
||||
numpy/f2py/tests/src/assumed_shape/precision.f90,sha256=r08JeTVmTTExA-hYZ6HzaxVwBn1GMbPAuuwBhBDtJUk,130
|
||||
numpy/f2py/tests/src/common/block.f,sha256=GQ0Pd-VMX3H3a-__f2SuosSdwNXHpBqoGnQDjf8aG9g,224
|
||||
numpy/f2py/tests/src/kind/foo.f90,sha256=zIHpw1KdkWbTzbXb73hPbCg4N2Htj3XL8DIwM7seXpo,347
|
||||
numpy/f2py/tests/src/mixed/foo.f,sha256=90zmbSHloY1XQYcPb8B5d9bv9mCZx8Z8AMTtgDwJDz8,85
|
||||
numpy/f2py/tests/src/mixed/foo_fixed.f90,sha256=pxKuPzxF3Kn5khyFq9ayCsQiolxB3SaNtcWaK5j6Rv4,179
|
||||
numpy/f2py/tests/src/mixed/foo_free.f90,sha256=fIQ71wrBc00JUAVUj_r3QF9SdeNniBiMw6Ly7CGgPWU,139
|
||||
numpy/f2py/tests/src/parameter/constant_both.f90,sha256=-bBf2eqHb-uFxgo6Q7iAtVUUQzrGFqzhHDNaxwSICfQ,1939
|
||||
numpy/f2py/tests/src/parameter/constant_compound.f90,sha256=re7pfzcuaquiOia53UT7qNNrTYu2euGKOF4IhoLmT6g,469
|
||||
numpy/f2py/tests/src/parameter/constant_integer.f90,sha256=nEmMLitKoSAG7gBBEQLWumogN-KS3DBZOAZJWcSDnFw,612
|
||||
numpy/f2py/tests/src/parameter/constant_non_compound.f90,sha256=IcxESVLKJUZ1k9uYKoSb8Hfm9-O_4rVnlkiUU2diy8Q,609
|
||||
numpy/f2py/tests/src/parameter/constant_real.f90,sha256=quNbDsM1Ts2rN4WtPO67S9Xi_8l2cXabWRO00CPQSSQ,610
|
||||
numpy/f2py/tests/src/regression/inout.f90,sha256=CpHpgMrf0bqA1W3Ozo3vInDz0RP904S7LkpdAH6ODck,277
|
||||
numpy/f2py/tests/src/size/foo.f90,sha256=IlFAQazwBRr3zyT7v36-tV0-fXtB1d7WFp6S1JVMstg,815
|
||||
numpy/f2py/tests/src/string/char.f90,sha256=ihr_BH9lY7eXcQpHHDQhFoKcbu7VMOX5QP2Tlr7xlaM,618
|
||||
numpy/f2py/tests/test_array_from_pyobj.py,sha256=gLSX9JuF_8NNboUQRzRF3IYC7pWJ06Mw8m6sy2wQvCQ,22083
|
||||
numpy/f2py/tests/test_assumed_shape.py,sha256=QhSsSJ4gzrgACSO-dyasMPhJSfa7PzDAxAd9yN0M6zI,949
|
||||
numpy/f2py/tests/test_block_docstring.py,sha256=ld1G4pBEi8F4GrkYDpNBJKJdlfDANNI6tiKfBQS9I6w,647
|
||||
numpy/f2py/tests/test_callback.py,sha256=iRV0nslbJKovMmXPZed-w9QhNJYZfEo07p_8qneDDbU,3986
|
||||
numpy/f2py/tests/test_common.py,sha256=tLmi1JrfwFdTcBlUInxTn04f6Hf8eSB00sWRoKJvHrM,868
|
||||
numpy/f2py/tests/test_compile_function.py,sha256=gQG9PeMaXCcjlc233cEJb5eMoNFfvzAdkHf8qb7Css0,4256
|
||||
numpy/f2py/tests/test_kind.py,sha256=G6u6EWjVHenmPju3RQCa9bSeCJGDul3VyXFgp2_Yc7w,1078
|
||||
numpy/f2py/tests/test_mixed.py,sha256=jojC-g_G21G-ACCqlYFuOxZokx8iHikBcmxQWEdWSSc,902
|
||||
numpy/f2py/tests/test_parameter.py,sha256=_wX-gM-XGxA_mfDBM8np9NLjYiCF6LJbglwKf09JbdM,3976
|
||||
numpy/f2py/tests/test_quoted_character.py,sha256=Q0oDtl3STQqzSap5VYPpfzJJ72NtQchm6Vg-bwuoBl4,1029
|
||||
numpy/f2py/tests/test_regression.py,sha256=lPQUKx5RrVtGhyIvIcWS5GgA_CgQypabuuna-Q1z3hs,764
|
||||
numpy/f2py/tests/test_return_character.py,sha256=4a_JeEtY1AkT-Q-01iaZyqWLDGmZGW17d88JNFZoXTc,3864
|
||||
numpy/f2py/tests/test_return_complex.py,sha256=FO4oflCncNIft36R3Fe9uiyDtryiB-_d2PLMH3x64I4,4779
|
||||
numpy/f2py/tests/test_return_integer.py,sha256=cyyAbyHUepwYeyXlgIa2FD4B7A2dHnpp2jwx8ZDQiZQ,4749
|
||||
numpy/f2py/tests/test_return_logical.py,sha256=u3dazkOU1oz9kZKYXBd2GWaEr02MYfjGdLrb7kT8MiY,4974
|
||||
numpy/f2py/tests/test_return_real.py,sha256=QVRKzeO44ZuIlV8EycmtXaHT_i0rnX2bi3rOh7py4GM,5619
|
||||
numpy/f2py/tests/test_semicolon_split.py,sha256=v7YFx-oTbXUZZ4qjdblCYeVVtkD1YYa4CbuEf2LTOLs,1580
|
||||
numpy/f2py/tests/test_size.py,sha256=GV7S4tl8FhK60T_EpX86yVQo_bMVTdyOTB8fGVIQ24o,1352
|
||||
numpy/f2py/tests/test_string.py,sha256=LTQC9AFVsUAuJVFuH3Wltl-NfFIilVl0KvBNnEgdnmo,676
|
||||
numpy/f2py/tests/util.py,sha256=yFrVbn92WrvYutaHmuaMpECMiwB-YLANYaVu3r2C3h4,9703
|
||||
numpy/f2py/use_rules.py,sha256=L6nTSJnxougQ2PVAzR7s-1spidcfDp9tzLIFAJe3gUI,3652
|
||||
numpy/fft/__init__.py,sha256=Iug0-o3FLAHmQvkH733XPQW6QohMasp4a9LmkjjlvXg,254
|
||||
numpy/fft/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/fft/__pycache__/helper.cpython-37.pyc,,
|
||||
numpy/fft/__pycache__/info.cpython-37.pyc,,
|
||||
numpy/fft/__pycache__/pocketfft.cpython-37.pyc,,
|
||||
numpy/fft/__pycache__/setup.cpython-37.pyc,,
|
||||
numpy/fft/helper.py,sha256=vrKPnvFngxaag3nQA-OWzB9qsQctBk6vXaKsuQVMU0k,6271
|
||||
numpy/fft/info.py,sha256=831NwiCI33uiLx21G7kFCwzZuFxDfmU8n-2LG4FJm2w,7235
|
||||
numpy/fft/pocketfft.py,sha256=ubFIY7BmgQz6QOxwqaJD0DJf283zHGq-cYYJBtlp9IA,47831
|
||||
numpy/fft/pocketfft_internal.cp37-win_amd64.pyd,sha256=9Si3CWEsMr5dvFT36hYP3J6UdN6ulzrPPyhgOZePifA,109568
|
||||
numpy/fft/setup.py,sha256=UD9lAVBnoX53dghLNPRELRgJ9czkAor_JREG9eXAu88,540
|
||||
numpy/fft/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/fft/tests/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/fft/tests/__pycache__/test_helper.cpython-37.pyc,,
|
||||
numpy/fft/tests/__pycache__/test_pocketfft.cpython-37.pyc,,
|
||||
numpy/fft/tests/test_helper.py,sha256=Stwrak0FqjR3Wn41keelozyF_M45PL3jdhF3PjZVyIA,6326
|
||||
numpy/fft/tests/test_pocketfft.py,sha256=4AQAmqiSViLWMEYQYjoadANOp-FDsxWGntOjY-JVtq4,9602
|
||||
numpy/lib/__init__.py,sha256=NgwUuJaACbQF-qd9VLy6CEPwcZHk1GEdWPW0UhZPQl8,1358
|
||||
numpy/lib/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/_datasource.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/_iotools.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/_version.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/arraypad.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/arraysetops.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/arrayterator.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/financial.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/format.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/function_base.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/histograms.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/index_tricks.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/info.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/mixins.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/nanfunctions.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/npyio.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/polynomial.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/recfunctions.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/scimath.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/setup.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/shape_base.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/stride_tricks.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/twodim_base.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/type_check.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/ufunclike.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/user_array.cpython-37.pyc,,
|
||||
numpy/lib/__pycache__/utils.cpython-37.pyc,,
|
||||
numpy/lib/_datasource.py,sha256=jYNwX7pKyn-N9KzpSmrfKWbT5dXci7-VtDk4pL-vCDs,25521
|
||||
numpy/lib/_iotools.py,sha256=Nkv-GMaSyzHfkZvLSJLLQ-8uyMRsdyy6seM-Mn0gqCs,32738
|
||||
numpy/lib/_version.py,sha256=BIGo2hWBan0Qxt5C3JoPi4TXLPUv0T-FU9366Qu_5XY,4972
|
||||
numpy/lib/arraypad.py,sha256=gfTDoLW-nBrpIBsWOa-8wBJvxivKVWYEkoAtxIfZYnU,31079
|
||||
numpy/lib/arraysetops.py,sha256=YBnyIqYfbKgr7d9IK27e5vYAGMSeF7ZT3lRZ4rlhol4,24152
|
||||
numpy/lib/arrayterator.py,sha256=FTXwwzs5xzPxpUbZmE3J0ChjgesJD9TiqBA_bCI05SI,7207
|
||||
numpy/lib/financial.py,sha256=WHJFZT8uPNBq1sI1TLtQvz-7_vBhXHmEXvQL5r-4D2M,26028
|
||||
numpy/lib/format.py,sha256=Tg7VUx2fPsvrgERkycteBdl_8D3RUNCkLiiI7zN8RZE,31110
|
||||
numpy/lib/function_base.py,sha256=jN_lxxUSD9sySa2bWoN8ZQPxM2xB52GocK0MfFzAWVw,156286
|
||||
numpy/lib/histograms.py,sha256=ji4Nl9pKm5yk8bviMLBvwFodJN-KR8rpBe62KAgv2Fs,39639
|
||||
numpy/lib/index_tricks.py,sha256=dW4TEm_KcPtBYB9EQWCFKogVai3kXkPOgeVVIeBRlJo,29706
|
||||
numpy/lib/info.py,sha256=oVczF_pC_CMZC2h2adb2HHza_1qF3qI065j4RBrd-I4,6616
|
||||
numpy/lib/mixins.py,sha256=GeOiq01E663Z_06xQfIUYKpl2JPkswqhaQEernjnO_Q,7268
|
||||
numpy/lib/nanfunctions.py,sha256=6jpblHXktiR5xC26pNZSErAT-tWHdxLDbjUTnwsM5P4,58916
|
||||
numpy/lib/npyio.py,sha256=CtbzYLnSFaOOJo_5Av6-LMaimmWf-tiR4iBKAXawJNA,87514
|
||||
numpy/lib/polynomial.py,sha256=Q6zhfCH43bg2oKdtfaIQFrbxKLKrslCENHdh_r5wVZw,40727
|
||||
numpy/lib/recfunctions.py,sha256=jXS2srCUBo-hvLVKhbhKLMf4ynH9sGib16l6JGYxLgk,56721
|
||||
numpy/lib/scimath.py,sha256=hulwijLlO0q230XOrD5SRjlTY-9O7c1u68CeNjTgNl8,14789
|
||||
numpy/lib/setup.py,sha256=os9eV9wSzwTQlfxeoQ33gYQ4wOj1_6EvqcROc8PyGbE,379
|
||||
numpy/lib/shape_base.py,sha256=in9UdjfsfpyOiTS1NiI0J80zskt4OwnDE5vYGPz_S74,37996
|
||||
numpy/lib/stride_tricks.py,sha256=rwTBZ3o0AS2KxwOLGLDmk_5w6EVUi-X1P9sDXpM7yqM,9291
|
||||
numpy/lib/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/lib/tests/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test__datasource.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test__iotools.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test__version.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_arraypad.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_arraysetops.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_arrayterator.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_financial.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_format.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_function_base.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_histograms.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_index_tricks.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_io.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_mixins.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_nanfunctions.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_packbits.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_polynomial.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_recfunctions.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_regression.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_shape_base.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_stride_tricks.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_twodim_base.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_type_check.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_ufunclike.cpython-37.pyc,,
|
||||
numpy/lib/tests/__pycache__/test_utils.cpython-37.pyc,,
|
||||
numpy/lib/tests/data/py2-objarr.npy,sha256=F4cyUC-_TB9QSFLAo2c7c44rC6NUYIgrfGx9PqWPSKk,258
|
||||
numpy/lib/tests/data/py2-objarr.npz,sha256=xo13HBT0FbFZ2qvZz0LWGDb3SuQASSaXh7rKfVcJjx4,366
|
||||
numpy/lib/tests/data/py3-objarr.npy,sha256=pTTVh8ezp-lwAK3fkgvdKU8Arp5NMKznVD-M6Ex_uA0,341
|
||||
numpy/lib/tests/data/py3-objarr.npz,sha256=qQR0gS57e9ta16d_vCQjaaKM74gPdlwCPkp55P-qrdw,449
|
||||
numpy/lib/tests/data/python3.npy,sha256=X0ad3hAaLGXig9LtSHAo-BgOvLlFfPYMnZuVIxRmj-0,96
|
||||
numpy/lib/tests/data/win64python2.npy,sha256=agOcgHVYFJrV-nrRJDbGnUnF4ZTPYXuSeF-Mtg7GMpc,96
|
||||
numpy/lib/tests/test__datasource.py,sha256=5LwfmvIysaLHlCYkmsj46S7YRF2zRG4BmKSjjJr6fdE,11463
|
||||
numpy/lib/tests/test__iotools.py,sha256=7ocNK0I-XKtiJLxnq2Fq_Yszi-e-70Km7crI28Jyqww,13714
|
||||
numpy/lib/tests/test__version.py,sha256=eCeeSqb8G3WNtCgkM3XGz9Zszyye-KFDlNQ7EY2J_UY,2055
|
||||
numpy/lib/tests/test_arraypad.py,sha256=6zSyzc8IB7US3m8_1t-7H65X9WusF7yrqPyXG7CULB4,53048
|
||||
numpy/lib/tests/test_arraysetops.py,sha256=WsH_vJI5guzG9Mix0y-kwVceTZ8e-aKJxEaf_RNTcbE,22157
|
||||
numpy/lib/tests/test_arrayterator.py,sha256=run7iWWbvoHGGsDv_uB6G8QENFzOCSgUIxAMVp7ZMu4,1357
|
||||
numpy/lib/tests/test_financial.py,sha256=8cCdlpNixwl1Wrgblemxi3ndTxX_Sq2yr-30lSURnq0,17098
|
||||
numpy/lib/tests/test_format.py,sha256=tSdJ8HNcI5imlrSAloIkNQVIynXZpd9AiQ5NYdAt694,37946
|
||||
numpy/lib/tests/test_function_base.py,sha256=nsFT0-wop8rh9lodAwnBKK18h6za_aW6TBhLF8TF4L0,122243
|
||||
numpy/lib/tests/test_histograms.py,sha256=FiPG5fy6SKuXjElxgQo_zldn2embrKnmOsRHKBIQZDE,33270
|
||||
numpy/lib/tests/test_index_tricks.py,sha256=pdH1gH44kSMHVBzrxlcG1pzVJiw43IUQch264g-XToA,17724
|
||||
numpy/lib/tests/test_io.py,sha256=sCKKJH_78kh2k8qmKq4iQMbbShV8ezmvCgR4FjjMQBE,100339
|
||||
numpy/lib/tests/test_mixins.py,sha256=YNIKF716Jz7V8FJ8Zzww_F6laTD8j3A6SBxCXqt6rAQ,7233
|
||||
numpy/lib/tests/test_nanfunctions.py,sha256=wdY154jfVkobIk808Z4H2Bx4WO1kF6jSMH2-ivjFNS0,37229
|
||||
numpy/lib/tests/test_packbits.py,sha256=D0lwihTICKvUm9LTIIs7R16kVK-yZddeCAGnJk6TkEM,17612
|
||||
numpy/lib/tests/test_polynomial.py,sha256=NhCF2nGmc43KraPfR6LCBD8M-i-xZKwIsLYPFXNi0WE,10087
|
||||
numpy/lib/tests/test_recfunctions.py,sha256=02oi2Fp4p-siX0g4YoVVoT9bRlCufcwggTuthL89hgg,41177
|
||||
numpy/lib/tests/test_regression.py,sha256=96pKecYGHPZwAoHV3_kLvl3gIb0PN0m33R0H3dd7uSk,8472
|
||||
numpy/lib/tests/test_shape_base.py,sha256=nVUzbHADBmrOaOHeh5fA27gjxsnOC3r-S5lyo1n5MV8,23979
|
||||
numpy/lib/tests/test_stride_tricks.py,sha256=KCC5XRbKzOXvWo3Pboj9oJ9b0Fw3dCh7bY0HLAOP0_8,17110
|
||||
numpy/lib/tests/test_twodim_base.py,sha256=gcrJ43TvAKVqTdWGDx9Dcs79oZtiT6lswS3FVcpt3QQ,18504
|
||||
numpy/lib/tests/test_type_check.py,sha256=c9RaZtw85vqRVzsOV1lAgdmFm9V5VgRRfpn-X8Fcv3E,15398
|
||||
numpy/lib/tests/test_ufunclike.py,sha256=VFt_8BDH7q80yXmYJSn1crolIMizKFN3mAJcigaazLU,3350
|
||||
numpy/lib/tests/test_utils.py,sha256=4v1ZRTeBbdje3MpnRCVNtRJLEUgpT2qJblUMVB1C89A,3456
|
||||
numpy/lib/twodim_base.py,sha256=fUd-LLaInaXhPfi1JQUlnyESaGiok7V0kgfqKpduNgM,27642
|
||||
numpy/lib/type_check.py,sha256=ZIsjeFMVzD6Tb2W0t9WWSNT8r08z8q0Cj9MxEg-CcU4,19673
|
||||
numpy/lib/ufunclike.py,sha256=CB_OBC_pbhtNbuheM-21DIxMArdXIhiyaaSOMN42ZvA,7294
|
||||
numpy/lib/user_array.py,sha256=7nJPlDfP-04Lcq8iH_cqBbSEsx5cHCcj-2Py-oh-5t0,7817
|
||||
numpy/lib/utils.py,sha256=cszhN4sU8WlFDqVp9vQH23rzqj8o0sqZyg-bUm7s-hs,36735
|
||||
numpy/linalg/__init__.py,sha256=P2q5fyWhZEc-xhcruFEcHWmYhSBOWSr63i9UjE8x3fk,2326
|
||||
numpy/linalg/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/linalg/__pycache__/info.cpython-37.pyc,,
|
||||
numpy/linalg/__pycache__/linalg.cpython-37.pyc,,
|
||||
numpy/linalg/__pycache__/setup.cpython-37.pyc,,
|
||||
numpy/linalg/_umath_linalg.cp37-win_amd64.pyd,sha256=tzLlypPe7ln0RnOrAoDJaxZtPRIMZ_XskI--a2H6ilw,130560
|
||||
numpy/linalg/info.py,sha256=AbXPYYabJK5In0F9IMk-oVWZgDyEaoU45Wnq6RtuCJs,1198
|
||||
numpy/linalg/lapack_lite.cp37-win_amd64.pyd,sha256=YcDBpTWai7sLEqPf-HUOGxLjwF04LAYYhsPJx5TzWgg,23552
|
||||
numpy/linalg/linalg.py,sha256=Js8YjBIE3qiZWGSdPbOl5fHQwpUuPmmrcSx6GvEPT-M,86449
|
||||
numpy/linalg/setup.py,sha256=k1X4EfRWACFtJYfb8Wiol_-pPnEMtqURxQ8H9FwFHWg,1878
|
||||
numpy/linalg/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/linalg/tests/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/linalg/tests/__pycache__/test_build.cpython-37.pyc,,
|
||||
numpy/linalg/tests/__pycache__/test_deprecations.cpython-37.pyc,,
|
||||
numpy/linalg/tests/__pycache__/test_linalg.cpython-37.pyc,,
|
||||
numpy/linalg/tests/__pycache__/test_regression.cpython-37.pyc,,
|
||||
numpy/linalg/tests/test_build.py,sha256=xKcJ8JmGk-zTqxxMhDX5GFsw-ptn8uwOUOcxaTUuPHc,1704
|
||||
numpy/linalg/tests/test_deprecations.py,sha256=eGYDVF3rmGQyDEMGOc-p_zc84Cx1I3jQPyaJe7xOvEc,706
|
||||
numpy/linalg/tests/test_linalg.py,sha256=pWOn63txWYl-1q4S5sf5ro77IEkyWc_yLBLjIN3-TIs,71320
|
||||
numpy/linalg/tests/test_regression.py,sha256=zz7lprqDg7yU-z1d6AOdCDH3Tjqgw82QGiaPM7peixY,5671
|
||||
numpy/ma/__init__.py,sha256=fcmMCElT3MmCkjIGVhXyEAbjuWe_j1NVUiE65eAMvy0,1470
|
||||
numpy/ma/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/ma/__pycache__/bench.cpython-37.pyc,,
|
||||
numpy/ma/__pycache__/core.cpython-37.pyc,,
|
||||
numpy/ma/__pycache__/extras.cpython-37.pyc,,
|
||||
numpy/ma/__pycache__/mrecords.cpython-37.pyc,,
|
||||
numpy/ma/__pycache__/setup.cpython-37.pyc,,
|
||||
numpy/ma/__pycache__/testutils.cpython-37.pyc,,
|
||||
numpy/ma/__pycache__/timer_comparison.cpython-37.pyc,,
|
||||
numpy/ma/__pycache__/version.cpython-37.pyc,,
|
||||
numpy/ma/bench.py,sha256=q3y_e1wpHVEdg0iIxrBshWVt2LOFfYi6q-eIJ3RSVrU,4942
|
||||
numpy/ma/core.py,sha256=GSX9r1h40zAT-yOhJ7z-6N21VnTIrRjEJf3plyVMGr0,260420
|
||||
numpy/ma/extras.py,sha256=4-dt1gD8d4CVE81Pk9NmdM7i2CcrOot4y7ldxRPCvf8,57942
|
||||
numpy/ma/mrecords.py,sha256=zvJShTlgl96QEB5MVNhsvOBjW42FBqd5njknSmNsJIg,26889
|
||||
numpy/ma/setup.py,sha256=zkieH8BeiGVXl3Wlt_WeP9kciZlyAZY20DDu4SGk4b4,429
|
||||
numpy/ma/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/ma/tests/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/ma/tests/__pycache__/test_core.cpython-37.pyc,,
|
||||
numpy/ma/tests/__pycache__/test_deprecations.cpython-37.pyc,,
|
||||
numpy/ma/tests/__pycache__/test_extras.cpython-37.pyc,,
|
||||
numpy/ma/tests/__pycache__/test_mrecords.cpython-37.pyc,,
|
||||
numpy/ma/tests/__pycache__/test_old_ma.cpython-37.pyc,,
|
||||
numpy/ma/tests/__pycache__/test_regression.cpython-37.pyc,,
|
||||
numpy/ma/tests/__pycache__/test_subclassing.cpython-37.pyc,,
|
||||
numpy/ma/tests/test_core.py,sha256=Aw3Y6bnZ8u4r-TANSrTzP2t2R5lWDbJPYxmCrtBttuw,196578
|
||||
numpy/ma/tests/test_deprecations.py,sha256=StN-maPV6dwIPn1LmJ_Fd9l_Ysrbzvl8BZy6zYeUru8,2340
|
||||
numpy/ma/tests/test_extras.py,sha256=s6LXkSjLYzn9sUc1jXD62vS_mpMylOZFHLL6Q32Sdec,65467
|
||||
numpy/ma/tests/test_mrecords.py,sha256=G46t_9Kzo7wNv1N_Lb3zG4s6LMuXVir1NtMKDaKVdn8,19960
|
||||
numpy/ma/tests/test_old_ma.py,sha256=_UAGBpJU7NHt46qcKBOR3NiIXqyukOOV7MyjhdLoRZ8,32352
|
||||
numpy/ma/tests/test_regression.py,sha256=Kq1OAjXuAyTv0J7UcWmQNd-nk8aFcU-5Vu84HPPK2Fs,3156
|
||||
numpy/ma/tests/test_subclassing.py,sha256=l4srPFjFT0jR51e9hbumLCawR9sqQ4cdH4QwY1t6Xek,12966
|
||||
numpy/ma/testutils.py,sha256=meyy8_0sx4g2sebsVO1PrFSc6ogLzEU7vjOuu2VjY1U,10365
|
||||
numpy/ma/timer_comparison.py,sha256=BCWzBW_z6M3k3Mfe-7ThiPEBF4a12J4ZXGIxFxXkY9c,15548
|
||||
numpy/ma/version.py,sha256=KpJAmUE1s1TpbgqgdBpDoslxm7kOMpczLjEzLMGv9Ag,380
|
||||
numpy/matlib.py,sha256=YU8lBBtj8fJfDUnqYIlrFBQB0EfkD3bwvQc0TN9UQl4,9694
|
||||
numpy/matrixlib/__init__.py,sha256=W-2bi7zuMWQY5U1ikwfaBPubrcYkbxzPzzIeYz3RYPA,284
|
||||
numpy/matrixlib/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/matrixlib/__pycache__/defmatrix.cpython-37.pyc,,
|
||||
numpy/matrixlib/__pycache__/setup.cpython-37.pyc,,
|
||||
numpy/matrixlib/defmatrix.py,sha256=3KcIZ6CqIp71vHBoh0qt2lgJ0DjDBcUhmMtJG7h5DJY,30715
|
||||
numpy/matrixlib/setup.py,sha256=7DS-rWnyWlLTuOj31UuhkyW8QhLQ7KD5wirtWT_DUhc,437
|
||||
numpy/matrixlib/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/matrixlib/tests/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/matrixlib/tests/__pycache__/test_defmatrix.cpython-37.pyc,,
|
||||
numpy/matrixlib/tests/__pycache__/test_interaction.cpython-37.pyc,,
|
||||
numpy/matrixlib/tests/__pycache__/test_masked_matrix.cpython-37.pyc,,
|
||||
numpy/matrixlib/tests/__pycache__/test_matrix_linalg.cpython-37.pyc,,
|
||||
numpy/matrixlib/tests/__pycache__/test_multiarray.cpython-37.pyc,,
|
||||
numpy/matrixlib/tests/__pycache__/test_numeric.cpython-37.pyc,,
|
||||
numpy/matrixlib/tests/__pycache__/test_regression.cpython-37.pyc,,
|
||||
numpy/matrixlib/tests/test_defmatrix.py,sha256=FRkFPpDpgUEzEAgShORCVhPOuqclxBftHyEW5z2oV4o,15315
|
||||
numpy/matrixlib/tests/test_interaction.py,sha256=y0ldcMIKCeT_tRo_uON6Cvxuff-M4MxmqnzA0kDFHYU,12179
|
||||
numpy/matrixlib/tests/test_masked_matrix.py,sha256=jbmuf5BQjsae6kXZtH8XJ8TI5JJYDIZ0PZhGKBbxnmY,8925
|
||||
numpy/matrixlib/tests/test_matrix_linalg.py,sha256=XYsAcC02YgvlfqAQOLY2hOuggeRlRhkztNsLYWGb4QQ,2125
|
||||
numpy/matrixlib/tests/test_multiarray.py,sha256=jM-cFU_ktanoyJ0ScRYv5xwohhE3pKpVhBBtd31b-IQ,628
|
||||
numpy/matrixlib/tests/test_numeric.py,sha256=YPq5f11MUAV6WcLQbl8xKWcm17lMj9SJ09mamqGCpxA,515
|
||||
numpy/matrixlib/tests/test_regression.py,sha256=ou1TP5bFNpjRaL2-zQxzS11ChwvAkCVp3k71SBtOO9M,1001
|
||||
numpy/polynomial/__init__.py,sha256=boBgsbz2Rr49pBTyGNT3TnLRTPSauyjBNeCVGek7oUM,1134
|
||||
numpy/polynomial/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/polynomial/__pycache__/_polybase.cpython-37.pyc,,
|
||||
numpy/polynomial/__pycache__/chebyshev.cpython-37.pyc,,
|
||||
numpy/polynomial/__pycache__/hermite.cpython-37.pyc,,
|
||||
numpy/polynomial/__pycache__/hermite_e.cpython-37.pyc,,
|
||||
numpy/polynomial/__pycache__/laguerre.cpython-37.pyc,,
|
||||
numpy/polynomial/__pycache__/legendre.cpython-37.pyc,,
|
||||
numpy/polynomial/__pycache__/polynomial.cpython-37.pyc,,
|
||||
numpy/polynomial/__pycache__/polyutils.cpython-37.pyc,,
|
||||
numpy/polynomial/__pycache__/setup.cpython-37.pyc,,
|
||||
numpy/polynomial/_polybase.py,sha256=HOIXM-w5L_TVFdWR72K_RtidpR8zHqNARoeVwf6gor8,33093
|
||||
numpy/polynomial/chebyshev.py,sha256=i9DVznFPioqL97t-ioUdxMOO0XTUmXkq77Ki68ZWC_Y,63218
|
||||
numpy/polynomial/hermite.py,sha256=7UVmOEUhyASim2x39lhCBKb5ujRPMz8uYaaXSkYyNYc,52601
|
||||
numpy/polynomial/hermite_e.py,sha256=vUMXAzFJQCPOkuk0lycJzDkRY0Hq3hcQJWBLEk02sPM,52780
|
||||
numpy/polynomial/laguerre.py,sha256=zfH1sKtLq1VTx3CvgwMh9sOn9g3oILjnlxWWPDR__1M,51039
|
||||
numpy/polynomial/legendre.py,sha256=Hv0h0JARKxVZWjU_DdJvkeN3m3ZBuWD8x0qGIVFrwHw,52440
|
||||
numpy/polynomial/polynomial.py,sha256=thHjU4v5KqhC5d6nK8ZdeCyO5-9__7e24Ji90Wz1Pr8,48632
|
||||
numpy/polynomial/polyutils.py,sha256=ZwRzJ3ZX41q89mRuyiCRGRIAXZGSRL0Vs1iyKbQ6xzA,21456
|
||||
numpy/polynomial/setup.py,sha256=PKIUV6Jh7_0jBboPp3IHPmp6LWVs4tbIkdu_FtmI_5U,385
|
||||
numpy/polynomial/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/polynomial/tests/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/polynomial/tests/__pycache__/test_chebyshev.cpython-37.pyc,,
|
||||
numpy/polynomial/tests/__pycache__/test_classes.cpython-37.pyc,,
|
||||
numpy/polynomial/tests/__pycache__/test_hermite.cpython-37.pyc,,
|
||||
numpy/polynomial/tests/__pycache__/test_hermite_e.cpython-37.pyc,,
|
||||
numpy/polynomial/tests/__pycache__/test_laguerre.cpython-37.pyc,,
|
||||
numpy/polynomial/tests/__pycache__/test_legendre.cpython-37.pyc,,
|
||||
numpy/polynomial/tests/__pycache__/test_polynomial.cpython-37.pyc,,
|
||||
numpy/polynomial/tests/__pycache__/test_polyutils.cpython-37.pyc,,
|
||||
numpy/polynomial/tests/__pycache__/test_printing.cpython-37.pyc,,
|
||||
numpy/polynomial/tests/test_chebyshev.py,sha256=Vda4vCJtdIAPs0tsbXexnw4kaaou30FjZ0gQxNxOcz8,20716
|
||||
numpy/polynomial/tests/test_classes.py,sha256=18hEEMQHB3o1roK4nlPrawv9pFif2gur6lkEBoxZAFg,20370
|
||||
numpy/polynomial/tests/test_hermite.py,sha256=3zU7T69fuFvn5gDOG34SCnyDm_pVvTVlcpUMlhoU2V0,18755
|
||||
numpy/polynomial/tests/test_hermite_e.py,sha256=06gCjnh0s-1h7jWpmJyjQdfzAK_4kywto7hHuQ7NmJQ,19089
|
||||
numpy/polynomial/tests/test_laguerre.py,sha256=O5zxZQ5GIOZrx4b0ttCUoDxmb3ifhwDRcq--hYyt3zU,17689
|
||||
numpy/polynomial/tests/test_legendre.py,sha256=2y8xF4PdU-uS7OjuIzMC6DAeVc9mlW83xj_N4NSGhSY,18453
|
||||
numpy/polynomial/tests/test_polynomial.py,sha256=MD4xxU3yWSbMK9B5wpYLQOeWZj0mH7g9p9ifMVhPQF4,20080
|
||||
numpy/polynomial/tests/test_polyutils.py,sha256=GzRz3leypd2UrWE-EwuIWL0lbbj6ks6Mjli3tozDN9U,3081
|
||||
numpy/polynomial/tests/test_printing.py,sha256=_7O-05q3JEjdxmuzBdWxligQVdC6qGygKmbhfiYW9KQ,2067
|
||||
numpy/random/__init__.py,sha256=l1xPXYVC3_Z1HT51Ffqjj0_bWvVTr1NXX6vdOIk4Tio,7543
|
||||
numpy/random/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/random/__pycache__/_pickle.cpython-37.pyc,,
|
||||
numpy/random/__pycache__/info.cpython-37.pyc,,
|
||||
numpy/random/__pycache__/setup.cpython-37.pyc,,
|
||||
numpy/random/_pickle.py,sha256=7cLTLWugdMr8d-1ysGnSDCUk6-K8qtJzEHKE8oKbCOg,2242
|
||||
numpy/random/bit_generator.cp37-win_amd64.pyd,sha256=13STGGjSCQNqggoHaqAaEs-XFsddCTBoGSGgI3hOVHQ,155648
|
||||
numpy/random/bit_generator.pxd,sha256=pRlpkJJU6mo36S-klQAPpV8XlyuwhkELaqp4m4zLj-k,703
|
||||
numpy/random/bounded_integers.cp37-win_amd64.pyd,sha256=iK21BpLBdIceoaRKnbbTGg8QwRY8Dn5WIvYGxgPnoAI,248320
|
||||
numpy/random/common.cp37-win_amd64.pyd,sha256=FwL1GOiWhgcHYbl1m5sivVWmsY9lIt4PTaYfjw1ZZKQ,172544
|
||||
numpy/random/common.pxd,sha256=UwhFXG1puH7i3nbk44kH9l9cyD3kUfQVQeRX48iHF3I,5012
|
||||
numpy/random/entropy.cp37-win_amd64.pyd,sha256=iD3wg3o9KtSF_Np4Ui9Tm585U-ZYt4lfw4jC97OFX6w,161280
|
||||
numpy/random/generator.cp37-win_amd64.pyd,sha256=VLa2P0k3Fmxm844XM8iBFuILVvB7i7mIBVOZl0wa8hw,598016
|
||||
numpy/random/info.py,sha256=OzPLVv_aA7kxLu9WdGiRqO2_yA2163PWQi3Lwwrhs3E,109
|
||||
numpy/random/mt19937.cp37-win_amd64.pyd,sha256=BQT2Ng29I6fI8deiVaE5JaFnGlq2nEqLkycVH3XIbVM,98816
|
||||
numpy/random/mtrand.cp37-win_amd64.pyd,sha256=nN5ygxFly_nYL3MmiouGRWDhknKmdsbpGTD2zIlnixo,529920
|
||||
numpy/random/pcg64.cp37-win_amd64.pyd,sha256=SDSsn6GAufrbZcrej_hqdICHbQd9-_TIXN0dTqIAzZo,65024
|
||||
numpy/random/philox.cp37-win_amd64.pyd,sha256=N50AyaAtSejynyV9S8tpME9Cqgv7TuvFOG8Wpkg51-c,73728
|
||||
numpy/random/setup.py,sha256=7JVPC5ovLO-URS68bVbdgKDQ7ieEh7MXW_pO526j4Mk,6437
|
||||
numpy/random/sfc64.cp37-win_amd64.pyd,sha256=MxCvd6qJiwEX23PpaaiiWEV_6cgoDlUFdZLR4SRNoHs,52736
|
||||
numpy/random/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/random/tests/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/random/tests/__pycache__/test_direct.cpython-37.pyc,,
|
||||
numpy/random/tests/__pycache__/test_generator_mt19937.cpython-37.pyc,,
|
||||
numpy/random/tests/__pycache__/test_generator_mt19937_regressions.cpython-37.pyc,,
|
||||
numpy/random/tests/__pycache__/test_random.cpython-37.pyc,,
|
||||
numpy/random/tests/__pycache__/test_randomstate.cpython-37.pyc,,
|
||||
numpy/random/tests/__pycache__/test_randomstate_regression.cpython-37.pyc,,
|
||||
numpy/random/tests/__pycache__/test_regression.cpython-37.pyc,,
|
||||
numpy/random/tests/__pycache__/test_seed_sequence.cpython-37.pyc,,
|
||||
numpy/random/tests/__pycache__/test_smoke.cpython-37.pyc,,
|
||||
numpy/random/tests/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/random/tests/data/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/random/tests/data/mt19937-testset-1.csv,sha256=Xkef402AVB-eZgYQkVtoxERHkxffCA9Jyt_oMbtJGwY,15844
|
||||
numpy/random/tests/data/mt19937-testset-2.csv,sha256=nsBEQNnff-aFjHYK4thjvUK4xSXDSfv5aTbcE59pOkE,15825
|
||||
numpy/random/tests/data/pcg64-testset-1.csv,sha256=xB00DpknGUTTCxDr9L6aNo9Hs-sfzEMbUSS4t11TTfE,23839
|
||||
numpy/random/tests/data/pcg64-testset-2.csv,sha256=NTdzTKvG2U7_WyU_IoQUtMzU3kEvDH39CgnR6VzhTkw,23845
|
||||
numpy/random/tests/data/philox-testset-1.csv,sha256=SedRaIy5zFadmk71nKrGxCFZ6BwKz8g1A9-OZp3IkkY,23852
|
||||
numpy/random/tests/data/philox-testset-2.csv,sha256=dWECt-sbfvaSiK8-Ygp5AqyjoN5i26VEOrXqg01rk3g,23838
|
||||
numpy/random/tests/data/sfc64-testset-1.csv,sha256=iHs6iX6KR8bxGwKk-3tedAdMPz6ZW8slDSUECkAqC8Q,23840
|
||||
numpy/random/tests/data/sfc64-testset-2.csv,sha256=FIDIDFCaPZfWUSxsJMAe58hPNmMrU27kCd9FhCEYt_k,23833
|
||||
numpy/random/tests/test_direct.py,sha256=vs6z8PWBVUBwtSftqDVQbUUq6351CgHlukV_vRlQ1MA,14264
|
||||
numpy/random/tests/test_generator_mt19937.py,sha256=5TKqffdd4jdF1lFv1auDEK3t8XKzVeNqTzeUetdy8VI,84921
|
||||
numpy/random/tests/test_generator_mt19937_regressions.py,sha256=ldeCEO3N6dCAGA1g8YnqEwRTQAiv6tBuY9xuAELJNCQ,5834
|
||||
numpy/random/tests/test_random.py,sha256=l-cB-lp7dAxMqSuzK3t5ZUFxU1Pa-N1FTGD26HjklpY,66835
|
||||
numpy/random/tests/test_randomstate.py,sha256=SM1qJvm89CHbQtF3Niq9EVDB8usBw2su920m4qZ3OTA,78059
|
||||
numpy/random/tests/test_randomstate_regression.py,sha256=gUaMXHm0OWKbu4aff1KWeMDSzPMQLljmr-AMrvs7c5s,6486
|
||||
numpy/random/tests/test_regression.py,sha256=_M-We4kY74tXPonJjWN7rMXF5SoxHMapl1zM08-6p0w,5683
|
||||
numpy/random/tests/test_seed_sequence.py,sha256=uBgBOYu5pl7TztTETrTvgsrym7geTCv5LiK6yGsLMTM,2393
|
||||
numpy/random/tests/test_smoke.py,sha256=bE7TRk3m8NrS9nPYLtoCf04QiXe9t8rHddN-jugVobw,28516
|
||||
numpy/setup.py,sha256=lsyhnRXfo0ybq63nVUX8HnYhQ1mI0bSic-mk-lK3wnc,920
|
||||
numpy/testing/__init__.py,sha256=MHRK5eimwrC9RE723HlOcOQGxu5HAmQ-qwlcVX1sZ1k,632
|
||||
numpy/testing/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/testing/__pycache__/decorators.cpython-37.pyc,,
|
||||
numpy/testing/__pycache__/noseclasses.cpython-37.pyc,,
|
||||
numpy/testing/__pycache__/nosetester.cpython-37.pyc,,
|
||||
numpy/testing/__pycache__/print_coercion_tables.cpython-37.pyc,,
|
||||
numpy/testing/__pycache__/setup.cpython-37.pyc,,
|
||||
numpy/testing/__pycache__/utils.cpython-37.pyc,,
|
||||
numpy/testing/_private/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/testing/_private/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/testing/_private/__pycache__/decorators.cpython-37.pyc,,
|
||||
numpy/testing/_private/__pycache__/noseclasses.cpython-37.pyc,,
|
||||
numpy/testing/_private/__pycache__/nosetester.cpython-37.pyc,,
|
||||
numpy/testing/_private/__pycache__/parameterized.cpython-37.pyc,,
|
||||
numpy/testing/_private/__pycache__/utils.cpython-37.pyc,,
|
||||
numpy/testing/_private/decorators.py,sha256=JSIBsQH4t1rdMcr1-Cf2jBJ6CXzIGEFyZoWxUJuXI7M,9015
|
||||
numpy/testing/_private/noseclasses.py,sha256=nYtV16KcoqAcHswfYO-u6bRIrDBvCvpqjCNfl7zk-SA,14601
|
||||
numpy/testing/_private/nosetester.py,sha256=S1nEtDBvNT87Zrt8XmuSVIBWpanJwjtD1YiRlcf7eoA,20515
|
||||
numpy/testing/_private/parameterized.py,sha256=S_cqBegd7kdwVq1kg_DAnywwFPT_g1bjDJ6-LMq0LO4,18316
|
||||
numpy/testing/_private/utils.py,sha256=aZSOpZRK9nqKeIBMt-kLOToOpOy-Xy-PELGNS7Cr1dM,79999
|
||||
numpy/testing/decorators.py,sha256=BEktn0PuVlmgUQ_zGVNXu0wQYh3W0_bu61LnQPrxY20,428
|
||||
numpy/testing/noseclasses.py,sha256=iZmGKPHAGQIshsEONB-oLt7gHPzx2Bg57oat_M4M5XE,423
|
||||
numpy/testing/nosetester.py,sha256=as3E0khSkTseCRpyvtOSSq4fJY1K1lrrAyIcXOErTMo,583
|
||||
numpy/testing/print_coercion_tables.py,sha256=F44AObcou_xytUWszku8t1bWuui-4I_18o7Z7zW8l18,2705
|
||||
numpy/testing/setup.py,sha256=9PnlgcejccUBzaGPi9Po-ElhmuQMAmWCBRdvCDwiKYw,676
|
||||
numpy/testing/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/testing/tests/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/testing/tests/__pycache__/test_decorators.cpython-37.pyc,,
|
||||
numpy/testing/tests/__pycache__/test_doctesting.cpython-37.pyc,,
|
||||
numpy/testing/tests/__pycache__/test_utils.cpython-37.pyc,,
|
||||
numpy/testing/tests/test_decorators.py,sha256=mkMCPSPJdrKxQl93u0QlIEdp5JS0tCzgLHXuoYDDvzs,6001
|
||||
numpy/testing/tests/test_doctesting.py,sha256=sKBXwuRZwMFSiem3R9egBzzSUB81kkpw9y-Y07iqU2M,1413
|
||||
numpy/testing/tests/test_utils.py,sha256=9nx61VdhoiLA0rP0yYah6OoUDsUIsczPLHpBO1gVABA,53376
|
||||
numpy/testing/utils.py,sha256=3Z2wHEc2f-0lZrdDueAdbe96KQw1DqM_aFosea9VRtY,1232
|
||||
numpy/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
numpy/tests/__pycache__/__init__.cpython-37.pyc,,
|
||||
numpy/tests/__pycache__/test_ctypeslib.cpython-37.pyc,,
|
||||
numpy/tests/__pycache__/test_matlib.cpython-37.pyc,,
|
||||
numpy/tests/__pycache__/test_numpy_version.cpython-37.pyc,,
|
||||
numpy/tests/__pycache__/test_public_api.cpython-37.pyc,,
|
||||
numpy/tests/__pycache__/test_reloading.cpython-37.pyc,,
|
||||
numpy/tests/__pycache__/test_scripts.cpython-37.pyc,,
|
||||
numpy/tests/__pycache__/test_warnings.cpython-37.pyc,,
|
||||
numpy/tests/test_ctypeslib.py,sha256=Fy_dBd80RrBufyeXISkBu6kS3X700qOD5ob0pDjRssg,12276
|
||||
numpy/tests/test_matlib.py,sha256=WKILeEOe3NdKP_XAy-uCs4VEi7r_ghQ7NUhIgH1LzoM,2158
|
||||
numpy/tests/test_numpy_version.py,sha256=VtTTZAPnsJ8xtKLy1qYqIwrpcjTtqJ9xP9qP5-p8DbU,647
|
||||
numpy/tests/test_public_api.py,sha256=k1nwiT9wJqbViUJwtHVdxvRYUgSqsFpjiGPLxYDQA6w,3389
|
||||
numpy/tests/test_reloading.py,sha256=k_J-pWB1mO4XoSAqOZ-qgpsn5It6yXgcRvNs1wxbcoY,1298
|
||||
numpy/tests/test_scripts.py,sha256=SxlQPb8EttfP4V5iGJyXMBtDWTS3EcYVBN-JWDTtSy4,1637
|
||||
numpy/tests/test_warnings.py,sha256=38bAtHc0P2uZ8c2Y9TQse3k6KBtPnvix8Q7OlF3WgZw,2594
|
||||
numpy/version.py,sha256=Bhmkuv_TFXH2wafiPSDtpX4lqXWqw6XniP83BACZPnw,306
|
@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.33.6)
|
||||
Root-Is-Purelib: false
|
||||
Tag: cp37-cp37m-win_amd64
|
||||
|
@ -0,0 +1,3 @@
|
||||
[console_scripts]
|
||||
f2py = numpy.f2py.f2py2e:main
|
||||
|
@ -0,0 +1 @@
|
||||
numpy
|
Binary file not shown.
@ -0,0 +1,37 @@
|
||||
# This file is generated by numpy's setup.py
|
||||
# It contains system_info results at the time of building this package.
|
||||
__all__ = ["get_info","show"]
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
extra_dll_dir = os.path.join(os.path.dirname(__file__), '.libs')
|
||||
|
||||
if sys.platform == 'win32' and os.path.isdir(extra_dll_dir):
|
||||
os.environ.setdefault('PATH', '')
|
||||
os.environ['PATH'] += os.pathsep + extra_dll_dir
|
||||
|
||||
blas_mkl_info={}
|
||||
blis_info={}
|
||||
openblas_info={'library_dirs': ['C:\\projects\\numpy-wheels\\numpy\\build\\openblas'], 'libraries': ['openblas'], 'language': 'f77', 'define_macros': [('HAVE_CBLAS', None)]}
|
||||
blas_opt_info={'library_dirs': ['C:\\projects\\numpy-wheels\\numpy\\build\\openblas'], 'libraries': ['openblas'], 'language': 'f77', 'define_macros': [('HAVE_CBLAS', None)]}
|
||||
lapack_mkl_info={}
|
||||
openblas_lapack_info={'library_dirs': ['C:\\projects\\numpy-wheels\\numpy\\build\\openblas'], 'libraries': ['openblas'], 'language': 'f77', 'define_macros': [('HAVE_CBLAS', None)]}
|
||||
lapack_opt_info={'library_dirs': ['C:\\projects\\numpy-wheels\\numpy\\build\\openblas'], 'libraries': ['openblas'], 'language': 'f77', 'define_macros': [('HAVE_CBLAS', None)]}
|
||||
|
||||
def get_info(name):
|
||||
g = globals()
|
||||
return g.get(name, g.get(name + "_info", {}))
|
||||
|
||||
def show():
|
||||
for name,info_dict in globals().items():
|
||||
if name[0] == "_" or type(info_dict) is not type({}): continue
|
||||
print(name + ":")
|
||||
if not info_dict:
|
||||
print(" NOT AVAILABLE")
|
||||
for k,v in info_dict.items():
|
||||
v = str(v)
|
||||
if k == "sources" and len(v) > 200:
|
||||
v = v[:60] + " ...\n... " + v[-60:]
|
||||
print(" %s = %s" % (k,v))
|
@ -0,0 +1,219 @@
|
||||
"""
|
||||
NumPy
|
||||
=====
|
||||
|
||||
Provides
|
||||
1. An array object of arbitrary homogeneous items
|
||||
2. Fast mathematical operations over arrays
|
||||
3. Linear Algebra, Fourier Transforms, Random Number Generation
|
||||
|
||||
How to use the documentation
|
||||
----------------------------
|
||||
Documentation is available in two forms: docstrings provided
|
||||
with the code, and a loose standing reference guide, available from
|
||||
`the NumPy homepage <https://www.scipy.org>`_.
|
||||
|
||||
We recommend exploring the docstrings using
|
||||
`IPython <https://ipython.org>`_, an advanced Python shell with
|
||||
TAB-completion and introspection capabilities. See below for further
|
||||
instructions.
|
||||
|
||||
The docstring examples assume that `numpy` has been imported as `np`::
|
||||
|
||||
>>> import numpy as np
|
||||
|
||||
Code snippets are indicated by three greater-than signs::
|
||||
|
||||
>>> x = 42
|
||||
>>> x = x + 1
|
||||
|
||||
Use the built-in ``help`` function to view a function's docstring::
|
||||
|
||||
>>> help(np.sort)
|
||||
... # doctest: +SKIP
|
||||
|
||||
For some objects, ``np.info(obj)`` may provide additional help. This is
|
||||
particularly true if you see the line "Help on ufunc object:" at the top
|
||||
of the help() page. Ufuncs are implemented in C, not Python, for speed.
|
||||
The native Python help() does not know how to view their help, but our
|
||||
np.info() function does.
|
||||
|
||||
To search for documents containing a keyword, do::
|
||||
|
||||
>>> np.lookfor('keyword')
|
||||
... # doctest: +SKIP
|
||||
|
||||
General-purpose documents like a glossary and help on the basic concepts
|
||||
of numpy are available under the ``doc`` sub-module::
|
||||
|
||||
>>> from numpy import doc
|
||||
>>> help(doc)
|
||||
... # doctest: +SKIP
|
||||
|
||||
Available subpackages
|
||||
---------------------
|
||||
doc
|
||||
Topical documentation on broadcasting, indexing, etc.
|
||||
lib
|
||||
Basic functions used by several sub-packages.
|
||||
random
|
||||
Core Random Tools
|
||||
linalg
|
||||
Core Linear Algebra Tools
|
||||
fft
|
||||
Core FFT routines
|
||||
polynomial
|
||||
Polynomial tools
|
||||
testing
|
||||
NumPy testing tools
|
||||
f2py
|
||||
Fortran to Python Interface Generator.
|
||||
distutils
|
||||
Enhancements to distutils with support for
|
||||
Fortran compilers support and more.
|
||||
|
||||
Utilities
|
||||
---------
|
||||
test
|
||||
Run numpy unittests
|
||||
show_config
|
||||
Show numpy build configuration
|
||||
dual
|
||||
Overwrite certain functions with high-performance Scipy tools
|
||||
matlib
|
||||
Make everything matrices.
|
||||
__version__
|
||||
NumPy version string
|
||||
|
||||
Viewing documentation using IPython
|
||||
-----------------------------------
|
||||
Start IPython with the NumPy profile (``ipython -p numpy``), which will
|
||||
import `numpy` under the alias `np`. Then, use the ``cpaste`` command to
|
||||
paste examples into the shell. To see which functions are available in
|
||||
`numpy`, type ``np.<TAB>`` (where ``<TAB>`` refers to the TAB key), or use
|
||||
``np.*cos*?<ENTER>`` (where ``<ENTER>`` refers to the ENTER key) to narrow
|
||||
down the list. To view the docstring for a function, use
|
||||
``np.cos?<ENTER>`` (to view the docstring) and ``np.cos??<ENTER>`` (to view
|
||||
the source code).
|
||||
|
||||
Copies vs. in-place operation
|
||||
-----------------------------
|
||||
Most of the functions in `numpy` return a copy of the array argument
|
||||
(e.g., `np.sort`). In-place versions of these functions are often
|
||||
available as array methods, i.e. ``x = np.array([1,2,3]); x.sort()``.
|
||||
Exceptions to this rule are documented.
|
||||
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
from ._globals import ModuleDeprecationWarning, VisibleDeprecationWarning
|
||||
from ._globals import _NoValue
|
||||
|
||||
# We first need to detect if we're being called as part of the numpy setup
|
||||
# procedure itself in a reliable manner.
|
||||
try:
|
||||
__NUMPY_SETUP__
|
||||
except NameError:
|
||||
__NUMPY_SETUP__ = False
|
||||
|
||||
if __NUMPY_SETUP__:
|
||||
sys.stderr.write('Running from numpy source directory.\n')
|
||||
else:
|
||||
try:
|
||||
from numpy.__config__ import show as show_config
|
||||
except ImportError:
|
||||
msg = """Error importing numpy: you should not try to import numpy from
|
||||
its source directory; please exit the numpy source tree, and relaunch
|
||||
your python interpreter from there."""
|
||||
raise ImportError(msg)
|
||||
|
||||
from .version import git_revision as __git_revision__
|
||||
from .version import version as __version__
|
||||
|
||||
__all__ = ['ModuleDeprecationWarning',
|
||||
'VisibleDeprecationWarning']
|
||||
|
||||
# Allow distributors to run custom init code
|
||||
from . import _distributor_init
|
||||
|
||||
from . import core
|
||||
from .core import *
|
||||
from . import compat
|
||||
from . import lib
|
||||
from .lib import *
|
||||
from . import linalg
|
||||
from . import fft
|
||||
from . import polynomial
|
||||
from . import random
|
||||
from . import ctypeslib
|
||||
from . import ma
|
||||
from . import matrixlib as _mat
|
||||
from .matrixlib import *
|
||||
from .compat import long
|
||||
|
||||
# Make these accessible from numpy name-space
|
||||
# but not imported in from numpy import *
|
||||
if sys.version_info[0] >= 3:
|
||||
from builtins import bool, int, float, complex, object, str
|
||||
unicode = str
|
||||
else:
|
||||
from __builtin__ import bool, int, float, complex, object, unicode, str
|
||||
|
||||
from .core import round, abs, max, min
|
||||
# now that numpy modules are imported, can initialize limits
|
||||
core.getlimits._register_known_types()
|
||||
|
||||
__all__.extend(['__version__', 'show_config'])
|
||||
__all__.extend(core.__all__)
|
||||
__all__.extend(_mat.__all__)
|
||||
__all__.extend(lib.__all__)
|
||||
__all__.extend(['linalg', 'fft', 'random', 'ctypeslib', 'ma'])
|
||||
|
||||
# Filter out Cython harmless warnings
|
||||
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
|
||||
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
|
||||
warnings.filterwarnings("ignore", message="numpy.ndarray size changed")
|
||||
|
||||
# oldnumeric and numarray were removed in 1.9. In case some packages import
|
||||
# but do not use them, we define them here for backward compatibility.
|
||||
oldnumeric = 'removed'
|
||||
numarray = 'removed'
|
||||
|
||||
# We don't actually use this ourselves anymore, but I'm not 100% sure that
|
||||
# no-one else in the world is using it (though I hope not)
|
||||
from .testing import Tester
|
||||
|
||||
# Pytest testing
|
||||
from numpy._pytesttester import PytestTester
|
||||
test = PytestTester(__name__)
|
||||
del PytestTester
|
||||
|
||||
|
||||
def _sanity_check():
|
||||
"""
|
||||
Quick sanity checks for common bugs caused by environment.
|
||||
There are some cases e.g. with wrong BLAS ABI that cause wrong
|
||||
results under specific runtime conditions that are not necessarily
|
||||
achieved during test suite runs, and it is useful to catch those early.
|
||||
|
||||
See https://github.com/numpy/numpy/issues/8577 and other
|
||||
similar bug reports.
|
||||
|
||||
"""
|
||||
try:
|
||||
x = ones(2, dtype=float32)
|
||||
if not abs(x.dot(x) - 2.0) < 1e-5:
|
||||
raise AssertionError()
|
||||
except AssertionError:
|
||||
msg = ("The current Numpy installation ({!r}) fails to "
|
||||
"pass simple sanity checks. This can be caused for example "
|
||||
"by incorrect BLAS library being linked in, or by mixing "
|
||||
"package managers (pip, conda, apt, ...). Search closed "
|
||||
"numpy issues for similar problems.")
|
||||
raise RuntimeError(msg.format(__file__))
|
||||
|
||||
_sanity_check()
|
||||
del _sanity_check
|
@ -0,0 +1,32 @@
|
||||
|
||||
'''
|
||||
Helper to preload windows dlls to prevent dll not found errors.
|
||||
Once a DLL is preloaded, its namespace is made available to any
|
||||
subsequent DLL. This file originated in the numpy-wheels repo,
|
||||
and is created as part of the scripts that build the wheel.
|
||||
'''
|
||||
import os
|
||||
from ctypes import WinDLL
|
||||
import glob
|
||||
if os.name == 'nt':
|
||||
# convention for storing / loading the DLL from
|
||||
# numpy/.libs/, if present
|
||||
try:
|
||||
basedir = os.path.dirname(__file__)
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
libs_dir = os.path.abspath(os.path.join(basedir, '.libs'))
|
||||
DLL_filenames = []
|
||||
if os.path.isdir(libs_dir):
|
||||
for filename in glob.glob(os.path.join(libs_dir,
|
||||
'*openblas*dll')):
|
||||
# NOTE: would it change behavior to load ALL
|
||||
# DLLs at this path vs. the name restriction?
|
||||
WinDLL(os.path.abspath(filename))
|
||||
DLL_filenames.append(filename)
|
||||
if len(DLL_filenames) > 1:
|
||||
import warnings
|
||||
warnings.warn("loaded more than 1 DLL from .libs:\n%s" %
|
||||
"\n".join(DLL_filenames),
|
||||
stacklevel=1)
|
@ -0,0 +1,81 @@
|
||||
"""
|
||||
Module defining global singleton classes.
|
||||
|
||||
This module raises a RuntimeError if an attempt to reload it is made. In that
|
||||
way the identities of the classes defined here are fixed and will remain so
|
||||
even if numpy itself is reloaded. In particular, a function like the following
|
||||
will still work correctly after numpy is reloaded::
|
||||
|
||||
def foo(arg=np._NoValue):
|
||||
if arg is np._NoValue:
|
||||
...
|
||||
|
||||
That was not the case when the singleton classes were defined in the numpy
|
||||
``__init__.py`` file. See gh-7844 for a discussion of the reload problem that
|
||||
motivated this module.
|
||||
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
__ALL__ = [
|
||||
'ModuleDeprecationWarning', 'VisibleDeprecationWarning', '_NoValue'
|
||||
]
|
||||
|
||||
|
||||
# Disallow reloading this module so as to preserve the identities of the
|
||||
# classes defined here.
|
||||
if '_is_loaded' in globals():
|
||||
raise RuntimeError('Reloading numpy._globals is not allowed')
|
||||
_is_loaded = True
|
||||
|
||||
|
||||
class ModuleDeprecationWarning(DeprecationWarning):
|
||||
"""Module deprecation warning.
|
||||
|
||||
The nose tester turns ordinary Deprecation warnings into test failures.
|
||||
That makes it hard to deprecate whole modules, because they get
|
||||
imported by default. So this is a special Deprecation warning that the
|
||||
nose tester will let pass without making tests fail.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
ModuleDeprecationWarning.__module__ = 'numpy'
|
||||
|
||||
|
||||
class VisibleDeprecationWarning(UserWarning):
|
||||
"""Visible deprecation warning.
|
||||
|
||||
By default, python will not show deprecation warnings, so this class
|
||||
can be used when a very visible warning is helpful, for example because
|
||||
the usage is most likely a user bug.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
VisibleDeprecationWarning.__module__ = 'numpy'
|
||||
|
||||
|
||||
class _NoValueType(object):
|
||||
"""Special keyword value.
|
||||
|
||||
The instance of this class may be used as the default value assigned to a
|
||||
deprecated keyword in order to check if it has been given a user defined
|
||||
value.
|
||||
"""
|
||||
__instance = None
|
||||
def __new__(cls):
|
||||
# ensure that only one instance exists
|
||||
if not cls.__instance:
|
||||
cls.__instance = super(_NoValueType, cls).__new__(cls)
|
||||
return cls.__instance
|
||||
|
||||
# needed for python 2 to preserve identity through a pickle
|
||||
def __reduce__(self):
|
||||
return (self.__class__, ())
|
||||
|
||||
def __repr__(self):
|
||||
return "<no value>"
|
||||
|
||||
|
||||
_NoValue = _NoValueType()
|
@ -0,0 +1,209 @@
|
||||
"""
|
||||
Pytest test running.
|
||||
|
||||
This module implements the ``test()`` function for NumPy modules. The usual
|
||||
boiler plate for doing that is to put the following in the module
|
||||
``__init__.py`` file::
|
||||
|
||||
from numpy._pytesttester import PytestTester
|
||||
test = PytestTester(__name__).test
|
||||
del PytestTester
|
||||
|
||||
|
||||
Warnings filtering and other runtime settings should be dealt with in the
|
||||
``pytest.ini`` file in the numpy repo root. The behavior of the test depends on
|
||||
whether or not that file is found as follows:
|
||||
|
||||
* ``pytest.ini`` is present (develop mode)
|
||||
All warnings except those explicily filtered out are raised as error.
|
||||
* ``pytest.ini`` is absent (release mode)
|
||||
DeprecationWarnings and PendingDeprecationWarnings are ignored, other
|
||||
warnings are passed through.
|
||||
|
||||
In practice, tests run from the numpy repo are run in develop mode. That
|
||||
includes the standard ``python runtests.py`` invocation.
|
||||
|
||||
This module is imported by every numpy subpackage, so lies at the top level to
|
||||
simplify circular import issues. For the same reason, it contains no numpy
|
||||
imports at module scope, instead importing numpy within function calls.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
__all__ = ['PytestTester']
|
||||
|
||||
|
||||
|
||||
def _show_numpy_info():
|
||||
import numpy as np
|
||||
|
||||
print("NumPy version %s" % np.__version__)
|
||||
relaxed_strides = np.ones((10, 1), order="C").flags.f_contiguous
|
||||
print("NumPy relaxed strides checking option:", relaxed_strides)
|
||||
|
||||
|
||||
class PytestTester(object):
|
||||
"""
|
||||
Pytest test runner.
|
||||
|
||||
This class is made available in ``numpy.testing``, and a test function
|
||||
is typically added to a package's __init__.py like so::
|
||||
|
||||
from numpy.testing import PytestTester
|
||||
test = PytestTester(__name__).test
|
||||
del PytestTester
|
||||
|
||||
Calling this test function finds and runs all tests associated with the
|
||||
module and all its sub-modules.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
module_name : str
|
||||
Full path to the package to test.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
module_name : module name
|
||||
The name of the module to test.
|
||||
|
||||
"""
|
||||
def __init__(self, module_name):
|
||||
self.module_name = module_name
|
||||
|
||||
def __call__(self, label='fast', verbose=1, extra_argv=None,
|
||||
doctests=False, coverage=False, durations=-1, tests=None):
|
||||
"""
|
||||
Run tests for module using pytest.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
label : {'fast', 'full'}, optional
|
||||
Identifies the tests to run. When set to 'fast', tests decorated
|
||||
with `pytest.mark.slow` are skipped, when 'full', the slow marker
|
||||
is ignored.
|
||||
verbose : int, optional
|
||||
Verbosity value for test outputs, in the range 1-3. Default is 1.
|
||||
extra_argv : list, optional
|
||||
List with any extra arguments to pass to pytests.
|
||||
doctests : bool, optional
|
||||
.. note:: Not supported
|
||||
coverage : bool, optional
|
||||
If True, report coverage of NumPy code. Default is False.
|
||||
Requires installation of (pip) pytest-cov.
|
||||
durations : int, optional
|
||||
If < 0, do nothing, If 0, report time of all tests, if > 0,
|
||||
report the time of the slowest `timer` tests. Default is -1.
|
||||
tests : test or list of tests
|
||||
Tests to be executed with pytest '--pyargs'
|
||||
|
||||
Returns
|
||||
-------
|
||||
result : bool
|
||||
Return True on success, false otherwise.
|
||||
|
||||
Notes
|
||||
-----
|
||||
Each NumPy module exposes `test` in its namespace to run all tests for
|
||||
it. For example, to run all tests for numpy.lib:
|
||||
|
||||
>>> np.lib.test() #doctest: +SKIP
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> result = np.lib.test() #doctest: +SKIP
|
||||
...
|
||||
1023 passed, 2 skipped, 6 deselected, 1 xfailed in 10.39 seconds
|
||||
>>> result
|
||||
True
|
||||
|
||||
"""
|
||||
import pytest
|
||||
import warnings
|
||||
|
||||
#FIXME This is no longer needed? Assume it was for use in tests.
|
||||
# cap verbosity at 3, which is equivalent to the pytest '-vv' option
|
||||
#from . import utils
|
||||
#verbose = min(int(verbose), 3)
|
||||
#utils.verbose = verbose
|
||||
#
|
||||
|
||||
module = sys.modules[self.module_name]
|
||||
module_path = os.path.abspath(module.__path__[0])
|
||||
|
||||
# setup the pytest arguments
|
||||
pytest_args = ["-l"]
|
||||
|
||||
# offset verbosity. The "-q" cancels a "-v".
|
||||
pytest_args += ["-q"]
|
||||
|
||||
# Filter out distutils cpu warnings (could be localized to
|
||||
# distutils tests). ASV has problems with top level import,
|
||||
# so fetch module for suppression here.
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("always")
|
||||
from numpy.distutils import cpuinfo
|
||||
|
||||
# Filter out annoying import messages. Want these in both develop and
|
||||
# release mode.
|
||||
pytest_args += [
|
||||
"-W ignore:Not importing directory",
|
||||
"-W ignore:numpy.dtype size changed",
|
||||
"-W ignore:numpy.ufunc size changed",
|
||||
"-W ignore::UserWarning:cpuinfo",
|
||||
]
|
||||
|
||||
# When testing matrices, ignore their PendingDeprecationWarnings
|
||||
pytest_args += [
|
||||
"-W ignore:the matrix subclass is not",
|
||||
]
|
||||
|
||||
# Ignore python2.7 -3 warnings
|
||||
pytest_args += [
|
||||
r"-W ignore:sys\.exc_clear\(\) not supported in 3\.x:DeprecationWarning",
|
||||
r"-W ignore:in 3\.x, __setslice__:DeprecationWarning",
|
||||
r"-W ignore:in 3\.x, __getslice__:DeprecationWarning",
|
||||
r"-W ignore:buffer\(\) not supported in 3\.x:DeprecationWarning",
|
||||
r"-W ignore:CObject type is not supported in 3\.x:DeprecationWarning",
|
||||
r"-W ignore:comparing unequal types not supported in 3\.x:DeprecationWarning",
|
||||
r"-W ignore:the commands module has been removed in Python 3\.0:DeprecationWarning",
|
||||
r"-W ignore:The 'new' module has been removed in Python 3\.0:DeprecationWarning",
|
||||
]
|
||||
|
||||
|
||||
if doctests:
|
||||
raise ValueError("Doctests not supported")
|
||||
|
||||
if extra_argv:
|
||||
pytest_args += list(extra_argv)
|
||||
|
||||
if verbose > 1:
|
||||
pytest_args += ["-" + "v"*(verbose - 1)]
|
||||
|
||||
if coverage:
|
||||
pytest_args += ["--cov=" + module_path]
|
||||
|
||||
if label == "fast":
|
||||
pytest_args += ["-m", "not slow"]
|
||||
elif label != "full":
|
||||
pytest_args += ["-m", label]
|
||||
|
||||
if durations >= 0:
|
||||
pytest_args += ["--durations=%s" % durations]
|
||||
|
||||
if tests is None:
|
||||
tests = [self.module_name]
|
||||
|
||||
pytest_args += ["--pyargs"] + list(tests)
|
||||
|
||||
|
||||
# run tests.
|
||||
_show_numpy_info()
|
||||
|
||||
try:
|
||||
code = pytest.main(pytest_args)
|
||||
except SystemExit as exc:
|
||||
code = exc.code
|
||||
|
||||
return code == 0
|
@ -0,0 +1,20 @@
|
||||
"""
|
||||
Compatibility module.
|
||||
|
||||
This module contains duplicated code from Python itself or 3rd party
|
||||
extensions, which may be included for the following reasons:
|
||||
|
||||
* compatibility
|
||||
* we may only need a small subset of the copied library/module
|
||||
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
from . import _inspect
|
||||
from . import py3k
|
||||
from ._inspect import getargspec, formatargspec
|
||||
from .py3k import *
|
||||
|
||||
__all__ = []
|
||||
__all__.extend(_inspect.__all__)
|
||||
__all__.extend(py3k.__all__)
|
@ -0,0 +1,193 @@
|
||||
"""Subset of inspect module from upstream python
|
||||
|
||||
We use this instead of upstream because upstream inspect is slow to import, and
|
||||
significantly contributes to numpy import times. Importing this copy has almost
|
||||
no overhead.
|
||||
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
import types
|
||||
|
||||
__all__ = ['getargspec', 'formatargspec']
|
||||
|
||||
# ----------------------------------------------------------- type-checking
|
||||
def ismethod(object):
|
||||
"""Return true if the object is an instance method.
|
||||
|
||||
Instance method objects provide these attributes:
|
||||
__doc__ documentation string
|
||||
__name__ name with which this method was defined
|
||||
im_class class object in which this method belongs
|
||||
im_func function object containing implementation of method
|
||||
im_self instance to which this method is bound, or None
|
||||
|
||||
"""
|
||||
return isinstance(object, types.MethodType)
|
||||
|
||||
def isfunction(object):
|
||||
"""Return true if the object is a user-defined function.
|
||||
|
||||
Function objects provide these attributes:
|
||||
__doc__ documentation string
|
||||
__name__ name with which this function was defined
|
||||
func_code code object containing compiled function bytecode
|
||||
func_defaults tuple of any default values for arguments
|
||||
func_doc (same as __doc__)
|
||||
func_globals global namespace in which this function was defined
|
||||
func_name (same as __name__)
|
||||
|
||||
"""
|
||||
return isinstance(object, types.FunctionType)
|
||||
|
||||
def iscode(object):
|
||||
"""Return true if the object is a code object.
|
||||
|
||||
Code objects provide these attributes:
|
||||
co_argcount number of arguments (not including * or ** args)
|
||||
co_code string of raw compiled bytecode
|
||||
co_consts tuple of constants used in the bytecode
|
||||
co_filename name of file in which this code object was created
|
||||
co_firstlineno number of first line in Python source code
|
||||
co_flags bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg
|
||||
co_lnotab encoded mapping of line numbers to bytecode indices
|
||||
co_name name with which this code object was defined
|
||||
co_names tuple of names of local variables
|
||||
co_nlocals number of local variables
|
||||
co_stacksize virtual machine stack space required
|
||||
co_varnames tuple of names of arguments and local variables
|
||||
|
||||
"""
|
||||
return isinstance(object, types.CodeType)
|
||||
|
||||
# ------------------------------------------------ argument list extraction
|
||||
# These constants are from Python's compile.h.
|
||||
CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS = 1, 2, 4, 8
|
||||
|
||||
def getargs(co):
|
||||
"""Get information about the arguments accepted by a code object.
|
||||
|
||||
Three things are returned: (args, varargs, varkw), where 'args' is
|
||||
a list of argument names (possibly containing nested lists), and
|
||||
'varargs' and 'varkw' are the names of the * and ** arguments or None.
|
||||
|
||||
"""
|
||||
|
||||
if not iscode(co):
|
||||
raise TypeError('arg is not a code object')
|
||||
|
||||
nargs = co.co_argcount
|
||||
names = co.co_varnames
|
||||
args = list(names[:nargs])
|
||||
|
||||
# The following acrobatics are for anonymous (tuple) arguments.
|
||||
# Which we do not need to support, so remove to avoid importing
|
||||
# the dis module.
|
||||
for i in range(nargs):
|
||||
if args[i][:1] in ['', '.']:
|
||||
raise TypeError("tuple function arguments are not supported")
|
||||
varargs = None
|
||||
if co.co_flags & CO_VARARGS:
|
||||
varargs = co.co_varnames[nargs]
|
||||
nargs = nargs + 1
|
||||
varkw = None
|
||||
if co.co_flags & CO_VARKEYWORDS:
|
||||
varkw = co.co_varnames[nargs]
|
||||
return args, varargs, varkw
|
||||
|
||||
def getargspec(func):
|
||||
"""Get the names and default values of a function's arguments.
|
||||
|
||||
A tuple of four things is returned: (args, varargs, varkw, defaults).
|
||||
'args' is a list of the argument names (it may contain nested lists).
|
||||
'varargs' and 'varkw' are the names of the * and ** arguments or None.
|
||||
'defaults' is an n-tuple of the default values of the last n arguments.
|
||||
|
||||
"""
|
||||
|
||||
if ismethod(func):
|
||||
func = func.__func__
|
||||
if not isfunction(func):
|
||||
raise TypeError('arg is not a Python function')
|
||||
args, varargs, varkw = getargs(func.__code__)
|
||||
return args, varargs, varkw, func.__defaults__
|
||||
|
||||
def getargvalues(frame):
|
||||
"""Get information about arguments passed into a particular frame.
|
||||
|
||||
A tuple of four things is returned: (args, varargs, varkw, locals).
|
||||
'args' is a list of the argument names (it may contain nested lists).
|
||||
'varargs' and 'varkw' are the names of the * and ** arguments or None.
|
||||
'locals' is the locals dictionary of the given frame.
|
||||
|
||||
"""
|
||||
args, varargs, varkw = getargs(frame.f_code)
|
||||
return args, varargs, varkw, frame.f_locals
|
||||
|
||||
def joinseq(seq):
|
||||
if len(seq) == 1:
|
||||
return '(' + seq[0] + ',)'
|
||||
else:
|
||||
return '(' + ', '.join(seq) + ')'
|
||||
|
||||
def strseq(object, convert, join=joinseq):
|
||||
"""Recursively walk a sequence, stringifying each element.
|
||||
|
||||
"""
|
||||
if type(object) in [list, tuple]:
|
||||
return join([strseq(_o, convert, join) for _o in object])
|
||||
else:
|
||||
return convert(object)
|
||||
|
||||
def formatargspec(args, varargs=None, varkw=None, defaults=None,
|
||||
formatarg=str,
|
||||
formatvarargs=lambda name: '*' + name,
|
||||
formatvarkw=lambda name: '**' + name,
|
||||
formatvalue=lambda value: '=' + repr(value),
|
||||
join=joinseq):
|
||||
"""Format an argument spec from the 4 values returned by getargspec.
|
||||
|
||||
The first four arguments are (args, varargs, varkw, defaults). The
|
||||
other four arguments are the corresponding optional formatting functions
|
||||
that are called to turn names and values into strings. The ninth
|
||||
argument is an optional function to format the sequence of arguments.
|
||||
|
||||
"""
|
||||
specs = []
|
||||
if defaults:
|
||||
firstdefault = len(args) - len(defaults)
|
||||
for i in range(len(args)):
|
||||
spec = strseq(args[i], formatarg, join)
|
||||
if defaults and i >= firstdefault:
|
||||
spec = spec + formatvalue(defaults[i - firstdefault])
|
||||
specs.append(spec)
|
||||
if varargs is not None:
|
||||
specs.append(formatvarargs(varargs))
|
||||
if varkw is not None:
|
||||
specs.append(formatvarkw(varkw))
|
||||
return '(' + ', '.join(specs) + ')'
|
||||
|
||||
def formatargvalues(args, varargs, varkw, locals,
|
||||
formatarg=str,
|
||||
formatvarargs=lambda name: '*' + name,
|
||||
formatvarkw=lambda name: '**' + name,
|
||||
formatvalue=lambda value: '=' + repr(value),
|
||||
join=joinseq):
|
||||
"""Format an argument spec from the 4 values returned by getargvalues.
|
||||
|
||||
The first four arguments are (args, varargs, varkw, locals). The
|
||||
next four arguments are the corresponding optional formatting functions
|
||||
that are called to turn names and values into strings. The ninth
|
||||
argument is an optional function to format the sequence of arguments.
|
||||
|
||||
"""
|
||||
def convert(name, locals=locals,
|
||||
formatarg=formatarg, formatvalue=formatvalue):
|
||||
return formatarg(name) + formatvalue(locals[name])
|
||||
specs = [strseq(arg, convert, join) for arg in args]
|
||||
|
||||
if varargs:
|
||||
specs.append(formatvarargs(varargs) + formatvalue(locals[varargs]))
|
||||
if varkw:
|
||||
specs.append(formatvarkw(varkw) + formatvalue(locals[varkw]))
|
||||
return '(' + ', '.join(specs) + ')'
|
@ -0,0 +1,247 @@
|
||||
"""
|
||||
Python 3 compatibility tools.
|
||||
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
__all__ = ['bytes', 'asbytes', 'isfileobj', 'getexception', 'strchar',
|
||||
'unicode', 'asunicode', 'asbytes_nested', 'asunicode_nested',
|
||||
'asstr', 'open_latin1', 'long', 'basestring', 'sixu',
|
||||
'integer_types', 'is_pathlib_path', 'npy_load_module', 'Path',
|
||||
'pickle', 'contextlib_nullcontext', 'os_fspath', 'os_PathLike']
|
||||
|
||||
import sys
|
||||
import os
|
||||
try:
|
||||
from pathlib import Path, PurePath
|
||||
except ImportError:
|
||||
Path = PurePath = None
|
||||
|
||||
if sys.version_info[0] >= 3:
|
||||
import io
|
||||
|
||||
try:
|
||||
import pickle5 as pickle
|
||||
except ImportError:
|
||||
import pickle
|
||||
|
||||
long = int
|
||||
integer_types = (int,)
|
||||
basestring = str
|
||||
unicode = str
|
||||
bytes = bytes
|
||||
|
||||
def asunicode(s):
|
||||
if isinstance(s, bytes):
|
||||
return s.decode('latin1')
|
||||
return str(s)
|
||||
|
||||
def asbytes(s):
|
||||
if isinstance(s, bytes):
|
||||
return s
|
||||
return str(s).encode('latin1')
|
||||
|
||||
def asstr(s):
|
||||
if isinstance(s, bytes):
|
||||
return s.decode('latin1')
|
||||
return str(s)
|
||||
|
||||
def isfileobj(f):
|
||||
return isinstance(f, (io.FileIO, io.BufferedReader, io.BufferedWriter))
|
||||
|
||||
def open_latin1(filename, mode='r'):
|
||||
return open(filename, mode=mode, encoding='iso-8859-1')
|
||||
|
||||
def sixu(s):
|
||||
return s
|
||||
|
||||
strchar = 'U'
|
||||
|
||||
else:
|
||||
import cpickle as pickle
|
||||
|
||||
bytes = str
|
||||
long = long
|
||||
basestring = basestring
|
||||
unicode = unicode
|
||||
integer_types = (int, long)
|
||||
asbytes = str
|
||||
asstr = str
|
||||
strchar = 'S'
|
||||
|
||||
def isfileobj(f):
|
||||
return isinstance(f, file)
|
||||
|
||||
def asunicode(s):
|
||||
if isinstance(s, unicode):
|
||||
return s
|
||||
return str(s).decode('ascii')
|
||||
|
||||
def open_latin1(filename, mode='r'):
|
||||
return open(filename, mode=mode)
|
||||
|
||||
def sixu(s):
|
||||
return unicode(s, 'unicode_escape')
|
||||
|
||||
def getexception():
|
||||
return sys.exc_info()[1]
|
||||
|
||||
def asbytes_nested(x):
|
||||
if hasattr(x, '__iter__') and not isinstance(x, (bytes, unicode)):
|
||||
return [asbytes_nested(y) for y in x]
|
||||
else:
|
||||
return asbytes(x)
|
||||
|
||||
def asunicode_nested(x):
|
||||
if hasattr(x, '__iter__') and not isinstance(x, (bytes, unicode)):
|
||||
return [asunicode_nested(y) for y in x]
|
||||
else:
|
||||
return asunicode(x)
|
||||
|
||||
def is_pathlib_path(obj):
|
||||
"""
|
||||
Check whether obj is a pathlib.Path object.
|
||||
|
||||
Prefer using `isinstance(obj, os_PathLike)` instead of this function.
|
||||
"""
|
||||
return Path is not None and isinstance(obj, Path)
|
||||
|
||||
# from Python 3.7
|
||||
class contextlib_nullcontext(object):
|
||||
"""Context manager that does no additional processing.
|
||||
|
||||
Used as a stand-in for a normal context manager, when a particular
|
||||
block of code is only sometimes used with a normal context manager:
|
||||
|
||||
cm = optional_cm if condition else nullcontext()
|
||||
with cm:
|
||||
# Perform operation, using optional_cm if condition is True
|
||||
"""
|
||||
|
||||
def __init__(self, enter_result=None):
|
||||
self.enter_result = enter_result
|
||||
|
||||
def __enter__(self):
|
||||
return self.enter_result
|
||||
|
||||
def __exit__(self, *excinfo):
|
||||
pass
|
||||
|
||||
|
||||
if sys.version_info[0] >= 3 and sys.version_info[1] >= 4:
|
||||
def npy_load_module(name, fn, info=None):
|
||||
"""
|
||||
Load a module.
|
||||
|
||||
.. versionadded:: 1.11.2
|
||||
|
||||
Parameters
|
||||
----------
|
||||
name : str
|
||||
Full module name.
|
||||
fn : str
|
||||
Path to module file.
|
||||
info : tuple, optional
|
||||
Only here for backward compatibility with Python 2.*.
|
||||
|
||||
Returns
|
||||
-------
|
||||
mod : module
|
||||
|
||||
"""
|
||||
import importlib.machinery
|
||||
return importlib.machinery.SourceFileLoader(name, fn).load_module()
|
||||
else:
|
||||
def npy_load_module(name, fn, info=None):
|
||||
"""
|
||||
Load a module.
|
||||
|
||||
.. versionadded:: 1.11.2
|
||||
|
||||
Parameters
|
||||
----------
|
||||
name : str
|
||||
Full module name.
|
||||
fn : str
|
||||
Path to module file.
|
||||
info : tuple, optional
|
||||
Information as returned by `imp.find_module`
|
||||
(suffix, mode, type).
|
||||
|
||||
Returns
|
||||
-------
|
||||
mod : module
|
||||
|
||||
"""
|
||||
import imp
|
||||
if info is None:
|
||||
path = os.path.dirname(fn)
|
||||
fo, fn, info = imp.find_module(name, [path])
|
||||
else:
|
||||
fo = open(fn, info[1])
|
||||
try:
|
||||
mod = imp.load_module(name, fo, fn, info)
|
||||
finally:
|
||||
fo.close()
|
||||
return mod
|
||||
|
||||
# backport abc.ABC
|
||||
import abc
|
||||
if sys.version_info[:2] >= (3, 4):
|
||||
abc_ABC = abc.ABC
|
||||
else:
|
||||
abc_ABC = abc.ABCMeta('ABC', (object,), {'__slots__': ()})
|
||||
|
||||
|
||||
# Backport os.fs_path, os.PathLike, and PurePath.__fspath__
|
||||
if sys.version_info[:2] >= (3, 6):
|
||||
os_fspath = os.fspath
|
||||
os_PathLike = os.PathLike
|
||||
else:
|
||||
def _PurePath__fspath__(self):
|
||||
return str(self)
|
||||
|
||||
class os_PathLike(abc_ABC):
|
||||
"""Abstract base class for implementing the file system path protocol."""
|
||||
|
||||
@abc.abstractmethod
|
||||
def __fspath__(self):
|
||||
"""Return the file system path representation of the object."""
|
||||
raise NotImplementedError
|
||||
|
||||
@classmethod
|
||||
def __subclasshook__(cls, subclass):
|
||||
if PurePath is not None and issubclass(subclass, PurePath):
|
||||
return True
|
||||
return hasattr(subclass, '__fspath__')
|
||||
|
||||
|
||||
def os_fspath(path):
|
||||
"""Return the path representation of a path-like object.
|
||||
If str or bytes is passed in, it is returned unchanged. Otherwise the
|
||||
os.PathLike interface is used to get the path representation. If the
|
||||
path representation is not str or bytes, TypeError is raised. If the
|
||||
provided path is not str, bytes, or os.PathLike, TypeError is raised.
|
||||
"""
|
||||
if isinstance(path, (str, bytes)):
|
||||
return path
|
||||
|
||||
# Work from the object's type to match method resolution of other magic
|
||||
# methods.
|
||||
path_type = type(path)
|
||||
try:
|
||||
path_repr = path_type.__fspath__(path)
|
||||
except AttributeError:
|
||||
if hasattr(path_type, '__fspath__'):
|
||||
raise
|
||||
elif PurePath is not None and issubclass(path_type, PurePath):
|
||||
return _PurePath__fspath__(path)
|
||||
else:
|
||||
raise TypeError("expected str, bytes or os.PathLike object, "
|
||||
"not " + path_type.__name__)
|
||||
if isinstance(path_repr, (str, bytes)):
|
||||
return path_repr
|
||||
else:
|
||||
raise TypeError("expected {}.__fspath__() to return str or bytes, "
|
||||
"not {}".format(path_type.__name__,
|
||||
type(path_repr).__name__))
|
@ -0,0 +1,12 @@
|
||||
from __future__ import division, print_function
|
||||
|
||||
def configuration(parent_package='',top_path=None):
|
||||
from numpy.distutils.misc_util import Configuration
|
||||
|
||||
config = Configuration('compat', parent_package, top_path)
|
||||
config.add_data_dir('tests')
|
||||
return config
|
||||
|
||||
if __name__ == '__main__':
|
||||
from numpy.distutils.core import setup
|
||||
setup(configuration=configuration)
|
@ -0,0 +1,21 @@
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
from os.path import join
|
||||
|
||||
from numpy.compat import isfileobj
|
||||
from numpy.testing import assert_
|
||||
from numpy.testing import tempdir
|
||||
|
||||
|
||||
def test_isfileobj():
|
||||
with tempdir(prefix="numpy_test_compat_") as folder:
|
||||
filename = join(folder, 'a.bin')
|
||||
|
||||
with open(filename, 'wb') as f:
|
||||
assert_(isfileobj(f))
|
||||
|
||||
with open(filename, 'ab') as f:
|
||||
assert_(isfileobj(f))
|
||||
|
||||
with open(filename, 'rb') as f:
|
||||
assert_(isfileobj(f))
|
@ -0,0 +1,67 @@
|
||||
"""
|
||||
Pytest configuration and fixtures for the Numpy test suite.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
import pytest
|
||||
import numpy
|
||||
|
||||
from numpy.core._multiarray_tests import get_fpu_mode
|
||||
|
||||
|
||||
_old_fpu_mode = None
|
||||
_collect_results = {}
|
||||
|
||||
|
||||
def pytest_configure(config):
|
||||
config.addinivalue_line("markers",
|
||||
"valgrind_error: Tests that are known to error under valgrind.")
|
||||
config.addinivalue_line("markers",
|
||||
"slow: Tests that are very slow.")
|
||||
|
||||
|
||||
#FIXME when yield tests are gone.
|
||||
@pytest.hookimpl()
|
||||
def pytest_itemcollected(item):
|
||||
"""
|
||||
Check FPU precision mode was not changed during test collection.
|
||||
|
||||
The clumsy way we do it here is mainly necessary because numpy
|
||||
still uses yield tests, which can execute code at test collection
|
||||
time.
|
||||
"""
|
||||
global _old_fpu_mode
|
||||
|
||||
mode = get_fpu_mode()
|
||||
|
||||
if _old_fpu_mode is None:
|
||||
_old_fpu_mode = mode
|
||||
elif mode != _old_fpu_mode:
|
||||
_collect_results[item] = (_old_fpu_mode, mode)
|
||||
_old_fpu_mode = mode
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", autouse=True)
|
||||
def check_fpu_mode(request):
|
||||
"""
|
||||
Check FPU precision mode was not changed during the test.
|
||||
"""
|
||||
old_mode = get_fpu_mode()
|
||||
yield
|
||||
new_mode = get_fpu_mode()
|
||||
|
||||
if old_mode != new_mode:
|
||||
raise AssertionError("FPU precision mode changed from {0:#x} to {1:#x}"
|
||||
" during the test".format(old_mode, new_mode))
|
||||
|
||||
collect_result = _collect_results.get(request.node)
|
||||
if collect_result is not None:
|
||||
old_mode, new_mode = collect_result
|
||||
raise AssertionError("FPU precision mode changed from {0:#x} to {1:#x}"
|
||||
" when collecting the test".format(old_mode,
|
||||
new_mode))
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def add_np(doctest_namespace):
|
||||
doctest_namespace['np'] = numpy
|
@ -0,0 +1,147 @@
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
from .info import __doc__
|
||||
from numpy.version import version as __version__
|
||||
|
||||
import os
|
||||
|
||||
# disables OpenBLAS affinity setting of the main thread that limits
|
||||
# python threads or processes to one core
|
||||
env_added = []
|
||||
for envkey in ['OPENBLAS_MAIN_FREE', 'GOTOBLAS_MAIN_FREE']:
|
||||
if envkey not in os.environ:
|
||||
os.environ[envkey] = '1'
|
||||
env_added.append(envkey)
|
||||
|
||||
try:
|
||||
from . import multiarray
|
||||
except ImportError as exc:
|
||||
import sys
|
||||
msg = """
|
||||
|
||||
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
|
||||
|
||||
Importing the numpy c-extensions failed.
|
||||
- Try uninstalling and reinstalling numpy.
|
||||
- If you have already done that, then:
|
||||
1. Check that you expected to use Python%d.%d from "%s",
|
||||
and that you have no directories in your PATH or PYTHONPATH that can
|
||||
interfere with the Python and numpy version "%s" you're trying to use.
|
||||
2. If (1) looks fine, you can open a new issue at
|
||||
https://github.com/numpy/numpy/issues. Please include details on:
|
||||
- how you installed Python
|
||||
- how you installed numpy
|
||||
- your operating system
|
||||
- whether or not you have multiple versions of Python installed
|
||||
- if you built from source, your compiler versions and ideally a build log
|
||||
|
||||
- If you're working with a numpy git repository, try `git clean -xdf`
|
||||
(removes all files not under version control) and rebuild numpy.
|
||||
|
||||
Note: this error has many possible causes, so please don't comment on
|
||||
an existing issue about this - open a new one instead.
|
||||
|
||||
Original error was: %s
|
||||
""" % (sys.version_info[0], sys.version_info[1], sys.executable,
|
||||
__version__, exc)
|
||||
raise ImportError(msg)
|
||||
finally:
|
||||
for envkey in env_added:
|
||||
del os.environ[envkey]
|
||||
del envkey
|
||||
del env_added
|
||||
del os
|
||||
|
||||
from . import umath
|
||||
|
||||
# Check that multiarray,umath are pure python modules wrapping
|
||||
# _multiarray_umath and not either of the old c-extension modules
|
||||
if not (hasattr(multiarray, '_multiarray_umath') and
|
||||
hasattr(umath, '_multiarray_umath')):
|
||||
import sys
|
||||
path = sys.modules['numpy'].__path__
|
||||
msg = ("Something is wrong with the numpy installation. "
|
||||
"While importing we detected an older version of "
|
||||
"numpy in {}. One method of fixing this is to repeatedly uninstall "
|
||||
"numpy until none is found, then reinstall this version.")
|
||||
raise ImportError(msg.format(path))
|
||||
|
||||
from . import numerictypes as nt
|
||||
multiarray.set_typeDict(nt.sctypeDict)
|
||||
from . import numeric
|
||||
from .numeric import *
|
||||
from . import fromnumeric
|
||||
from .fromnumeric import *
|
||||
from . import defchararray as char
|
||||
from . import records as rec
|
||||
from .records import *
|
||||
from .memmap import *
|
||||
from .defchararray import chararray
|
||||
from . import function_base
|
||||
from .function_base import *
|
||||
from . import machar
|
||||
from .machar import *
|
||||
from . import getlimits
|
||||
from .getlimits import *
|
||||
from . import shape_base
|
||||
from .shape_base import *
|
||||
from . import einsumfunc
|
||||
from .einsumfunc import *
|
||||
del nt
|
||||
|
||||
from .fromnumeric import amax as max, amin as min, round_ as round
|
||||
from .numeric import absolute as abs
|
||||
|
||||
# do this after everything else, to minimize the chance of this misleadingly
|
||||
# appearing in an import-time traceback
|
||||
from . import _add_newdocs
|
||||
# add these for module-freeze analysis (like PyInstaller)
|
||||
from . import _dtype_ctypes
|
||||
from . import _internal
|
||||
from . import _dtype
|
||||
from . import _methods
|
||||
|
||||
__all__ = ['char', 'rec', 'memmap']
|
||||
__all__ += numeric.__all__
|
||||
__all__ += fromnumeric.__all__
|
||||
__all__ += rec.__all__
|
||||
__all__ += ['chararray']
|
||||
__all__ += function_base.__all__
|
||||
__all__ += machar.__all__
|
||||
__all__ += getlimits.__all__
|
||||
__all__ += shape_base.__all__
|
||||
__all__ += einsumfunc.__all__
|
||||
|
||||
# Make it possible so that ufuncs can be pickled
|
||||
# Here are the loading and unloading functions
|
||||
# The name numpy.core._ufunc_reconstruct must be
|
||||
# available for unpickling to work.
|
||||
def _ufunc_reconstruct(module, name):
|
||||
# The `fromlist` kwarg is required to ensure that `mod` points to the
|
||||
# inner-most module rather than the parent package when module name is
|
||||
# nested. This makes it possible to pickle non-toplevel ufuncs such as
|
||||
# scipy.special.expit for instance.
|
||||
mod = __import__(module, fromlist=[name])
|
||||
return getattr(mod, name)
|
||||
|
||||
def _ufunc_reduce(func):
|
||||
from pickle import whichmodule
|
||||
name = func.__name__
|
||||
return _ufunc_reconstruct, (whichmodule(func, name), name)
|
||||
|
||||
|
||||
import sys
|
||||
if sys.version_info[0] >= 3:
|
||||
import copyreg
|
||||
else:
|
||||
import copy_reg as copyreg
|
||||
|
||||
copyreg.pickle(ufunc, _ufunc_reduce, _ufunc_reconstruct)
|
||||
# Unclutter namespace (must keep _ufunc_reconstruct for unpickling)
|
||||
del copyreg
|
||||
del sys
|
||||
del _ufunc_reduce
|
||||
|
||||
from numpy._pytesttester import PytestTester
|
||||
test = PytestTester(__name__)
|
||||
del PytestTester
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,324 @@
|
||||
"""
|
||||
Functions in the ``as*array`` family that promote array-likes into arrays.
|
||||
|
||||
`require` fits this category despite its name not matching this pattern.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
from .overrides import set_module
|
||||
from .multiarray import array
|
||||
|
||||
|
||||
__all__ = [
|
||||
"asarray", "asanyarray", "ascontiguousarray", "asfortranarray", "require",
|
||||
]
|
||||
|
||||
@set_module('numpy')
|
||||
def asarray(a, dtype=None, order=None):
|
||||
"""Convert the input to an array.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
a : array_like
|
||||
Input data, in any form that can be converted to an array. This
|
||||
includes lists, lists of tuples, tuples, tuples of tuples, tuples
|
||||
of lists and ndarrays.
|
||||
dtype : data-type, optional
|
||||
By default, the data-type is inferred from the input data.
|
||||
order : {'C', 'F'}, optional
|
||||
Whether to use row-major (C-style) or
|
||||
column-major (Fortran-style) memory representation.
|
||||
Defaults to 'C'.
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
Array interpretation of `a`. No copy is performed if the input
|
||||
is already an ndarray with matching dtype and order. If `a` is a
|
||||
subclass of ndarray, a base class ndarray is returned.
|
||||
|
||||
See Also
|
||||
--------
|
||||
asanyarray : Similar function which passes through subclasses.
|
||||
ascontiguousarray : Convert input to a contiguous array.
|
||||
asfarray : Convert input to a floating point ndarray.
|
||||
asfortranarray : Convert input to an ndarray with column-major
|
||||
memory order.
|
||||
asarray_chkfinite : Similar function which checks input for NaNs and Infs.
|
||||
fromiter : Create an array from an iterator.
|
||||
fromfunction : Construct an array by executing a function on grid
|
||||
positions.
|
||||
|
||||
Examples
|
||||
--------
|
||||
Convert a list into an array:
|
||||
|
||||
>>> a = [1, 2]
|
||||
>>> np.asarray(a)
|
||||
array([1, 2])
|
||||
|
||||
Existing arrays are not copied:
|
||||
|
||||
>>> a = np.array([1, 2])
|
||||
>>> np.asarray(a) is a
|
||||
True
|
||||
|
||||
If `dtype` is set, array is copied only if dtype does not match:
|
||||
|
||||
>>> a = np.array([1, 2], dtype=np.float32)
|
||||
>>> np.asarray(a, dtype=np.float32) is a
|
||||
True
|
||||
>>> np.asarray(a, dtype=np.float64) is a
|
||||
False
|
||||
|
||||
Contrary to `asanyarray`, ndarray subclasses are not passed through:
|
||||
|
||||
>>> issubclass(np.recarray, np.ndarray)
|
||||
True
|
||||
>>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray)
|
||||
>>> np.asarray(a) is a
|
||||
False
|
||||
>>> np.asanyarray(a) is a
|
||||
True
|
||||
|
||||
"""
|
||||
return array(a, dtype, copy=False, order=order)
|
||||
|
||||
|
||||
@set_module('numpy')
|
||||
def asanyarray(a, dtype=None, order=None):
|
||||
"""Convert the input to an ndarray, but pass ndarray subclasses through.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
a : array_like
|
||||
Input data, in any form that can be converted to an array. This
|
||||
includes scalars, lists, lists of tuples, tuples, tuples of tuples,
|
||||
tuples of lists, and ndarrays.
|
||||
dtype : data-type, optional
|
||||
By default, the data-type is inferred from the input data.
|
||||
order : {'C', 'F'}, optional
|
||||
Whether to use row-major (C-style) or column-major
|
||||
(Fortran-style) memory representation. Defaults to 'C'.
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray or an ndarray subclass
|
||||
Array interpretation of `a`. If `a` is an ndarray or a subclass
|
||||
of ndarray, it is returned as-is and no copy is performed.
|
||||
|
||||
See Also
|
||||
--------
|
||||
asarray : Similar function which always returns ndarrays.
|
||||
ascontiguousarray : Convert input to a contiguous array.
|
||||
asfarray : Convert input to a floating point ndarray.
|
||||
asfortranarray : Convert input to an ndarray with column-major
|
||||
memory order.
|
||||
asarray_chkfinite : Similar function which checks input for NaNs and
|
||||
Infs.
|
||||
fromiter : Create an array from an iterator.
|
||||
fromfunction : Construct an array by executing a function on grid
|
||||
positions.
|
||||
|
||||
Examples
|
||||
--------
|
||||
Convert a list into an array:
|
||||
|
||||
>>> a = [1, 2]
|
||||
>>> np.asanyarray(a)
|
||||
array([1, 2])
|
||||
|
||||
Instances of `ndarray` subclasses are passed through as-is:
|
||||
|
||||
>>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray)
|
||||
>>> np.asanyarray(a) is a
|
||||
True
|
||||
|
||||
"""
|
||||
return array(a, dtype, copy=False, order=order, subok=True)
|
||||
|
||||
|
||||
@set_module('numpy')
|
||||
def ascontiguousarray(a, dtype=None):
|
||||
"""
|
||||
Return a contiguous array (ndim >= 1) in memory (C order).
|
||||
|
||||
Parameters
|
||||
----------
|
||||
a : array_like
|
||||
Input array.
|
||||
dtype : str or dtype object, optional
|
||||
Data-type of returned array.
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
Contiguous array of same shape and content as `a`, with type `dtype`
|
||||
if specified.
|
||||
|
||||
See Also
|
||||
--------
|
||||
asfortranarray : Convert input to an ndarray with column-major
|
||||
memory order.
|
||||
require : Return an ndarray that satisfies requirements.
|
||||
ndarray.flags : Information about the memory layout of the array.
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> x = np.arange(6).reshape(2,3)
|
||||
>>> np.ascontiguousarray(x, dtype=np.float32)
|
||||
array([[0., 1., 2.],
|
||||
[3., 4., 5.]], dtype=float32)
|
||||
>>> x.flags['C_CONTIGUOUS']
|
||||
True
|
||||
|
||||
Note: This function returns an array with at least one-dimension (1-d)
|
||||
so it will not preserve 0-d arrays.
|
||||
|
||||
"""
|
||||
return array(a, dtype, copy=False, order='C', ndmin=1)
|
||||
|
||||
|
||||
@set_module('numpy')
|
||||
def asfortranarray(a, dtype=None):
|
||||
"""
|
||||
Return an array (ndim >= 1) laid out in Fortran order in memory.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
a : array_like
|
||||
Input array.
|
||||
dtype : str or dtype object, optional
|
||||
By default, the data-type is inferred from the input data.
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
The input `a` in Fortran, or column-major, order.
|
||||
|
||||
See Also
|
||||
--------
|
||||
ascontiguousarray : Convert input to a contiguous (C order) array.
|
||||
asanyarray : Convert input to an ndarray with either row or
|
||||
column-major memory order.
|
||||
require : Return an ndarray that satisfies requirements.
|
||||
ndarray.flags : Information about the memory layout of the array.
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> x = np.arange(6).reshape(2,3)
|
||||
>>> y = np.asfortranarray(x)
|
||||
>>> x.flags['F_CONTIGUOUS']
|
||||
False
|
||||
>>> y.flags['F_CONTIGUOUS']
|
||||
True
|
||||
|
||||
Note: This function returns an array with at least one-dimension (1-d)
|
||||
so it will not preserve 0-d arrays.
|
||||
|
||||
"""
|
||||
return array(a, dtype, copy=False, order='F', ndmin=1)
|
||||
|
||||
|
||||
@set_module('numpy')
|
||||
def require(a, dtype=None, requirements=None):
|
||||
"""
|
||||
Return an ndarray of the provided type that satisfies requirements.
|
||||
|
||||
This function is useful to be sure that an array with the correct flags
|
||||
is returned for passing to compiled code (perhaps through ctypes).
|
||||
|
||||
Parameters
|
||||
----------
|
||||
a : array_like
|
||||
The object to be converted to a type-and-requirement-satisfying array.
|
||||
dtype : data-type
|
||||
The required data-type. If None preserve the current dtype. If your
|
||||
application requires the data to be in native byteorder, include
|
||||
a byteorder specification as a part of the dtype specification.
|
||||
requirements : str or list of str
|
||||
The requirements list can be any of the following
|
||||
|
||||
* 'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array
|
||||
* 'C_CONTIGUOUS' ('C') - ensure a C-contiguous array
|
||||
* 'ALIGNED' ('A') - ensure a data-type aligned array
|
||||
* 'WRITEABLE' ('W') - ensure a writable array
|
||||
* 'OWNDATA' ('O') - ensure an array that owns its own data
|
||||
* 'ENSUREARRAY', ('E') - ensure a base array, instead of a subclass
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
Array with specified requirements and type if given.
|
||||
|
||||
See Also
|
||||
--------
|
||||
asarray : Convert input to an ndarray.
|
||||
asanyarray : Convert to an ndarray, but pass through ndarray subclasses.
|
||||
ascontiguousarray : Convert input to a contiguous array.
|
||||
asfortranarray : Convert input to an ndarray with column-major
|
||||
memory order.
|
||||
ndarray.flags : Information about the memory layout of the array.
|
||||
|
||||
Notes
|
||||
-----
|
||||
The returned array will be guaranteed to have the listed requirements
|
||||
by making a copy if needed.
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> x = np.arange(6).reshape(2,3)
|
||||
>>> x.flags
|
||||
C_CONTIGUOUS : True
|
||||
F_CONTIGUOUS : False
|
||||
OWNDATA : False
|
||||
WRITEABLE : True
|
||||
ALIGNED : True
|
||||
WRITEBACKIFCOPY : False
|
||||
UPDATEIFCOPY : False
|
||||
|
||||
>>> y = np.require(x, dtype=np.float32, requirements=['A', 'O', 'W', 'F'])
|
||||
>>> y.flags
|
||||
C_CONTIGUOUS : False
|
||||
F_CONTIGUOUS : True
|
||||
OWNDATA : True
|
||||
WRITEABLE : True
|
||||
ALIGNED : True
|
||||
WRITEBACKIFCOPY : False
|
||||
UPDATEIFCOPY : False
|
||||
|
||||
"""
|
||||
possible_flags = {'C': 'C', 'C_CONTIGUOUS': 'C', 'CONTIGUOUS': 'C',
|
||||
'F': 'F', 'F_CONTIGUOUS': 'F', 'FORTRAN': 'F',
|
||||
'A': 'A', 'ALIGNED': 'A',
|
||||
'W': 'W', 'WRITEABLE': 'W',
|
||||
'O': 'O', 'OWNDATA': 'O',
|
||||
'E': 'E', 'ENSUREARRAY': 'E'}
|
||||
if not requirements:
|
||||
return asanyarray(a, dtype=dtype)
|
||||
else:
|
||||
requirements = {possible_flags[x.upper()] for x in requirements}
|
||||
|
||||
if 'E' in requirements:
|
||||
requirements.remove('E')
|
||||
subok = False
|
||||
else:
|
||||
subok = True
|
||||
|
||||
order = 'A'
|
||||
if requirements >= {'C', 'F'}:
|
||||
raise ValueError('Cannot specify both "C" and "F" order')
|
||||
elif 'F' in requirements:
|
||||
order = 'F'
|
||||
requirements.remove('F')
|
||||
elif 'C' in requirements:
|
||||
order = 'C'
|
||||
requirements.remove('C')
|
||||
|
||||
arr = array(a, dtype=dtype, order=order, copy=False, subok=subok)
|
||||
|
||||
for prop in requirements:
|
||||
if not arr.flags[prop]:
|
||||
arr = arr.copy(order)
|
||||
break
|
||||
return arr
|
@ -0,0 +1,341 @@
|
||||
"""
|
||||
A place for code to be called from the implementation of np.dtype
|
||||
|
||||
String handling is much easier to do correctly in python.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
_kind_to_stem = {
|
||||
'u': 'uint',
|
||||
'i': 'int',
|
||||
'c': 'complex',
|
||||
'f': 'float',
|
||||
'b': 'bool',
|
||||
'V': 'void',
|
||||
'O': 'object',
|
||||
'M': 'datetime',
|
||||
'm': 'timedelta'
|
||||
}
|
||||
if sys.version_info[0] >= 3:
|
||||
_kind_to_stem.update({
|
||||
'S': 'bytes',
|
||||
'U': 'str'
|
||||
})
|
||||
else:
|
||||
_kind_to_stem.update({
|
||||
'S': 'string',
|
||||
'U': 'unicode'
|
||||
})
|
||||
|
||||
|
||||
def _kind_name(dtype):
|
||||
try:
|
||||
return _kind_to_stem[dtype.kind]
|
||||
except KeyError:
|
||||
raise RuntimeError(
|
||||
"internal dtype error, unknown kind {!r}"
|
||||
.format(dtype.kind)
|
||||
)
|
||||
|
||||
|
||||
def __str__(dtype):
|
||||
if dtype.fields is not None:
|
||||
return _struct_str(dtype, include_align=True)
|
||||
elif dtype.subdtype:
|
||||
return _subarray_str(dtype)
|
||||
elif issubclass(dtype.type, np.flexible) or not dtype.isnative:
|
||||
return dtype.str
|
||||
else:
|
||||
return dtype.name
|
||||
|
||||
|
||||
def __repr__(dtype):
|
||||
arg_str = _construction_repr(dtype, include_align=False)
|
||||
if dtype.isalignedstruct:
|
||||
arg_str = arg_str + ", align=True"
|
||||
return "dtype({})".format(arg_str)
|
||||
|
||||
|
||||
def _unpack_field(dtype, offset, title=None):
|
||||
"""
|
||||
Helper function to normalize the items in dtype.fields.
|
||||
|
||||
Call as:
|
||||
|
||||
dtype, offset, title = _unpack_field(*dtype.fields[name])
|
||||
"""
|
||||
return dtype, offset, title
|
||||
|
||||
|
||||
def _isunsized(dtype):
|
||||
# PyDataType_ISUNSIZED
|
||||
return dtype.itemsize == 0
|
||||
|
||||
|
||||
def _construction_repr(dtype, include_align=False, short=False):
|
||||
"""
|
||||
Creates a string repr of the dtype, excluding the 'dtype()' part
|
||||
surrounding the object. This object may be a string, a list, or
|
||||
a dict depending on the nature of the dtype. This
|
||||
is the object passed as the first parameter to the dtype
|
||||
constructor, and if no additional constructor parameters are
|
||||
given, will reproduce the exact memory layout.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
short : bool
|
||||
If true, this creates a shorter repr using 'kind' and 'itemsize', instead
|
||||
of the longer type name.
|
||||
|
||||
include_align : bool
|
||||
If true, this includes the 'align=True' parameter
|
||||
inside the struct dtype construction dict when needed. Use this flag
|
||||
if you want a proper repr string without the 'dtype()' part around it.
|
||||
|
||||
If false, this does not preserve the
|
||||
'align=True' parameter or sticky NPY_ALIGNED_STRUCT flag for
|
||||
struct arrays like the regular repr does, because the 'align'
|
||||
flag is not part of first dtype constructor parameter. This
|
||||
mode is intended for a full 'repr', where the 'align=True' is
|
||||
provided as the second parameter.
|
||||
"""
|
||||
if dtype.fields is not None:
|
||||
return _struct_str(dtype, include_align=include_align)
|
||||
elif dtype.subdtype:
|
||||
return _subarray_str(dtype)
|
||||
else:
|
||||
return _scalar_str(dtype, short=short)
|
||||
|
||||
|
||||
def _scalar_str(dtype, short):
|
||||
byteorder = _byte_order_str(dtype)
|
||||
|
||||
if dtype.type == np.bool_:
|
||||
if short:
|
||||
return "'?'"
|
||||
else:
|
||||
return "'bool'"
|
||||
|
||||
elif dtype.type == np.object_:
|
||||
# The object reference may be different sizes on different
|
||||
# platforms, so it should never include the itemsize here.
|
||||
return "'O'"
|
||||
|
||||
elif dtype.type == np.string_:
|
||||
if _isunsized(dtype):
|
||||
return "'S'"
|
||||
else:
|
||||
return "'S%d'" % dtype.itemsize
|
||||
|
||||
elif dtype.type == np.unicode_:
|
||||
if _isunsized(dtype):
|
||||
return "'%sU'" % byteorder
|
||||
else:
|
||||
return "'%sU%d'" % (byteorder, dtype.itemsize / 4)
|
||||
|
||||
# unlike the other types, subclasses of void are preserved - but
|
||||
# historically the repr does not actually reveal the subclass
|
||||
elif issubclass(dtype.type, np.void):
|
||||
if _isunsized(dtype):
|
||||
return "'V'"
|
||||
else:
|
||||
return "'V%d'" % dtype.itemsize
|
||||
|
||||
elif dtype.type == np.datetime64:
|
||||
return "'%sM8%s'" % (byteorder, _datetime_metadata_str(dtype))
|
||||
|
||||
elif dtype.type == np.timedelta64:
|
||||
return "'%sm8%s'" % (byteorder, _datetime_metadata_str(dtype))
|
||||
|
||||
elif np.issubdtype(dtype, np.number):
|
||||
# Short repr with endianness, like '<f8'
|
||||
if short or dtype.byteorder not in ('=', '|'):
|
||||
return "'%s%c%d'" % (byteorder, dtype.kind, dtype.itemsize)
|
||||
|
||||
# Longer repr, like 'float64'
|
||||
else:
|
||||
return "'%s%d'" % (_kind_name(dtype), 8*dtype.itemsize)
|
||||
|
||||
elif dtype.isbuiltin == 2:
|
||||
return dtype.type.__name__
|
||||
|
||||
else:
|
||||
raise RuntimeError(
|
||||
"Internal error: NumPy dtype unrecognized type number")
|
||||
|
||||
|
||||
def _byte_order_str(dtype):
|
||||
""" Normalize byteorder to '<' or '>' """
|
||||
# hack to obtain the native and swapped byte order characters
|
||||
swapped = np.dtype(int).newbyteorder('s')
|
||||
native = swapped.newbyteorder('s')
|
||||
|
||||
byteorder = dtype.byteorder
|
||||
if byteorder == '=':
|
||||
return native.byteorder
|
||||
if byteorder == 's':
|
||||
# TODO: this path can never be reached
|
||||
return swapped.byteorder
|
||||
elif byteorder == '|':
|
||||
return ''
|
||||
else:
|
||||
return byteorder
|
||||
|
||||
|
||||
def _datetime_metadata_str(dtype):
|
||||
# TODO: this duplicates the C append_metastr_to_string
|
||||
unit, count = np.datetime_data(dtype)
|
||||
if unit == 'generic':
|
||||
return ''
|
||||
elif count == 1:
|
||||
return '[{}]'.format(unit)
|
||||
else:
|
||||
return '[{}{}]'.format(count, unit)
|
||||
|
||||
|
||||
def _struct_dict_str(dtype, includealignedflag):
|
||||
# unpack the fields dictionary into ls
|
||||
names = dtype.names
|
||||
fld_dtypes = []
|
||||
offsets = []
|
||||
titles = []
|
||||
for name in names:
|
||||
fld_dtype, offset, title = _unpack_field(*dtype.fields[name])
|
||||
fld_dtypes.append(fld_dtype)
|
||||
offsets.append(offset)
|
||||
titles.append(title)
|
||||
|
||||
# Build up a string to make the dictionary
|
||||
|
||||
# First, the names
|
||||
ret = "{'names':["
|
||||
ret += ",".join(repr(name) for name in names)
|
||||
|
||||
# Second, the formats
|
||||
ret += "], 'formats':["
|
||||
ret += ",".join(
|
||||
_construction_repr(fld_dtype, short=True) for fld_dtype in fld_dtypes)
|
||||
|
||||
# Third, the offsets
|
||||
ret += "], 'offsets':["
|
||||
ret += ",".join("%d" % offset for offset in offsets)
|
||||
|
||||
# Fourth, the titles
|
||||
if any(title is not None for title in titles):
|
||||
ret += "], 'titles':["
|
||||
ret += ",".join(repr(title) for title in titles)
|
||||
|
||||
# Fifth, the itemsize
|
||||
ret += "], 'itemsize':%d" % dtype.itemsize
|
||||
|
||||
if (includealignedflag and dtype.isalignedstruct):
|
||||
# Finally, the aligned flag
|
||||
ret += ", 'aligned':True}"
|
||||
else:
|
||||
ret += "}"
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def _is_packed(dtype):
|
||||
"""
|
||||
Checks whether the structured data type in 'dtype'
|
||||
has a simple layout, where all the fields are in order,
|
||||
and follow each other with no alignment padding.
|
||||
|
||||
When this returns true, the dtype can be reconstructed
|
||||
from a list of the field names and dtypes with no additional
|
||||
dtype parameters.
|
||||
|
||||
Duplicates the C `is_dtype_struct_simple_unaligned_layout` functio.
|
||||
"""
|
||||
total_offset = 0
|
||||
for name in dtype.names:
|
||||
fld_dtype, fld_offset, title = _unpack_field(*dtype.fields[name])
|
||||
if fld_offset != total_offset:
|
||||
return False
|
||||
total_offset += fld_dtype.itemsize
|
||||
if total_offset != dtype.itemsize:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def _struct_list_str(dtype):
|
||||
items = []
|
||||
for name in dtype.names:
|
||||
fld_dtype, fld_offset, title = _unpack_field(*dtype.fields[name])
|
||||
|
||||
item = "("
|
||||
if title is not None:
|
||||
item += "({!r}, {!r}), ".format(title, name)
|
||||
else:
|
||||
item += "{!r}, ".format(name)
|
||||
# Special case subarray handling here
|
||||
if fld_dtype.subdtype is not None:
|
||||
base, shape = fld_dtype.subdtype
|
||||
item += "{}, {}".format(
|
||||
_construction_repr(base, short=True),
|
||||
shape
|
||||
)
|
||||
else:
|
||||
item += _construction_repr(fld_dtype, short=True)
|
||||
|
||||
item += ")"
|
||||
items.append(item)
|
||||
|
||||
return "[" + ", ".join(items) + "]"
|
||||
|
||||
|
||||
def _struct_str(dtype, include_align):
|
||||
# The list str representation can't include the 'align=' flag,
|
||||
# so if it is requested and the struct has the aligned flag set,
|
||||
# we must use the dict str instead.
|
||||
if not (include_align and dtype.isalignedstruct) and _is_packed(dtype):
|
||||
sub = _struct_list_str(dtype)
|
||||
|
||||
else:
|
||||
sub = _struct_dict_str(dtype, include_align)
|
||||
|
||||
# If the data type isn't the default, void, show it
|
||||
if dtype.type != np.void:
|
||||
return "({t.__module__}.{t.__name__}, {f})".format(t=dtype.type, f=sub)
|
||||
else:
|
||||
return sub
|
||||
|
||||
|
||||
def _subarray_str(dtype):
|
||||
base, shape = dtype.subdtype
|
||||
return "({}, {})".format(
|
||||
_construction_repr(base, short=True),
|
||||
shape
|
||||
)
|
||||
|
||||
|
||||
def _name_get(dtype):
|
||||
# provides dtype.name.__get__
|
||||
|
||||
if dtype.isbuiltin == 2:
|
||||
# user dtypes don't promise to do anything special
|
||||
return dtype.type.__name__
|
||||
|
||||
# Builtin classes are documented as returning a "bit name"
|
||||
name = dtype.type.__name__
|
||||
|
||||
# handle bool_, str_, etc
|
||||
if name[-1] == '_':
|
||||
name = name[:-1]
|
||||
|
||||
# append bit counts to str, unicode, and void
|
||||
if np.issubdtype(dtype, np.flexible) and not _isunsized(dtype):
|
||||
name += "{}".format(dtype.itemsize * 8)
|
||||
|
||||
# append metadata to datetimes
|
||||
elif dtype.type in (np.datetime64, np.timedelta64):
|
||||
name += _datetime_metadata_str(dtype)
|
||||
|
||||
return name
|
@ -0,0 +1,113 @@
|
||||
"""
|
||||
Conversion from ctypes to dtype.
|
||||
|
||||
In an ideal world, we could achieve this through the PEP3118 buffer protocol,
|
||||
something like::
|
||||
|
||||
def dtype_from_ctypes_type(t):
|
||||
# needed to ensure that the shape of `t` is within memoryview.format
|
||||
class DummyStruct(ctypes.Structure):
|
||||
_fields_ = [('a', t)]
|
||||
|
||||
# empty to avoid memory allocation
|
||||
ctype_0 = (DummyStruct * 0)()
|
||||
mv = memoryview(ctype_0)
|
||||
|
||||
# convert the struct, and slice back out the field
|
||||
return _dtype_from_pep3118(mv.format)['a']
|
||||
|
||||
Unfortunately, this fails because:
|
||||
|
||||
* ctypes cannot handle length-0 arrays with PEP3118 (bpo-32782)
|
||||
* PEP3118 cannot represent unions, but both numpy and ctypes can
|
||||
* ctypes cannot handle big-endian structs with PEP3118 (bpo-32780)
|
||||
"""
|
||||
import _ctypes
|
||||
import ctypes
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
def _from_ctypes_array(t):
|
||||
return np.dtype((dtype_from_ctypes_type(t._type_), (t._length_,)))
|
||||
|
||||
|
||||
def _from_ctypes_structure(t):
|
||||
for item in t._fields_:
|
||||
if len(item) > 2:
|
||||
raise TypeError(
|
||||
"ctypes bitfields have no dtype equivalent")
|
||||
|
||||
if hasattr(t, "_pack_"):
|
||||
formats = []
|
||||
offsets = []
|
||||
names = []
|
||||
current_offset = 0
|
||||
for fname, ftyp in t._fields_:
|
||||
names.append(fname)
|
||||
formats.append(dtype_from_ctypes_type(ftyp))
|
||||
# Each type has a default offset, this is platform dependent for some types.
|
||||
effective_pack = min(t._pack_, ctypes.alignment(ftyp))
|
||||
current_offset = ((current_offset + effective_pack - 1) // effective_pack) * effective_pack
|
||||
offsets.append(current_offset)
|
||||
current_offset += ctypes.sizeof(ftyp)
|
||||
|
||||
return np.dtype(dict(
|
||||
formats=formats,
|
||||
offsets=offsets,
|
||||
names=names,
|
||||
itemsize=ctypes.sizeof(t)))
|
||||
else:
|
||||
fields = []
|
||||
for fname, ftyp in t._fields_:
|
||||
fields.append((fname, dtype_from_ctypes_type(ftyp)))
|
||||
|
||||
# by default, ctypes structs are aligned
|
||||
return np.dtype(fields, align=True)
|
||||
|
||||
|
||||
def _from_ctypes_scalar(t):
|
||||
"""
|
||||
Return the dtype type with endianness included if it's the case
|
||||
"""
|
||||
if getattr(t, '__ctype_be__', None) is t:
|
||||
return np.dtype('>' + t._type_)
|
||||
elif getattr(t, '__ctype_le__', None) is t:
|
||||
return np.dtype('<' + t._type_)
|
||||
else:
|
||||
return np.dtype(t._type_)
|
||||
|
||||
|
||||
def _from_ctypes_union(t):
|
||||
formats = []
|
||||
offsets = []
|
||||
names = []
|
||||
for fname, ftyp in t._fields_:
|
||||
names.append(fname)
|
||||
formats.append(dtype_from_ctypes_type(ftyp))
|
||||
offsets.append(0) # Union fields are offset to 0
|
||||
|
||||
return np.dtype(dict(
|
||||
formats=formats,
|
||||
offsets=offsets,
|
||||
names=names,
|
||||
itemsize=ctypes.sizeof(t)))
|
||||
|
||||
|
||||
def dtype_from_ctypes_type(t):
|
||||
"""
|
||||
Construct a dtype object from a ctypes type
|
||||
"""
|
||||
if issubclass(t, _ctypes.Array):
|
||||
return _from_ctypes_array(t)
|
||||
elif issubclass(t, _ctypes._Pointer):
|
||||
raise TypeError("ctypes pointers have no dtype equivalent")
|
||||
elif issubclass(t, _ctypes.Structure):
|
||||
return _from_ctypes_structure(t)
|
||||
elif issubclass(t, _ctypes.Union):
|
||||
return _from_ctypes_union(t)
|
||||
elif isinstance(getattr(t, '_type_', None), str):
|
||||
return _from_ctypes_scalar(t)
|
||||
else:
|
||||
raise NotImplementedError(
|
||||
"Unknown ctypes type {}".format(t.__name__))
|
Binary file not shown.
@ -0,0 +1,152 @@
|
||||
"""
|
||||
Various richly-typed exceptions, that also help us deal with string formatting
|
||||
in python where it's easier.
|
||||
|
||||
By putting the formatting in `__str__`, we also avoid paying the cost for
|
||||
users who silence the exceptions.
|
||||
"""
|
||||
from numpy.core.overrides import set_module
|
||||
|
||||
def _unpack_tuple(tup):
|
||||
if len(tup) == 1:
|
||||
return tup[0]
|
||||
else:
|
||||
return tup
|
||||
|
||||
|
||||
def _display_as_base(cls):
|
||||
"""
|
||||
A decorator that makes an exception class look like its base.
|
||||
|
||||
We use this to hide subclasses that are implementation details - the user
|
||||
should catch the base type, which is what the traceback will show them.
|
||||
|
||||
Classes decorated with this decorator are subject to removal without a
|
||||
deprecation warning.
|
||||
"""
|
||||
assert issubclass(cls, Exception)
|
||||
cls.__name__ = cls.__base__.__name__
|
||||
cls.__qualname__ = cls.__base__.__qualname__
|
||||
set_module(cls.__base__.__module__)(cls)
|
||||
return cls
|
||||
|
||||
|
||||
class UFuncTypeError(TypeError):
|
||||
""" Base class for all ufunc exceptions """
|
||||
def __init__(self, ufunc):
|
||||
self.ufunc = ufunc
|
||||
|
||||
|
||||
@_display_as_base
|
||||
class _UFuncBinaryResolutionError(UFuncTypeError):
|
||||
""" Thrown when a binary resolution fails """
|
||||
def __init__(self, ufunc, dtypes):
|
||||
super().__init__(ufunc)
|
||||
self.dtypes = tuple(dtypes)
|
||||
assert len(self.dtypes) == 2
|
||||
|
||||
def __str__(self):
|
||||
return (
|
||||
"ufunc {!r} cannot use operands with types {!r} and {!r}"
|
||||
).format(
|
||||
self.ufunc.__name__, *self.dtypes
|
||||
)
|
||||
|
||||
|
||||
@_display_as_base
|
||||
class _UFuncNoLoopError(UFuncTypeError):
|
||||
""" Thrown when a ufunc loop cannot be found """
|
||||
def __init__(self, ufunc, dtypes):
|
||||
super().__init__(ufunc)
|
||||
self.dtypes = tuple(dtypes)
|
||||
|
||||
def __str__(self):
|
||||
return (
|
||||
"ufunc {!r} did not contain a loop with signature matching types "
|
||||
"{!r} -> {!r}"
|
||||
).format(
|
||||
self.ufunc.__name__,
|
||||
_unpack_tuple(self.dtypes[:self.ufunc.nin]),
|
||||
_unpack_tuple(self.dtypes[self.ufunc.nin:])
|
||||
)
|
||||
|
||||
|
||||
@_display_as_base
|
||||
class _UFuncCastingError(UFuncTypeError):
|
||||
def __init__(self, ufunc, casting, from_, to):
|
||||
super().__init__(ufunc)
|
||||
self.casting = casting
|
||||
self.from_ = from_
|
||||
self.to = to
|
||||
|
||||
|
||||
@_display_as_base
|
||||
class _UFuncInputCastingError(_UFuncCastingError):
|
||||
""" Thrown when a ufunc input cannot be casted """
|
||||
def __init__(self, ufunc, casting, from_, to, i):
|
||||
super().__init__(ufunc, casting, from_, to)
|
||||
self.in_i = i
|
||||
|
||||
def __str__(self):
|
||||
# only show the number if more than one input exists
|
||||
i_str = "{} ".format(self.in_i) if self.ufunc.nin != 1 else ""
|
||||
return (
|
||||
"Cannot cast ufunc {!r} input {}from {!r} to {!r} with casting "
|
||||
"rule {!r}"
|
||||
).format(
|
||||
self.ufunc.__name__, i_str, self.from_, self.to, self.casting
|
||||
)
|
||||
|
||||
|
||||
@_display_as_base
|
||||
class _UFuncOutputCastingError(_UFuncCastingError):
|
||||
""" Thrown when a ufunc output cannot be casted """
|
||||
def __init__(self, ufunc, casting, from_, to, i):
|
||||
super().__init__(ufunc, casting, from_, to)
|
||||
self.out_i = i
|
||||
|
||||
def __str__(self):
|
||||
# only show the number if more than one output exists
|
||||
i_str = "{} ".format(self.out_i) if self.ufunc.nout != 1 else ""
|
||||
return (
|
||||
"Cannot cast ufunc {!r} output {}from {!r} to {!r} with casting "
|
||||
"rule {!r}"
|
||||
).format(
|
||||
self.ufunc.__name__, i_str, self.from_, self.to, self.casting
|
||||
)
|
||||
|
||||
|
||||
# Exception used in shares_memory()
|
||||
@set_module('numpy')
|
||||
class TooHardError(RuntimeError):
|
||||
pass
|
||||
|
||||
|
||||
@set_module('numpy')
|
||||
class AxisError(ValueError, IndexError):
|
||||
""" Axis supplied was invalid. """
|
||||
def __init__(self, axis, ndim=None, msg_prefix=None):
|
||||
# single-argument form just delegates to base class
|
||||
if ndim is None and msg_prefix is None:
|
||||
msg = axis
|
||||
|
||||
# do the string formatting here, to save work in the C code
|
||||
else:
|
||||
msg = ("axis {} is out of bounds for array of dimension {}"
|
||||
.format(axis, ndim))
|
||||
if msg_prefix is not None:
|
||||
msg = "{}: {}".format(msg_prefix, msg)
|
||||
|
||||
super(AxisError, self).__init__(msg)
|
||||
|
||||
|
||||
@_display_as_base
|
||||
class _ArrayMemoryError(MemoryError):
|
||||
""" Thrown when an array cannot be allocated"""
|
||||
def __init__(self, shape, dtype):
|
||||
self.shape = shape
|
||||
self.dtype = dtype
|
||||
|
||||
def __str__(self):
|
||||
return "Unable to allocate array with shape {} and data type {}".format(self.shape, self.dtype)
|
||||
|
@ -0,0 +1,912 @@
|
||||
"""
|
||||
A place for internal code
|
||||
|
||||
Some things are more easily handled Python.
|
||||
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
import re
|
||||
import sys
|
||||
import platform
|
||||
|
||||
from numpy.compat import unicode
|
||||
from .multiarray import dtype, array, ndarray
|
||||
try:
|
||||
import ctypes
|
||||
except ImportError:
|
||||
ctypes = None
|
||||
|
||||
IS_PYPY = platform.python_implementation() == 'PyPy'
|
||||
|
||||
if (sys.byteorder == 'little'):
|
||||
_nbo = b'<'
|
||||
else:
|
||||
_nbo = b'>'
|
||||
|
||||
def _makenames_list(adict, align):
|
||||
allfields = []
|
||||
fnames = list(adict.keys())
|
||||
for fname in fnames:
|
||||
obj = adict[fname]
|
||||
n = len(obj)
|
||||
if not isinstance(obj, tuple) or n not in [2, 3]:
|
||||
raise ValueError("entry not a 2- or 3- tuple")
|
||||
if (n > 2) and (obj[2] == fname):
|
||||
continue
|
||||
num = int(obj[1])
|
||||
if (num < 0):
|
||||
raise ValueError("invalid offset.")
|
||||
format = dtype(obj[0], align=align)
|
||||
if (n > 2):
|
||||
title = obj[2]
|
||||
else:
|
||||
title = None
|
||||
allfields.append((fname, format, num, title))
|
||||
# sort by offsets
|
||||
allfields.sort(key=lambda x: x[2])
|
||||
names = [x[0] for x in allfields]
|
||||
formats = [x[1] for x in allfields]
|
||||
offsets = [x[2] for x in allfields]
|
||||
titles = [x[3] for x in allfields]
|
||||
|
||||
return names, formats, offsets, titles
|
||||
|
||||
# Called in PyArray_DescrConverter function when
|
||||
# a dictionary without "names" and "formats"
|
||||
# fields is used as a data-type descriptor.
|
||||
def _usefields(adict, align):
|
||||
try:
|
||||
names = adict[-1]
|
||||
except KeyError:
|
||||
names = None
|
||||
if names is None:
|
||||
names, formats, offsets, titles = _makenames_list(adict, align)
|
||||
else:
|
||||
formats = []
|
||||
offsets = []
|
||||
titles = []
|
||||
for name in names:
|
||||
res = adict[name]
|
||||
formats.append(res[0])
|
||||
offsets.append(res[1])
|
||||
if (len(res) > 2):
|
||||
titles.append(res[2])
|
||||
else:
|
||||
titles.append(None)
|
||||
|
||||
return dtype({"names": names,
|
||||
"formats": formats,
|
||||
"offsets": offsets,
|
||||
"titles": titles}, align)
|
||||
|
||||
|
||||
# construct an array_protocol descriptor list
|
||||
# from the fields attribute of a descriptor
|
||||
# This calls itself recursively but should eventually hit
|
||||
# a descriptor that has no fields and then return
|
||||
# a simple typestring
|
||||
|
||||
def _array_descr(descriptor):
|
||||
fields = descriptor.fields
|
||||
if fields is None:
|
||||
subdtype = descriptor.subdtype
|
||||
if subdtype is None:
|
||||
if descriptor.metadata is None:
|
||||
return descriptor.str
|
||||
else:
|
||||
new = descriptor.metadata.copy()
|
||||
if new:
|
||||
return (descriptor.str, new)
|
||||
else:
|
||||
return descriptor.str
|
||||
else:
|
||||
return (_array_descr(subdtype[0]), subdtype[1])
|
||||
|
||||
names = descriptor.names
|
||||
ordered_fields = [fields[x] + (x,) for x in names]
|
||||
result = []
|
||||
offset = 0
|
||||
for field in ordered_fields:
|
||||
if field[1] > offset:
|
||||
num = field[1] - offset
|
||||
result.append(('', '|V%d' % num))
|
||||
offset += num
|
||||
elif field[1] < offset:
|
||||
raise ValueError(
|
||||
"dtype.descr is not defined for types with overlapping or "
|
||||
"out-of-order fields")
|
||||
if len(field) > 3:
|
||||
name = (field[2], field[3])
|
||||
else:
|
||||
name = field[2]
|
||||
if field[0].subdtype:
|
||||
tup = (name, _array_descr(field[0].subdtype[0]),
|
||||
field[0].subdtype[1])
|
||||
else:
|
||||
tup = (name, _array_descr(field[0]))
|
||||
offset += field[0].itemsize
|
||||
result.append(tup)
|
||||
|
||||
if descriptor.itemsize > offset:
|
||||
num = descriptor.itemsize - offset
|
||||
result.append(('', '|V%d' % num))
|
||||
|
||||
return result
|
||||
|
||||
# Build a new array from the information in a pickle.
|
||||
# Note that the name numpy.core._internal._reconstruct is embedded in
|
||||
# pickles of ndarrays made with NumPy before release 1.0
|
||||
# so don't remove the name here, or you'll
|
||||
# break backward compatibility.
|
||||
def _reconstruct(subtype, shape, dtype):
|
||||
return ndarray.__new__(subtype, shape, dtype)
|
||||
|
||||
|
||||
# format_re was originally from numarray by J. Todd Miller
|
||||
|
||||
format_re = re.compile(br'(?P<order1>[<>|=]?)'
|
||||
br'(?P<repeats> *[(]?[ ,0-9]*[)]? *)'
|
||||
br'(?P<order2>[<>|=]?)'
|
||||
br'(?P<dtype>[A-Za-z0-9.?]*(?:\[[a-zA-Z0-9,.]+\])?)')
|
||||
sep_re = re.compile(br'\s*,\s*')
|
||||
space_re = re.compile(br'\s+$')
|
||||
|
||||
# astr is a string (perhaps comma separated)
|
||||
|
||||
_convorder = {b'=': _nbo}
|
||||
|
||||
def _commastring(astr):
|
||||
startindex = 0
|
||||
result = []
|
||||
while startindex < len(astr):
|
||||
mo = format_re.match(astr, pos=startindex)
|
||||
try:
|
||||
(order1, repeats, order2, dtype) = mo.groups()
|
||||
except (TypeError, AttributeError):
|
||||
raise ValueError('format number %d of "%s" is not recognized' %
|
||||
(len(result)+1, astr))
|
||||
startindex = mo.end()
|
||||
# Separator or ending padding
|
||||
if startindex < len(astr):
|
||||
if space_re.match(astr, pos=startindex):
|
||||
startindex = len(astr)
|
||||
else:
|
||||
mo = sep_re.match(astr, pos=startindex)
|
||||
if not mo:
|
||||
raise ValueError(
|
||||
'format number %d of "%s" is not recognized' %
|
||||
(len(result)+1, astr))
|
||||
startindex = mo.end()
|
||||
|
||||
if order2 == b'':
|
||||
order = order1
|
||||
elif order1 == b'':
|
||||
order = order2
|
||||
else:
|
||||
order1 = _convorder.get(order1, order1)
|
||||
order2 = _convorder.get(order2, order2)
|
||||
if (order1 != order2):
|
||||
raise ValueError(
|
||||
'inconsistent byte-order specification %s and %s' %
|
||||
(order1, order2))
|
||||
order = order1
|
||||
|
||||
if order in [b'|', b'=', _nbo]:
|
||||
order = b''
|
||||
dtype = order + dtype
|
||||
if (repeats == b''):
|
||||
newitem = dtype
|
||||
else:
|
||||
newitem = (dtype, eval(repeats))
|
||||
result.append(newitem)
|
||||
|
||||
return result
|
||||
|
||||
class dummy_ctype(object):
|
||||
def __init__(self, cls):
|
||||
self._cls = cls
|
||||
def __mul__(self, other):
|
||||
return self
|
||||
def __call__(self, *other):
|
||||
return self._cls(other)
|
||||
def __eq__(self, other):
|
||||
return self._cls == other._cls
|
||||
def __ne__(self, other):
|
||||
return self._cls != other._cls
|
||||
|
||||
def _getintp_ctype():
|
||||
val = _getintp_ctype.cache
|
||||
if val is not None:
|
||||
return val
|
||||
if ctypes is None:
|
||||
import numpy as np
|
||||
val = dummy_ctype(np.intp)
|
||||
else:
|
||||
char = dtype('p').char
|
||||
if (char == 'i'):
|
||||
val = ctypes.c_int
|
||||
elif char == 'l':
|
||||
val = ctypes.c_long
|
||||
elif char == 'q':
|
||||
val = ctypes.c_longlong
|
||||
else:
|
||||
val = ctypes.c_long
|
||||
_getintp_ctype.cache = val
|
||||
return val
|
||||
_getintp_ctype.cache = None
|
||||
|
||||
# Used for .ctypes attribute of ndarray
|
||||
|
||||
class _missing_ctypes(object):
|
||||
def cast(self, num, obj):
|
||||
return num.value
|
||||
|
||||
class c_void_p(object):
|
||||
def __init__(self, ptr):
|
||||
self.value = ptr
|
||||
|
||||
|
||||
class _unsafe_first_element_pointer(object):
|
||||
"""
|
||||
Helper to allow viewing an array as a ctypes pointer to the first element
|
||||
|
||||
This avoids:
|
||||
* dealing with strides
|
||||
* `.view` rejecting object-containing arrays
|
||||
* `memoryview` not supporting overlapping fields
|
||||
"""
|
||||
def __init__(self, arr):
|
||||
self.base = arr
|
||||
|
||||
@property
|
||||
def __array_interface__(self):
|
||||
i = dict(
|
||||
shape=(),
|
||||
typestr='|V0',
|
||||
data=(self.base.__array_interface__['data'][0], False),
|
||||
strides=(),
|
||||
version=3,
|
||||
)
|
||||
return i
|
||||
|
||||
|
||||
def _get_void_ptr(arr):
|
||||
"""
|
||||
Get a `ctypes.c_void_p` to arr.data, that keeps a reference to the array
|
||||
"""
|
||||
import numpy as np
|
||||
# convert to a 0d array that has a data pointer referrign to the start
|
||||
# of arr. This holds a reference to arr.
|
||||
simple_arr = np.asarray(_unsafe_first_element_pointer(arr))
|
||||
|
||||
# create a `char[0]` using the same memory.
|
||||
c_arr = (ctypes.c_char * 0).from_buffer(simple_arr)
|
||||
|
||||
# finally cast to void*
|
||||
return ctypes.cast(ctypes.pointer(c_arr), ctypes.c_void_p)
|
||||
|
||||
|
||||
class _ctypes(object):
|
||||
def __init__(self, array, ptr=None):
|
||||
self._arr = array
|
||||
|
||||
if ctypes:
|
||||
self._ctypes = ctypes
|
||||
# get a void pointer to the buffer, which keeps the array alive
|
||||
self._data = _get_void_ptr(array)
|
||||
assert self._data.value == ptr
|
||||
else:
|
||||
# fake a pointer-like object that holds onto the reference
|
||||
self._ctypes = _missing_ctypes()
|
||||
self._data = self._ctypes.c_void_p(ptr)
|
||||
self._data._objects = array
|
||||
|
||||
if self._arr.ndim == 0:
|
||||
self._zerod = True
|
||||
else:
|
||||
self._zerod = False
|
||||
|
||||
def data_as(self, obj):
|
||||
"""
|
||||
Return the data pointer cast to a particular c-types object.
|
||||
For example, calling ``self._as_parameter_`` is equivalent to
|
||||
``self.data_as(ctypes.c_void_p)``. Perhaps you want to use the data as a
|
||||
pointer to a ctypes array of floating-point data:
|
||||
``self.data_as(ctypes.POINTER(ctypes.c_double))``.
|
||||
|
||||
The returned pointer will keep a reference to the array.
|
||||
"""
|
||||
return self._ctypes.cast(self._data, obj)
|
||||
|
||||
def shape_as(self, obj):
|
||||
"""
|
||||
Return the shape tuple as an array of some other c-types
|
||||
type. For example: ``self.shape_as(ctypes.c_short)``.
|
||||
"""
|
||||
if self._zerod:
|
||||
return None
|
||||
return (obj*self._arr.ndim)(*self._arr.shape)
|
||||
|
||||
def strides_as(self, obj):
|
||||
"""
|
||||
Return the strides tuple as an array of some other
|
||||
c-types type. For example: ``self.strides_as(ctypes.c_longlong)``.
|
||||
"""
|
||||
if self._zerod:
|
||||
return None
|
||||
return (obj*self._arr.ndim)(*self._arr.strides)
|
||||
|
||||
@property
|
||||
def data(self):
|
||||
"""
|
||||
A pointer to the memory area of the array as a Python integer.
|
||||
This memory area may contain data that is not aligned, or not in correct
|
||||
byte-order. The memory area may not even be writeable. The array
|
||||
flags and data-type of this array should be respected when passing this
|
||||
attribute to arbitrary C-code to avoid trouble that can include Python
|
||||
crashing. User Beware! The value of this attribute is exactly the same
|
||||
as ``self._array_interface_['data'][0]``.
|
||||
|
||||
Note that unlike `data_as`, a reference will not be kept to the array:
|
||||
code like ``ctypes.c_void_p((a + b).ctypes.data)`` will result in a
|
||||
pointer to a deallocated array, and should be spelt
|
||||
``(a + b).ctypes.data_as(ctypes.c_void_p)``
|
||||
"""
|
||||
return self._data.value
|
||||
|
||||
@property
|
||||
def shape(self):
|
||||
"""
|
||||
(c_intp*self.ndim): A ctypes array of length self.ndim where
|
||||
the basetype is the C-integer corresponding to ``dtype('p')`` on this
|
||||
platform. This base-type could be `ctypes.c_int`, `ctypes.c_long`, or
|
||||
`ctypes.c_longlong` depending on the platform.
|
||||
The c_intp type is defined accordingly in `numpy.ctypeslib`.
|
||||
The ctypes array contains the shape of the underlying array.
|
||||
"""
|
||||
return self.shape_as(_getintp_ctype())
|
||||
|
||||
@property
|
||||
def strides(self):
|
||||
"""
|
||||
(c_intp*self.ndim): A ctypes array of length self.ndim where
|
||||
the basetype is the same as for the shape attribute. This ctypes array
|
||||
contains the strides information from the underlying array. This strides
|
||||
information is important for showing how many bytes must be jumped to
|
||||
get to the next element in the array.
|
||||
"""
|
||||
return self.strides_as(_getintp_ctype())
|
||||
|
||||
@property
|
||||
def _as_parameter_(self):
|
||||
"""
|
||||
Overrides the ctypes semi-magic method
|
||||
|
||||
Enables `c_func(some_array.ctypes)`
|
||||
"""
|
||||
return self._data
|
||||
|
||||
# kept for compatibility
|
||||
get_data = data.fget
|
||||
get_shape = shape.fget
|
||||
get_strides = strides.fget
|
||||
get_as_parameter = _as_parameter_.fget
|
||||
|
||||
|
||||
def _newnames(datatype, order):
|
||||
"""
|
||||
Given a datatype and an order object, return a new names tuple, with the
|
||||
order indicated
|
||||
"""
|
||||
oldnames = datatype.names
|
||||
nameslist = list(oldnames)
|
||||
if isinstance(order, (str, unicode)):
|
||||
order = [order]
|
||||
seen = set()
|
||||
if isinstance(order, (list, tuple)):
|
||||
for name in order:
|
||||
try:
|
||||
nameslist.remove(name)
|
||||
except ValueError:
|
||||
if name in seen:
|
||||
raise ValueError("duplicate field name: %s" % (name,))
|
||||
else:
|
||||
raise ValueError("unknown field name: %s" % (name,))
|
||||
seen.add(name)
|
||||
return tuple(list(order) + nameslist)
|
||||
raise ValueError("unsupported order value: %s" % (order,))
|
||||
|
||||
def _copy_fields(ary):
|
||||
"""Return copy of structured array with padding between fields removed.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
ary : ndarray
|
||||
Structured array from which to remove padding bytes
|
||||
|
||||
Returns
|
||||
-------
|
||||
ary_copy : ndarray
|
||||
Copy of ary with padding bytes removed
|
||||
"""
|
||||
dt = ary.dtype
|
||||
copy_dtype = {'names': dt.names,
|
||||
'formats': [dt.fields[name][0] for name in dt.names]}
|
||||
return array(ary, dtype=copy_dtype, copy=True)
|
||||
|
||||
def _getfield_is_safe(oldtype, newtype, offset):
|
||||
""" Checks safety of getfield for object arrays.
|
||||
|
||||
As in _view_is_safe, we need to check that memory containing objects is not
|
||||
reinterpreted as a non-object datatype and vice versa.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
oldtype : data-type
|
||||
Data type of the original ndarray.
|
||||
newtype : data-type
|
||||
Data type of the field being accessed by ndarray.getfield
|
||||
offset : int
|
||||
Offset of the field being accessed by ndarray.getfield
|
||||
|
||||
Raises
|
||||
------
|
||||
TypeError
|
||||
If the field access is invalid
|
||||
|
||||
"""
|
||||
if newtype.hasobject or oldtype.hasobject:
|
||||
if offset == 0 and newtype == oldtype:
|
||||
return
|
||||
if oldtype.names is not None:
|
||||
for name in oldtype.names:
|
||||
if (oldtype.fields[name][1] == offset and
|
||||
oldtype.fields[name][0] == newtype):
|
||||
return
|
||||
raise TypeError("Cannot get/set field of an object array")
|
||||
return
|
||||
|
||||
def _view_is_safe(oldtype, newtype):
|
||||
""" Checks safety of a view involving object arrays, for example when
|
||||
doing::
|
||||
|
||||
np.zeros(10, dtype=oldtype).view(newtype)
|
||||
|
||||
Parameters
|
||||
----------
|
||||
oldtype : data-type
|
||||
Data type of original ndarray
|
||||
newtype : data-type
|
||||
Data type of the view
|
||||
|
||||
Raises
|
||||
------
|
||||
TypeError
|
||||
If the new type is incompatible with the old type.
|
||||
|
||||
"""
|
||||
|
||||
# if the types are equivalent, there is no problem.
|
||||
# for example: dtype((np.record, 'i4,i4')) == dtype((np.void, 'i4,i4'))
|
||||
if oldtype == newtype:
|
||||
return
|
||||
|
||||
if newtype.hasobject or oldtype.hasobject:
|
||||
raise TypeError("Cannot change data-type for object array.")
|
||||
return
|
||||
|
||||
# Given a string containing a PEP 3118 format specifier,
|
||||
# construct a NumPy dtype
|
||||
|
||||
_pep3118_native_map = {
|
||||
'?': '?',
|
||||
'c': 'S1',
|
||||
'b': 'b',
|
||||
'B': 'B',
|
||||
'h': 'h',
|
||||
'H': 'H',
|
||||
'i': 'i',
|
||||
'I': 'I',
|
||||
'l': 'l',
|
||||
'L': 'L',
|
||||
'q': 'q',
|
||||
'Q': 'Q',
|
||||
'e': 'e',
|
||||
'f': 'f',
|
||||
'd': 'd',
|
||||
'g': 'g',
|
||||
'Zf': 'F',
|
||||
'Zd': 'D',
|
||||
'Zg': 'G',
|
||||
's': 'S',
|
||||
'w': 'U',
|
||||
'O': 'O',
|
||||
'x': 'V', # padding
|
||||
}
|
||||
_pep3118_native_typechars = ''.join(_pep3118_native_map.keys())
|
||||
|
||||
_pep3118_standard_map = {
|
||||
'?': '?',
|
||||
'c': 'S1',
|
||||
'b': 'b',
|
||||
'B': 'B',
|
||||
'h': 'i2',
|
||||
'H': 'u2',
|
||||
'i': 'i4',
|
||||
'I': 'u4',
|
||||
'l': 'i4',
|
||||
'L': 'u4',
|
||||
'q': 'i8',
|
||||
'Q': 'u8',
|
||||
'e': 'f2',
|
||||
'f': 'f',
|
||||
'd': 'd',
|
||||
'Zf': 'F',
|
||||
'Zd': 'D',
|
||||
's': 'S',
|
||||
'w': 'U',
|
||||
'O': 'O',
|
||||
'x': 'V', # padding
|
||||
}
|
||||
_pep3118_standard_typechars = ''.join(_pep3118_standard_map.keys())
|
||||
|
||||
_pep3118_unsupported_map = {
|
||||
'u': 'UCS-2 strings',
|
||||
'&': 'pointers',
|
||||
't': 'bitfields',
|
||||
'X': 'function pointers',
|
||||
}
|
||||
|
||||
class _Stream(object):
|
||||
def __init__(self, s):
|
||||
self.s = s
|
||||
self.byteorder = '@'
|
||||
|
||||
def advance(self, n):
|
||||
res = self.s[:n]
|
||||
self.s = self.s[n:]
|
||||
return res
|
||||
|
||||
def consume(self, c):
|
||||
if self.s[:len(c)] == c:
|
||||
self.advance(len(c))
|
||||
return True
|
||||
return False
|
||||
|
||||
def consume_until(self, c):
|
||||
if callable(c):
|
||||
i = 0
|
||||
while i < len(self.s) and not c(self.s[i]):
|
||||
i = i + 1
|
||||
return self.advance(i)
|
||||
else:
|
||||
i = self.s.index(c)
|
||||
res = self.advance(i)
|
||||
self.advance(len(c))
|
||||
return res
|
||||
|
||||
@property
|
||||
def next(self):
|
||||
return self.s[0]
|
||||
|
||||
def __bool__(self):
|
||||
return bool(self.s)
|
||||
__nonzero__ = __bool__
|
||||
|
||||
|
||||
def _dtype_from_pep3118(spec):
|
||||
stream = _Stream(spec)
|
||||
dtype, align = __dtype_from_pep3118(stream, is_subdtype=False)
|
||||
return dtype
|
||||
|
||||
def __dtype_from_pep3118(stream, is_subdtype):
|
||||
field_spec = dict(
|
||||
names=[],
|
||||
formats=[],
|
||||
offsets=[],
|
||||
itemsize=0
|
||||
)
|
||||
offset = 0
|
||||
common_alignment = 1
|
||||
is_padding = False
|
||||
|
||||
# Parse spec
|
||||
while stream:
|
||||
value = None
|
||||
|
||||
# End of structure, bail out to upper level
|
||||
if stream.consume('}'):
|
||||
break
|
||||
|
||||
# Sub-arrays (1)
|
||||
shape = None
|
||||
if stream.consume('('):
|
||||
shape = stream.consume_until(')')
|
||||
shape = tuple(map(int, shape.split(',')))
|
||||
|
||||
# Byte order
|
||||
if stream.next in ('@', '=', '<', '>', '^', '!'):
|
||||
byteorder = stream.advance(1)
|
||||
if byteorder == '!':
|
||||
byteorder = '>'
|
||||
stream.byteorder = byteorder
|
||||
|
||||
# Byte order characters also control native vs. standard type sizes
|
||||
if stream.byteorder in ('@', '^'):
|
||||
type_map = _pep3118_native_map
|
||||
type_map_chars = _pep3118_native_typechars
|
||||
else:
|
||||
type_map = _pep3118_standard_map
|
||||
type_map_chars = _pep3118_standard_typechars
|
||||
|
||||
# Item sizes
|
||||
itemsize_str = stream.consume_until(lambda c: not c.isdigit())
|
||||
if itemsize_str:
|
||||
itemsize = int(itemsize_str)
|
||||
else:
|
||||
itemsize = 1
|
||||
|
||||
# Data types
|
||||
is_padding = False
|
||||
|
||||
if stream.consume('T{'):
|
||||
value, align = __dtype_from_pep3118(
|
||||
stream, is_subdtype=True)
|
||||
elif stream.next in type_map_chars:
|
||||
if stream.next == 'Z':
|
||||
typechar = stream.advance(2)
|
||||
else:
|
||||
typechar = stream.advance(1)
|
||||
|
||||
is_padding = (typechar == 'x')
|
||||
dtypechar = type_map[typechar]
|
||||
if dtypechar in 'USV':
|
||||
dtypechar += '%d' % itemsize
|
||||
itemsize = 1
|
||||
numpy_byteorder = {'@': '=', '^': '='}.get(
|
||||
stream.byteorder, stream.byteorder)
|
||||
value = dtype(numpy_byteorder + dtypechar)
|
||||
align = value.alignment
|
||||
elif stream.next in _pep3118_unsupported_map:
|
||||
desc = _pep3118_unsupported_map[stream.next]
|
||||
raise NotImplementedError(
|
||||
"Unrepresentable PEP 3118 data type {!r} ({})"
|
||||
.format(stream.next, desc))
|
||||
else:
|
||||
raise ValueError("Unknown PEP 3118 data type specifier %r" % stream.s)
|
||||
|
||||
#
|
||||
# Native alignment may require padding
|
||||
#
|
||||
# Here we assume that the presence of a '@' character implicitly implies
|
||||
# that the start of the array is *already* aligned.
|
||||
#
|
||||
extra_offset = 0
|
||||
if stream.byteorder == '@':
|
||||
start_padding = (-offset) % align
|
||||
intra_padding = (-value.itemsize) % align
|
||||
|
||||
offset += start_padding
|
||||
|
||||
if intra_padding != 0:
|
||||
if itemsize > 1 or (shape is not None and _prod(shape) > 1):
|
||||
# Inject internal padding to the end of the sub-item
|
||||
value = _add_trailing_padding(value, intra_padding)
|
||||
else:
|
||||
# We can postpone the injection of internal padding,
|
||||
# as the item appears at most once
|
||||
extra_offset += intra_padding
|
||||
|
||||
# Update common alignment
|
||||
common_alignment = _lcm(align, common_alignment)
|
||||
|
||||
# Convert itemsize to sub-array
|
||||
if itemsize != 1:
|
||||
value = dtype((value, (itemsize,)))
|
||||
|
||||
# Sub-arrays (2)
|
||||
if shape is not None:
|
||||
value = dtype((value, shape))
|
||||
|
||||
# Field name
|
||||
if stream.consume(':'):
|
||||
name = stream.consume_until(':')
|
||||
else:
|
||||
name = None
|
||||
|
||||
if not (is_padding and name is None):
|
||||
if name is not None and name in field_spec['names']:
|
||||
raise RuntimeError("Duplicate field name '%s' in PEP3118 format"
|
||||
% name)
|
||||
field_spec['names'].append(name)
|
||||
field_spec['formats'].append(value)
|
||||
field_spec['offsets'].append(offset)
|
||||
|
||||
offset += value.itemsize
|
||||
offset += extra_offset
|
||||
|
||||
field_spec['itemsize'] = offset
|
||||
|
||||
# extra final padding for aligned types
|
||||
if stream.byteorder == '@':
|
||||
field_spec['itemsize'] += (-offset) % common_alignment
|
||||
|
||||
# Check if this was a simple 1-item type, and unwrap it
|
||||
if (field_spec['names'] == [None]
|
||||
and field_spec['offsets'][0] == 0
|
||||
and field_spec['itemsize'] == field_spec['formats'][0].itemsize
|
||||
and not is_subdtype):
|
||||
ret = field_spec['formats'][0]
|
||||
else:
|
||||
_fix_names(field_spec)
|
||||
ret = dtype(field_spec)
|
||||
|
||||
# Finished
|
||||
return ret, common_alignment
|
||||
|
||||
def _fix_names(field_spec):
|
||||
""" Replace names which are None with the next unused f%d name """
|
||||
names = field_spec['names']
|
||||
for i, name in enumerate(names):
|
||||
if name is not None:
|
||||
continue
|
||||
|
||||
j = 0
|
||||
while True:
|
||||
name = 'f{}'.format(j)
|
||||
if name not in names:
|
||||
break
|
||||
j = j + 1
|
||||
names[i] = name
|
||||
|
||||
def _add_trailing_padding(value, padding):
|
||||
"""Inject the specified number of padding bytes at the end of a dtype"""
|
||||
if value.fields is None:
|
||||
field_spec = dict(
|
||||
names=['f0'],
|
||||
formats=[value],
|
||||
offsets=[0],
|
||||
itemsize=value.itemsize
|
||||
)
|
||||
else:
|
||||
fields = value.fields
|
||||
names = value.names
|
||||
field_spec = dict(
|
||||
names=names,
|
||||
formats=[fields[name][0] for name in names],
|
||||
offsets=[fields[name][1] for name in names],
|
||||
itemsize=value.itemsize
|
||||
)
|
||||
|
||||
field_spec['itemsize'] += padding
|
||||
return dtype(field_spec)
|
||||
|
||||
def _prod(a):
|
||||
p = 1
|
||||
for x in a:
|
||||
p *= x
|
||||
return p
|
||||
|
||||
def _gcd(a, b):
|
||||
"""Calculate the greatest common divisor of a and b"""
|
||||
while b:
|
||||
a, b = b, a % b
|
||||
return a
|
||||
|
||||
def _lcm(a, b):
|
||||
return a // _gcd(a, b) * b
|
||||
|
||||
def array_ufunc_errmsg_formatter(dummy, ufunc, method, *inputs, **kwargs):
|
||||
""" Format the error message for when __array_ufunc__ gives up. """
|
||||
args_string = ', '.join(['{!r}'.format(arg) for arg in inputs] +
|
||||
['{}={!r}'.format(k, v)
|
||||
for k, v in kwargs.items()])
|
||||
args = inputs + kwargs.get('out', ())
|
||||
types_string = ', '.join(repr(type(arg).__name__) for arg in args)
|
||||
return ('operand type(s) all returned NotImplemented from '
|
||||
'__array_ufunc__({!r}, {!r}, {}): {}'
|
||||
.format(ufunc, method, args_string, types_string))
|
||||
|
||||
|
||||
def array_function_errmsg_formatter(public_api, types):
|
||||
""" Format the error message for when __array_ufunc__ gives up. """
|
||||
func_name = '{}.{}'.format(public_api.__module__, public_api.__name__)
|
||||
return ("no implementation found for '{}' on types that implement "
|
||||
'__array_function__: {}'.format(func_name, list(types)))
|
||||
|
||||
|
||||
def _ufunc_doc_signature_formatter(ufunc):
|
||||
"""
|
||||
Builds a signature string which resembles PEP 457
|
||||
|
||||
This is used to construct the first line of the docstring
|
||||
"""
|
||||
|
||||
# input arguments are simple
|
||||
if ufunc.nin == 1:
|
||||
in_args = 'x'
|
||||
else:
|
||||
in_args = ', '.join('x{}'.format(i+1) for i in range(ufunc.nin))
|
||||
|
||||
# output arguments are both keyword or positional
|
||||
if ufunc.nout == 0:
|
||||
out_args = ', /, out=()'
|
||||
elif ufunc.nout == 1:
|
||||
out_args = ', /, out=None'
|
||||
else:
|
||||
out_args = '[, {positional}], / [, out={default}]'.format(
|
||||
positional=', '.join(
|
||||
'out{}'.format(i+1) for i in range(ufunc.nout)),
|
||||
default=repr((None,)*ufunc.nout)
|
||||
)
|
||||
|
||||
# keyword only args depend on whether this is a gufunc
|
||||
kwargs = (
|
||||
", casting='same_kind'"
|
||||
", order='K'"
|
||||
", dtype=None"
|
||||
", subok=True"
|
||||
"[, signature"
|
||||
", extobj]"
|
||||
)
|
||||
if ufunc.signature is None:
|
||||
kwargs = ", where=True" + kwargs
|
||||
|
||||
# join all the parts together
|
||||
return '{name}({in_args}{out_args}, *{kwargs})'.format(
|
||||
name=ufunc.__name__,
|
||||
in_args=in_args,
|
||||
out_args=out_args,
|
||||
kwargs=kwargs
|
||||
)
|
||||
|
||||
|
||||
def npy_ctypes_check(cls):
|
||||
# determine if a class comes from ctypes, in order to work around
|
||||
# a bug in the buffer protocol for those objects, bpo-10746
|
||||
try:
|
||||
# ctypes class are new-style, so have an __mro__. This probably fails
|
||||
# for ctypes classes with multiple inheritance.
|
||||
if IS_PYPY:
|
||||
# (..., _ctypes.basics._CData, Bufferable, object)
|
||||
ctype_base = cls.__mro__[-3]
|
||||
else:
|
||||
# # (..., _ctypes._CData, object)
|
||||
ctype_base = cls.__mro__[-2]
|
||||
# right now, they're part of the _ctypes module
|
||||
return 'ctypes' in ctype_base.__module__
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
class recursive(object):
|
||||
'''
|
||||
A decorator class for recursive nested functions.
|
||||
Naive recursive nested functions hold a reference to themselves:
|
||||
|
||||
def outer(*args):
|
||||
def stringify_leaky(arg0, *arg1):
|
||||
if len(arg1) > 0:
|
||||
return stringify_leaky(*arg1) # <- HERE
|
||||
return str(arg0)
|
||||
stringify_leaky(*args)
|
||||
|
||||
This design pattern creates a reference cycle that is difficult for a
|
||||
garbage collector to resolve. The decorator class prevents the
|
||||
cycle by passing the nested function in as an argument `self`:
|
||||
|
||||
def outer(*args):
|
||||
@recursive
|
||||
def stringify(self, arg0, *arg1):
|
||||
if len(arg1) > 0:
|
||||
return self(*arg1)
|
||||
return str(arg0)
|
||||
stringify(*args)
|
||||
|
||||
'''
|
||||
def __init__(self, func):
|
||||
self.func = func
|
||||
def __call__(self, *args, **kwargs):
|
||||
return self.func(self, *args, **kwargs)
|
||||
|
@ -0,0 +1,244 @@
|
||||
"""
|
||||
Array methods which are called by both the C-code for the method
|
||||
and the Python code for the NumPy-namespace function
|
||||
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
import warnings
|
||||
|
||||
from numpy.core import multiarray as mu
|
||||
from numpy.core import umath as um
|
||||
from numpy.core._asarray import asanyarray
|
||||
from numpy.core import numerictypes as nt
|
||||
from numpy.core import _exceptions
|
||||
from numpy._globals import _NoValue
|
||||
from numpy.compat import pickle, os_fspath, contextlib_nullcontext
|
||||
|
||||
# save those O(100) nanoseconds!
|
||||
umr_maximum = um.maximum.reduce
|
||||
umr_minimum = um.minimum.reduce
|
||||
umr_sum = um.add.reduce
|
||||
umr_prod = um.multiply.reduce
|
||||
umr_any = um.logical_or.reduce
|
||||
umr_all = um.logical_and.reduce
|
||||
|
||||
# avoid keyword arguments to speed up parsing, saves about 15%-20% for very
|
||||
# small reductions
|
||||
def _amax(a, axis=None, out=None, keepdims=False,
|
||||
initial=_NoValue, where=True):
|
||||
return umr_maximum(a, axis, None, out, keepdims, initial, where)
|
||||
|
||||
def _amin(a, axis=None, out=None, keepdims=False,
|
||||
initial=_NoValue, where=True):
|
||||
return umr_minimum(a, axis, None, out, keepdims, initial, where)
|
||||
|
||||
def _sum(a, axis=None, dtype=None, out=None, keepdims=False,
|
||||
initial=_NoValue, where=True):
|
||||
return umr_sum(a, axis, dtype, out, keepdims, initial, where)
|
||||
|
||||
def _prod(a, axis=None, dtype=None, out=None, keepdims=False,
|
||||
initial=_NoValue, where=True):
|
||||
return umr_prod(a, axis, dtype, out, keepdims, initial, where)
|
||||
|
||||
def _any(a, axis=None, dtype=None, out=None, keepdims=False):
|
||||
return umr_any(a, axis, dtype, out, keepdims)
|
||||
|
||||
def _all(a, axis=None, dtype=None, out=None, keepdims=False):
|
||||
return umr_all(a, axis, dtype, out, keepdims)
|
||||
|
||||
def _count_reduce_items(arr, axis):
|
||||
if axis is None:
|
||||
axis = tuple(range(arr.ndim))
|
||||
if not isinstance(axis, tuple):
|
||||
axis = (axis,)
|
||||
items = 1
|
||||
for ax in axis:
|
||||
items *= arr.shape[ax]
|
||||
return items
|
||||
|
||||
# Numpy 1.17.0, 2019-02-24
|
||||
# Various clip behavior deprecations, marked with _clip_dep as a prefix.
|
||||
|
||||
def _clip_dep_is_scalar_nan(a):
|
||||
# guarded to protect circular imports
|
||||
from numpy.core.fromnumeric import ndim
|
||||
if ndim(a) != 0:
|
||||
return False
|
||||
try:
|
||||
return um.isnan(a)
|
||||
except TypeError:
|
||||
return False
|
||||
|
||||
def _clip_dep_is_byte_swapped(a):
|
||||
if isinstance(a, mu.ndarray):
|
||||
return not a.dtype.isnative
|
||||
return False
|
||||
|
||||
def _clip_dep_invoke_with_casting(ufunc, *args, out=None, casting=None, **kwargs):
|
||||
# normal path
|
||||
if casting is not None:
|
||||
return ufunc(*args, out=out, casting=casting, **kwargs)
|
||||
|
||||
# try to deal with broken casting rules
|
||||
try:
|
||||
return ufunc(*args, out=out, **kwargs)
|
||||
except _exceptions._UFuncOutputCastingError as e:
|
||||
# Numpy 1.17.0, 2019-02-24
|
||||
warnings.warn(
|
||||
"Converting the output of clip from {!r} to {!r} is deprecated. "
|
||||
"Pass `casting=\"unsafe\"` explicitly to silence this warning, or "
|
||||
"correct the type of the variables.".format(e.from_, e.to),
|
||||
DeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
return ufunc(*args, out=out, casting="unsafe", **kwargs)
|
||||
|
||||
def _clip(a, min=None, max=None, out=None, *, casting=None, **kwargs):
|
||||
if min is None and max is None:
|
||||
raise ValueError("One of max or min must be given")
|
||||
|
||||
# Numpy 1.17.0, 2019-02-24
|
||||
# This deprecation probably incurs a substantial slowdown for small arrays,
|
||||
# it will be good to get rid of it.
|
||||
if not _clip_dep_is_byte_swapped(a) and not _clip_dep_is_byte_swapped(out):
|
||||
using_deprecated_nan = False
|
||||
if _clip_dep_is_scalar_nan(min):
|
||||
min = -float('inf')
|
||||
using_deprecated_nan = True
|
||||
if _clip_dep_is_scalar_nan(max):
|
||||
max = float('inf')
|
||||
using_deprecated_nan = True
|
||||
if using_deprecated_nan:
|
||||
warnings.warn(
|
||||
"Passing `np.nan` to mean no clipping in np.clip has always "
|
||||
"been unreliable, and is now deprecated. "
|
||||
"In future, this will always return nan, like it already does "
|
||||
"when min or max are arrays that contain nan. "
|
||||
"To skip a bound, pass either None or an np.inf of an "
|
||||
"appropriate sign.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
|
||||
if min is None:
|
||||
return _clip_dep_invoke_with_casting(
|
||||
um.minimum, a, max, out=out, casting=casting, **kwargs)
|
||||
elif max is None:
|
||||
return _clip_dep_invoke_with_casting(
|
||||
um.maximum, a, min, out=out, casting=casting, **kwargs)
|
||||
else:
|
||||
return _clip_dep_invoke_with_casting(
|
||||
um.clip, a, min, max, out=out, casting=casting, **kwargs)
|
||||
|
||||
def _mean(a, axis=None, dtype=None, out=None, keepdims=False):
|
||||
arr = asanyarray(a)
|
||||
|
||||
is_float16_result = False
|
||||
rcount = _count_reduce_items(arr, axis)
|
||||
# Make this warning show up first
|
||||
if rcount == 0:
|
||||
warnings.warn("Mean of empty slice.", RuntimeWarning, stacklevel=2)
|
||||
|
||||
# Cast bool, unsigned int, and int to float64 by default
|
||||
if dtype is None:
|
||||
if issubclass(arr.dtype.type, (nt.integer, nt.bool_)):
|
||||
dtype = mu.dtype('f8')
|
||||
elif issubclass(arr.dtype.type, nt.float16):
|
||||
dtype = mu.dtype('f4')
|
||||
is_float16_result = True
|
||||
|
||||
ret = umr_sum(arr, axis, dtype, out, keepdims)
|
||||
if isinstance(ret, mu.ndarray):
|
||||
ret = um.true_divide(
|
||||
ret, rcount, out=ret, casting='unsafe', subok=False)
|
||||
if is_float16_result and out is None:
|
||||
ret = arr.dtype.type(ret)
|
||||
elif hasattr(ret, 'dtype'):
|
||||
if is_float16_result:
|
||||
ret = arr.dtype.type(ret / rcount)
|
||||
else:
|
||||
ret = ret.dtype.type(ret / rcount)
|
||||
else:
|
||||
ret = ret / rcount
|
||||
|
||||
return ret
|
||||
|
||||
def _var(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False):
|
||||
arr = asanyarray(a)
|
||||
|
||||
rcount = _count_reduce_items(arr, axis)
|
||||
# Make this warning show up on top.
|
||||
if ddof >= rcount:
|
||||
warnings.warn("Degrees of freedom <= 0 for slice", RuntimeWarning,
|
||||
stacklevel=2)
|
||||
|
||||
# Cast bool, unsigned int, and int to float64 by default
|
||||
if dtype is None and issubclass(arr.dtype.type, (nt.integer, nt.bool_)):
|
||||
dtype = mu.dtype('f8')
|
||||
|
||||
# Compute the mean.
|
||||
# Note that if dtype is not of inexact type then arraymean will
|
||||
# not be either.
|
||||
arrmean = umr_sum(arr, axis, dtype, keepdims=True)
|
||||
if isinstance(arrmean, mu.ndarray):
|
||||
arrmean = um.true_divide(
|
||||
arrmean, rcount, out=arrmean, casting='unsafe', subok=False)
|
||||
else:
|
||||
arrmean = arrmean.dtype.type(arrmean / rcount)
|
||||
|
||||
# Compute sum of squared deviations from mean
|
||||
# Note that x may not be inexact and that we need it to be an array,
|
||||
# not a scalar.
|
||||
x = asanyarray(arr - arrmean)
|
||||
if issubclass(arr.dtype.type, (nt.floating, nt.integer)):
|
||||
x = um.multiply(x, x, out=x)
|
||||
else:
|
||||
x = um.multiply(x, um.conjugate(x), out=x).real
|
||||
|
||||
ret = umr_sum(x, axis, dtype, out, keepdims)
|
||||
|
||||
# Compute degrees of freedom and make sure it is not negative.
|
||||
rcount = max([rcount - ddof, 0])
|
||||
|
||||
# divide by degrees of freedom
|
||||
if isinstance(ret, mu.ndarray):
|
||||
ret = um.true_divide(
|
||||
ret, rcount, out=ret, casting='unsafe', subok=False)
|
||||
elif hasattr(ret, 'dtype'):
|
||||
ret = ret.dtype.type(ret / rcount)
|
||||
else:
|
||||
ret = ret / rcount
|
||||
|
||||
return ret
|
||||
|
||||
def _std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False):
|
||||
ret = _var(a, axis=axis, dtype=dtype, out=out, ddof=ddof,
|
||||
keepdims=keepdims)
|
||||
|
||||
if isinstance(ret, mu.ndarray):
|
||||
ret = um.sqrt(ret, out=ret)
|
||||
elif hasattr(ret, 'dtype'):
|
||||
ret = ret.dtype.type(um.sqrt(ret))
|
||||
else:
|
||||
ret = um.sqrt(ret)
|
||||
|
||||
return ret
|
||||
|
||||
def _ptp(a, axis=None, out=None, keepdims=False):
|
||||
return um.subtract(
|
||||
umr_maximum(a, axis, None, out, keepdims),
|
||||
umr_minimum(a, axis, None, None, keepdims),
|
||||
out
|
||||
)
|
||||
|
||||
def _dump(self, file, protocol=2):
|
||||
if hasattr(file, 'write'):
|
||||
ctx = contextlib_nullcontext(file)
|
||||
else:
|
||||
ctx = open(os_fspath(file), "wb")
|
||||
with ctx as f:
|
||||
pickle.dump(self, f, protocol=protocol)
|
||||
|
||||
def _dumps(self, protocol=2):
|
||||
return pickle.dumps(self, protocol=protocol)
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,100 @@
|
||||
"""
|
||||
String-handling utilities to avoid locale-dependence.
|
||||
|
||||
Used primarily to generate type name aliases.
|
||||
"""
|
||||
# "import string" is costly to import!
|
||||
# Construct the translation tables directly
|
||||
# "A" = chr(65), "a" = chr(97)
|
||||
_all_chars = [chr(_m) for _m in range(256)]
|
||||
_ascii_upper = _all_chars[65:65+26]
|
||||
_ascii_lower = _all_chars[97:97+26]
|
||||
LOWER_TABLE = "".join(_all_chars[:65] + _ascii_lower + _all_chars[65+26:])
|
||||
UPPER_TABLE = "".join(_all_chars[:97] + _ascii_upper + _all_chars[97+26:])
|
||||
|
||||
|
||||
def english_lower(s):
|
||||
""" Apply English case rules to convert ASCII strings to all lower case.
|
||||
|
||||
This is an internal utility function to replace calls to str.lower() such
|
||||
that we can avoid changing behavior with changing locales. In particular,
|
||||
Turkish has distinct dotted and dotless variants of the Latin letter "I" in
|
||||
both lowercase and uppercase. Thus, "I".lower() != "i" in a "tr" locale.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
s : str
|
||||
|
||||
Returns
|
||||
-------
|
||||
lowered : str
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> from numpy.core.numerictypes import english_lower
|
||||
>>> english_lower('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_')
|
||||
'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789_'
|
||||
>>> english_lower('')
|
||||
''
|
||||
"""
|
||||
lowered = s.translate(LOWER_TABLE)
|
||||
return lowered
|
||||
|
||||
|
||||
def english_upper(s):
|
||||
""" Apply English case rules to convert ASCII strings to all upper case.
|
||||
|
||||
This is an internal utility function to replace calls to str.upper() such
|
||||
that we can avoid changing behavior with changing locales. In particular,
|
||||
Turkish has distinct dotted and dotless variants of the Latin letter "I" in
|
||||
both lowercase and uppercase. Thus, "i".upper() != "I" in a "tr" locale.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
s : str
|
||||
|
||||
Returns
|
||||
-------
|
||||
uppered : str
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> from numpy.core.numerictypes import english_upper
|
||||
>>> english_upper('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_')
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'
|
||||
>>> english_upper('')
|
||||
''
|
||||
"""
|
||||
uppered = s.translate(UPPER_TABLE)
|
||||
return uppered
|
||||
|
||||
|
||||
def english_capitalize(s):
|
||||
""" Apply English case rules to convert the first character of an ASCII
|
||||
string to upper case.
|
||||
|
||||
This is an internal utility function to replace calls to str.capitalize()
|
||||
such that we can avoid changing behavior with changing locales.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
s : str
|
||||
|
||||
Returns
|
||||
-------
|
||||
capitalized : str
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> from numpy.core.numerictypes import english_capitalize
|
||||
>>> english_capitalize('int8')
|
||||
'Int8'
|
||||
>>> english_capitalize('Int8')
|
||||
'Int8'
|
||||
>>> english_capitalize('')
|
||||
''
|
||||
"""
|
||||
if s:
|
||||
return english_upper(s[0]) + s[1:]
|
||||
else:
|
||||
return s
|
Binary file not shown.
@ -0,0 +1,282 @@
|
||||
"""
|
||||
Due to compatibility, numpy has a very large number of different naming
|
||||
conventions for the scalar types (those subclassing from `numpy.generic`).
|
||||
This file produces a convoluted set of dictionaries mapping names to types,
|
||||
and sometimes other mappings too.
|
||||
|
||||
.. data:: allTypes
|
||||
A dictionary of names to types that will be exposed as attributes through
|
||||
``np.core.numerictypes.*``
|
||||
|
||||
.. data:: sctypeDict
|
||||
Similar to `allTypes`, but maps a broader set of aliases to their types.
|
||||
|
||||
.. data:: sctypeNA
|
||||
NumArray-compatible names for the scalar types. Contains not only
|
||||
``name: type`` mappings, but ``char: name`` mappings too.
|
||||
|
||||
.. deprecated:: 1.16
|
||||
|
||||
.. data:: sctypes
|
||||
A dictionary keyed by a "type group" string, providing a list of types
|
||||
under that group.
|
||||
|
||||
"""
|
||||
import warnings
|
||||
import sys
|
||||
|
||||
from numpy.compat import unicode
|
||||
from numpy._globals import VisibleDeprecationWarning
|
||||
from numpy.core._string_helpers import english_lower, english_capitalize
|
||||
from numpy.core.multiarray import typeinfo, dtype
|
||||
from numpy.core._dtype import _kind_name
|
||||
|
||||
|
||||
sctypeDict = {} # Contains all leaf-node scalar types with aliases
|
||||
class TypeNADict(dict):
|
||||
def __getitem__(self, key):
|
||||
# 2018-06-24, 1.16
|
||||
warnings.warn('sctypeNA and typeNA will be removed in v1.18 '
|
||||
'of numpy', VisibleDeprecationWarning, stacklevel=2)
|
||||
return dict.__getitem__(self, key)
|
||||
def get(self, key, default=None):
|
||||
# 2018-06-24, 1.16
|
||||
warnings.warn('sctypeNA and typeNA will be removed in v1.18 '
|
||||
'of numpy', VisibleDeprecationWarning, stacklevel=2)
|
||||
return dict.get(self, key, default)
|
||||
|
||||
sctypeNA = TypeNADict() # Contails all leaf-node types -> numarray type equivalences
|
||||
allTypes = {} # Collect the types we will add to the module
|
||||
|
||||
|
||||
# separate the actual type info from the abstract base classes
|
||||
_abstract_types = {}
|
||||
_concrete_typeinfo = {}
|
||||
for k, v in typeinfo.items():
|
||||
# make all the keys lowercase too
|
||||
k = english_lower(k)
|
||||
if isinstance(v, type):
|
||||
_abstract_types[k] = v
|
||||
else:
|
||||
_concrete_typeinfo[k] = v
|
||||
|
||||
_concrete_types = {v.type for k, v in _concrete_typeinfo.items()}
|
||||
|
||||
|
||||
def _bits_of(obj):
|
||||
try:
|
||||
info = next(v for v in _concrete_typeinfo.values() if v.type is obj)
|
||||
except StopIteration:
|
||||
if obj in _abstract_types.values():
|
||||
raise ValueError("Cannot count the bits of an abstract type")
|
||||
|
||||
# some third-party type - make a best-guess
|
||||
return dtype(obj).itemsize * 8
|
||||
else:
|
||||
return info.bits
|
||||
|
||||
|
||||
def bitname(obj):
|
||||
"""Return a bit-width name for a given type object"""
|
||||
bits = _bits_of(obj)
|
||||
dt = dtype(obj)
|
||||
char = dt.kind
|
||||
base = _kind_name(dt)
|
||||
|
||||
if base == 'object':
|
||||
bits = 0
|
||||
|
||||
if bits != 0:
|
||||
char = "%s%d" % (char, bits // 8)
|
||||
|
||||
return base, bits, char
|
||||
|
||||
|
||||
def _add_types():
|
||||
for name, info in _concrete_typeinfo.items():
|
||||
# define C-name and insert typenum and typechar references also
|
||||
allTypes[name] = info.type
|
||||
sctypeDict[name] = info.type
|
||||
sctypeDict[info.char] = info.type
|
||||
sctypeDict[info.num] = info.type
|
||||
|
||||
for name, cls in _abstract_types.items():
|
||||
allTypes[name] = cls
|
||||
_add_types()
|
||||
|
||||
# This is the priority order used to assign the bit-sized NPY_INTxx names, which
|
||||
# must match the order in npy_common.h in order for NPY_INTxx and np.intxx to be
|
||||
# consistent.
|
||||
# If two C types have the same size, then the earliest one in this list is used
|
||||
# as the sized name.
|
||||
_int_ctypes = ['long', 'longlong', 'int', 'short', 'byte']
|
||||
_uint_ctypes = list('u' + t for t in _int_ctypes)
|
||||
|
||||
def _add_aliases():
|
||||
for name, info in _concrete_typeinfo.items():
|
||||
# these are handled by _add_integer_aliases
|
||||
if name in _int_ctypes or name in _uint_ctypes:
|
||||
continue
|
||||
|
||||
# insert bit-width version for this class (if relevant)
|
||||
base, bit, char = bitname(info.type)
|
||||
|
||||
myname = "%s%d" % (base, bit)
|
||||
|
||||
# ensure that (c)longdouble does not overwrite the aliases assigned to
|
||||
# (c)double
|
||||
if name in ('longdouble', 'clongdouble') and myname in allTypes:
|
||||
continue
|
||||
|
||||
base_capitalize = english_capitalize(base)
|
||||
if base == 'complex':
|
||||
na_name = '%s%d' % (base_capitalize, bit//2)
|
||||
elif base == 'bool':
|
||||
na_name = base_capitalize
|
||||
else:
|
||||
na_name = "%s%d" % (base_capitalize, bit)
|
||||
|
||||
allTypes[myname] = info.type
|
||||
|
||||
# add mapping for both the bit name and the numarray name
|
||||
sctypeDict[myname] = info.type
|
||||
sctypeDict[na_name] = info.type
|
||||
|
||||
# add forward, reverse, and string mapping to numarray
|
||||
sctypeNA[na_name] = info.type
|
||||
sctypeNA[info.type] = na_name
|
||||
sctypeNA[info.char] = na_name
|
||||
|
||||
sctypeDict[char] = info.type
|
||||
sctypeNA[char] = na_name
|
||||
_add_aliases()
|
||||
|
||||
def _add_integer_aliases():
|
||||
seen_bits = set()
|
||||
for i_ctype, u_ctype in zip(_int_ctypes, _uint_ctypes):
|
||||
i_info = _concrete_typeinfo[i_ctype]
|
||||
u_info = _concrete_typeinfo[u_ctype]
|
||||
bits = i_info.bits # same for both
|
||||
|
||||
for info, charname, intname, Intname in [
|
||||
(i_info,'i%d' % (bits//8,), 'int%d' % bits, 'Int%d' % bits),
|
||||
(u_info,'u%d' % (bits//8,), 'uint%d' % bits, 'UInt%d' % bits)]:
|
||||
if bits not in seen_bits:
|
||||
# sometimes two different types have the same number of bits
|
||||
# if so, the one iterated over first takes precedence
|
||||
allTypes[intname] = info.type
|
||||
sctypeDict[intname] = info.type
|
||||
sctypeDict[Intname] = info.type
|
||||
sctypeDict[charname] = info.type
|
||||
sctypeNA[Intname] = info.type
|
||||
sctypeNA[charname] = info.type
|
||||
sctypeNA[info.type] = Intname
|
||||
sctypeNA[info.char] = Intname
|
||||
|
||||
seen_bits.add(bits)
|
||||
|
||||
_add_integer_aliases()
|
||||
|
||||
# We use these later
|
||||
void = allTypes['void']
|
||||
|
||||
#
|
||||
# Rework the Python names (so that float and complex and int are consistent
|
||||
# with Python usage)
|
||||
#
|
||||
def _set_up_aliases():
|
||||
type_pairs = [('complex_', 'cdouble'),
|
||||
('int0', 'intp'),
|
||||
('uint0', 'uintp'),
|
||||
('single', 'float'),
|
||||
('csingle', 'cfloat'),
|
||||
('singlecomplex', 'cfloat'),
|
||||
('float_', 'double'),
|
||||
('intc', 'int'),
|
||||
('uintc', 'uint'),
|
||||
('int_', 'long'),
|
||||
('uint', 'ulong'),
|
||||
('cfloat', 'cdouble'),
|
||||
('longfloat', 'longdouble'),
|
||||
('clongfloat', 'clongdouble'),
|
||||
('longcomplex', 'clongdouble'),
|
||||
('bool_', 'bool'),
|
||||
('bytes_', 'string'),
|
||||
('string_', 'string'),
|
||||
('unicode_', 'unicode'),
|
||||
('object_', 'object')]
|
||||
if sys.version_info[0] >= 3:
|
||||
type_pairs.extend([('str_', 'unicode')])
|
||||
else:
|
||||
type_pairs.extend([('str_', 'string')])
|
||||
for alias, t in type_pairs:
|
||||
allTypes[alias] = allTypes[t]
|
||||
sctypeDict[alias] = sctypeDict[t]
|
||||
# Remove aliases overriding python types and modules
|
||||
to_remove = ['ulong', 'object', 'int', 'float',
|
||||
'complex', 'bool', 'string', 'datetime', 'timedelta']
|
||||
if sys.version_info[0] >= 3:
|
||||
to_remove.extend(['bytes', 'str'])
|
||||
else:
|
||||
to_remove.extend(['unicode', 'long'])
|
||||
|
||||
for t in to_remove:
|
||||
try:
|
||||
del allTypes[t]
|
||||
del sctypeDict[t]
|
||||
except KeyError:
|
||||
pass
|
||||
_set_up_aliases()
|
||||
|
||||
|
||||
sctypes = {'int': [],
|
||||
'uint':[],
|
||||
'float':[],
|
||||
'complex':[],
|
||||
'others':[bool, object, bytes, unicode, void]}
|
||||
|
||||
def _add_array_type(typename, bits):
|
||||
try:
|
||||
t = allTypes['%s%d' % (typename, bits)]
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
sctypes[typename].append(t)
|
||||
|
||||
def _set_array_types():
|
||||
ibytes = [1, 2, 4, 8, 16, 32, 64]
|
||||
fbytes = [2, 4, 8, 10, 12, 16, 32, 64]
|
||||
for bytes in ibytes:
|
||||
bits = 8*bytes
|
||||
_add_array_type('int', bits)
|
||||
_add_array_type('uint', bits)
|
||||
for bytes in fbytes:
|
||||
bits = 8*bytes
|
||||
_add_array_type('float', bits)
|
||||
_add_array_type('complex', 2*bits)
|
||||
_gi = dtype('p')
|
||||
if _gi.type not in sctypes['int']:
|
||||
indx = 0
|
||||
sz = _gi.itemsize
|
||||
_lst = sctypes['int']
|
||||
while (indx < len(_lst) and sz >= _lst[indx](0).itemsize):
|
||||
indx += 1
|
||||
sctypes['int'].insert(indx, _gi.type)
|
||||
sctypes['uint'].insert(indx, dtype('P').type)
|
||||
_set_array_types()
|
||||
|
||||
|
||||
# Add additional strings to the sctypeDict
|
||||
_toadd = ['int', 'float', 'complex', 'bool', 'object']
|
||||
if sys.version_info[0] >= 3:
|
||||
_toadd.extend(['str', 'bytes', ('a', 'bytes_')])
|
||||
else:
|
||||
_toadd.extend(['string', ('str', 'string_'), 'unicode', ('a', 'string_')])
|
||||
|
||||
for name in _toadd:
|
||||
if isinstance(name, tuple):
|
||||
sctypeDict[name[0]] = allTypes[name[1]]
|
||||
else:
|
||||
sctypeDict[name] = allTypes['%s_' % name]
|
||||
|
||||
del _toadd, name
|
@ -0,0 +1,458 @@
|
||||
"""
|
||||
Functions for changing global ufunc configuration
|
||||
|
||||
This provides helpers which wrap `umath.geterrobj` and `umath.seterrobj`
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
try:
|
||||
# Accessing collections abstract classes from collections
|
||||
# has been deprecated since Python 3.3
|
||||
import collections.abc as collections_abc
|
||||
except ImportError:
|
||||
import collections as collections_abc
|
||||
import contextlib
|
||||
|
||||
from .overrides import set_module
|
||||
from .umath import (
|
||||
UFUNC_BUFSIZE_DEFAULT,
|
||||
ERR_IGNORE, ERR_WARN, ERR_RAISE, ERR_CALL, ERR_PRINT, ERR_LOG, ERR_DEFAULT,
|
||||
SHIFT_DIVIDEBYZERO, SHIFT_OVERFLOW, SHIFT_UNDERFLOW, SHIFT_INVALID,
|
||||
)
|
||||
from . import umath
|
||||
|
||||
__all__ = [
|
||||
"seterr", "geterr", "setbufsize", "getbufsize", "seterrcall", "geterrcall",
|
||||
"errstate",
|
||||
]
|
||||
|
||||
_errdict = {"ignore": ERR_IGNORE,
|
||||
"warn": ERR_WARN,
|
||||
"raise": ERR_RAISE,
|
||||
"call": ERR_CALL,
|
||||
"print": ERR_PRINT,
|
||||
"log": ERR_LOG}
|
||||
|
||||
_errdict_rev = {value: key for key, value in _errdict.items()}
|
||||
|
||||
|
||||
@set_module('numpy')
|
||||
def seterr(all=None, divide=None, over=None, under=None, invalid=None):
|
||||
"""
|
||||
Set how floating-point errors are handled.
|
||||
|
||||
Note that operations on integer scalar types (such as `int16`) are
|
||||
handled like floating point, and are affected by these settings.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
all : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional
|
||||
Set treatment for all types of floating-point errors at once:
|
||||
|
||||
- ignore: Take no action when the exception occurs.
|
||||
- warn: Print a `RuntimeWarning` (via the Python `warnings` module).
|
||||
- raise: Raise a `FloatingPointError`.
|
||||
- call: Call a function specified using the `seterrcall` function.
|
||||
- print: Print a warning directly to ``stdout``.
|
||||
- log: Record error in a Log object specified by `seterrcall`.
|
||||
|
||||
The default is not to change the current behavior.
|
||||
divide : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional
|
||||
Treatment for division by zero.
|
||||
over : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional
|
||||
Treatment for floating-point overflow.
|
||||
under : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional
|
||||
Treatment for floating-point underflow.
|
||||
invalid : {'ignore', 'warn', 'raise', 'call', 'print', 'log'}, optional
|
||||
Treatment for invalid floating-point operation.
|
||||
|
||||
Returns
|
||||
-------
|
||||
old_settings : dict
|
||||
Dictionary containing the old settings.
|
||||
|
||||
See also
|
||||
--------
|
||||
seterrcall : Set a callback function for the 'call' mode.
|
||||
geterr, geterrcall, errstate
|
||||
|
||||
Notes
|
||||
-----
|
||||
The floating-point exceptions are defined in the IEEE 754 standard [1]_:
|
||||
|
||||
- Division by zero: infinite result obtained from finite numbers.
|
||||
- Overflow: result too large to be expressed.
|
||||
- Underflow: result so close to zero that some precision
|
||||
was lost.
|
||||
- Invalid operation: result is not an expressible number, typically
|
||||
indicates that a NaN was produced.
|
||||
|
||||
.. [1] https://en.wikipedia.org/wiki/IEEE_754
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> old_settings = np.seterr(all='ignore') #seterr to known value
|
||||
>>> np.seterr(over='raise')
|
||||
{'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'}
|
||||
>>> np.seterr(**old_settings) # reset to default
|
||||
{'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'}
|
||||
|
||||
>>> np.int16(32000) * np.int16(3)
|
||||
30464
|
||||
>>> old_settings = np.seterr(all='warn', over='raise')
|
||||
>>> np.int16(32000) * np.int16(3)
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 1, in <module>
|
||||
FloatingPointError: overflow encountered in short_scalars
|
||||
|
||||
>>> from collections import OrderedDict
|
||||
>>> old_settings = np.seterr(all='print')
|
||||
>>> OrderedDict(np.geterr())
|
||||
OrderedDict([('divide', 'print'), ('over', 'print'), ('under', 'print'), ('invalid', 'print')])
|
||||
>>> np.int16(32000) * np.int16(3)
|
||||
30464
|
||||
|
||||
"""
|
||||
|
||||
pyvals = umath.geterrobj()
|
||||
old = geterr()
|
||||
|
||||
if divide is None:
|
||||
divide = all or old['divide']
|
||||
if over is None:
|
||||
over = all or old['over']
|
||||
if under is None:
|
||||
under = all or old['under']
|
||||
if invalid is None:
|
||||
invalid = all or old['invalid']
|
||||
|
||||
maskvalue = ((_errdict[divide] << SHIFT_DIVIDEBYZERO) +
|
||||
(_errdict[over] << SHIFT_OVERFLOW) +
|
||||
(_errdict[under] << SHIFT_UNDERFLOW) +
|
||||
(_errdict[invalid] << SHIFT_INVALID))
|
||||
|
||||
pyvals[1] = maskvalue
|
||||
umath.seterrobj(pyvals)
|
||||
return old
|
||||
|
||||
|
||||
@set_module('numpy')
|
||||
def geterr():
|
||||
"""
|
||||
Get the current way of handling floating-point errors.
|
||||
|
||||
Returns
|
||||
-------
|
||||
res : dict
|
||||
A dictionary with keys "divide", "over", "under", and "invalid",
|
||||
whose values are from the strings "ignore", "print", "log", "warn",
|
||||
"raise", and "call". The keys represent possible floating-point
|
||||
exceptions, and the values define how these exceptions are handled.
|
||||
|
||||
See Also
|
||||
--------
|
||||
geterrcall, seterr, seterrcall
|
||||
|
||||
Notes
|
||||
-----
|
||||
For complete documentation of the types of floating-point exceptions and
|
||||
treatment options, see `seterr`.
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> from collections import OrderedDict
|
||||
>>> sorted(np.geterr().items())
|
||||
[('divide', 'warn'), ('invalid', 'warn'), ('over', 'warn'), ('under', 'ignore')]
|
||||
>>> np.arange(3.) / np.arange(3.)
|
||||
array([nan, 1., 1.])
|
||||
|
||||
>>> oldsettings = np.seterr(all='warn', over='raise')
|
||||
>>> OrderedDict(sorted(np.geterr().items()))
|
||||
OrderedDict([('divide', 'warn'), ('invalid', 'warn'), ('over', 'raise'), ('under', 'warn')])
|
||||
>>> np.arange(3.) / np.arange(3.)
|
||||
array([nan, 1., 1.])
|
||||
|
||||
"""
|
||||
maskvalue = umath.geterrobj()[1]
|
||||
mask = 7
|
||||
res = {}
|
||||
val = (maskvalue >> SHIFT_DIVIDEBYZERO) & mask
|
||||
res['divide'] = _errdict_rev[val]
|
||||
val = (maskvalue >> SHIFT_OVERFLOW) & mask
|
||||
res['over'] = _errdict_rev[val]
|
||||
val = (maskvalue >> SHIFT_UNDERFLOW) & mask
|
||||
res['under'] = _errdict_rev[val]
|
||||
val = (maskvalue >> SHIFT_INVALID) & mask
|
||||
res['invalid'] = _errdict_rev[val]
|
||||
return res
|
||||
|
||||
|
||||
@set_module('numpy')
|
||||
def setbufsize(size):
|
||||
"""
|
||||
Set the size of the buffer used in ufuncs.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
size : int
|
||||
Size of buffer.
|
||||
|
||||
"""
|
||||
if size > 10e6:
|
||||
raise ValueError("Buffer size, %s, is too big." % size)
|
||||
if size < 5:
|
||||
raise ValueError("Buffer size, %s, is too small." % size)
|
||||
if size % 16 != 0:
|
||||
raise ValueError("Buffer size, %s, is not a multiple of 16." % size)
|
||||
|
||||
pyvals = umath.geterrobj()
|
||||
old = getbufsize()
|
||||
pyvals[0] = size
|
||||
umath.seterrobj(pyvals)
|
||||
return old
|
||||
|
||||
|
||||
@set_module('numpy')
|
||||
def getbufsize():
|
||||
"""
|
||||
Return the size of the buffer used in ufuncs.
|
||||
|
||||
Returns
|
||||
-------
|
||||
getbufsize : int
|
||||
Size of ufunc buffer in bytes.
|
||||
|
||||
"""
|
||||
return umath.geterrobj()[0]
|
||||
|
||||
|
||||
@set_module('numpy')
|
||||
def seterrcall(func):
|
||||
"""
|
||||
Set the floating-point error callback function or log object.
|
||||
|
||||
There are two ways to capture floating-point error messages. The first
|
||||
is to set the error-handler to 'call', using `seterr`. Then, set
|
||||
the function to call using this function.
|
||||
|
||||
The second is to set the error-handler to 'log', using `seterr`.
|
||||
Floating-point errors then trigger a call to the 'write' method of
|
||||
the provided object.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
func : callable f(err, flag) or object with write method
|
||||
Function to call upon floating-point errors ('call'-mode) or
|
||||
object whose 'write' method is used to log such message ('log'-mode).
|
||||
|
||||
The call function takes two arguments. The first is a string describing
|
||||
the type of error (such as "divide by zero", "overflow", "underflow",
|
||||
or "invalid value"), and the second is the status flag. The flag is a
|
||||
byte, whose four least-significant bits indicate the type of error, one
|
||||
of "divide", "over", "under", "invalid"::
|
||||
|
||||
[0 0 0 0 divide over under invalid]
|
||||
|
||||
In other words, ``flags = divide + 2*over + 4*under + 8*invalid``.
|
||||
|
||||
If an object is provided, its write method should take one argument,
|
||||
a string.
|
||||
|
||||
Returns
|
||||
-------
|
||||
h : callable, log instance or None
|
||||
The old error handler.
|
||||
|
||||
See Also
|
||||
--------
|
||||
seterr, geterr, geterrcall
|
||||
|
||||
Examples
|
||||
--------
|
||||
Callback upon error:
|
||||
|
||||
>>> def err_handler(type, flag):
|
||||
... print("Floating point error (%s), with flag %s" % (type, flag))
|
||||
...
|
||||
|
||||
>>> saved_handler = np.seterrcall(err_handler)
|
||||
>>> save_err = np.seterr(all='call')
|
||||
>>> from collections import OrderedDict
|
||||
|
||||
>>> np.array([1, 2, 3]) / 0.0
|
||||
Floating point error (divide by zero), with flag 1
|
||||
array([inf, inf, inf])
|
||||
|
||||
>>> np.seterrcall(saved_handler)
|
||||
<function err_handler at 0x...>
|
||||
>>> OrderedDict(sorted(np.seterr(**save_err).items()))
|
||||
OrderedDict([('divide', 'call'), ('invalid', 'call'), ('over', 'call'), ('under', 'call')])
|
||||
|
||||
Log error message:
|
||||
|
||||
>>> class Log(object):
|
||||
... def write(self, msg):
|
||||
... print("LOG: %s" % msg)
|
||||
...
|
||||
|
||||
>>> log = Log()
|
||||
>>> saved_handler = np.seterrcall(log)
|
||||
>>> save_err = np.seterr(all='log')
|
||||
|
||||
>>> np.array([1, 2, 3]) / 0.0
|
||||
LOG: Warning: divide by zero encountered in true_divide
|
||||
array([inf, inf, inf])
|
||||
|
||||
>>> np.seterrcall(saved_handler)
|
||||
<numpy.core.numeric.Log object at 0x...>
|
||||
>>> OrderedDict(sorted(np.seterr(**save_err).items()))
|
||||
OrderedDict([('divide', 'log'), ('invalid', 'log'), ('over', 'log'), ('under', 'log')])
|
||||
|
||||
"""
|
||||
if func is not None and not isinstance(func, collections_abc.Callable):
|
||||
if not hasattr(func, 'write') or not isinstance(func.write, collections_abc.Callable):
|
||||
raise ValueError("Only callable can be used as callback")
|
||||
pyvals = umath.geterrobj()
|
||||
old = geterrcall()
|
||||
pyvals[2] = func
|
||||
umath.seterrobj(pyvals)
|
||||
return old
|
||||
|
||||
|
||||
@set_module('numpy')
|
||||
def geterrcall():
|
||||
"""
|
||||
Return the current callback function used on floating-point errors.
|
||||
|
||||
When the error handling for a floating-point error (one of "divide",
|
||||
"over", "under", or "invalid") is set to 'call' or 'log', the function
|
||||
that is called or the log instance that is written to is returned by
|
||||
`geterrcall`. This function or log instance has been set with
|
||||
`seterrcall`.
|
||||
|
||||
Returns
|
||||
-------
|
||||
errobj : callable, log instance or None
|
||||
The current error handler. If no handler was set through `seterrcall`,
|
||||
``None`` is returned.
|
||||
|
||||
See Also
|
||||
--------
|
||||
seterrcall, seterr, geterr
|
||||
|
||||
Notes
|
||||
-----
|
||||
For complete documentation of the types of floating-point exceptions and
|
||||
treatment options, see `seterr`.
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> np.geterrcall() # we did not yet set a handler, returns None
|
||||
|
||||
>>> oldsettings = np.seterr(all='call')
|
||||
>>> def err_handler(type, flag):
|
||||
... print("Floating point error (%s), with flag %s" % (type, flag))
|
||||
>>> oldhandler = np.seterrcall(err_handler)
|
||||
>>> np.array([1, 2, 3]) / 0.0
|
||||
Floating point error (divide by zero), with flag 1
|
||||
array([inf, inf, inf])
|
||||
|
||||
>>> cur_handler = np.geterrcall()
|
||||
>>> cur_handler is err_handler
|
||||
True
|
||||
|
||||
"""
|
||||
return umath.geterrobj()[2]
|
||||
|
||||
|
||||
class _unspecified(object):
|
||||
pass
|
||||
|
||||
|
||||
_Unspecified = _unspecified()
|
||||
|
||||
|
||||
@set_module('numpy')
|
||||
class errstate(contextlib.ContextDecorator):
|
||||
"""
|
||||
errstate(**kwargs)
|
||||
|
||||
Context manager for floating-point error handling.
|
||||
|
||||
Using an instance of `errstate` as a context manager allows statements in
|
||||
that context to execute with a known error handling behavior. Upon entering
|
||||
the context the error handling is set with `seterr` and `seterrcall`, and
|
||||
upon exiting it is reset to what it was before.
|
||||
|
||||
.. versionchanged:: 1.17.0
|
||||
`errstate` is also usable as a function decorator, saving
|
||||
a level of indentation if an entire function is wrapped.
|
||||
See :py:class:`contextlib.ContextDecorator` for more information.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
kwargs : {divide, over, under, invalid}
|
||||
Keyword arguments. The valid keywords are the possible floating-point
|
||||
exceptions. Each keyword should have a string value that defines the
|
||||
treatment for the particular error. Possible values are
|
||||
{'ignore', 'warn', 'raise', 'call', 'print', 'log'}.
|
||||
|
||||
See Also
|
||||
--------
|
||||
seterr, geterr, seterrcall, geterrcall
|
||||
|
||||
Notes
|
||||
-----
|
||||
For complete documentation of the types of floating-point exceptions and
|
||||
treatment options, see `seterr`.
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> from collections import OrderedDict
|
||||
>>> olderr = np.seterr(all='ignore') # Set error handling to known state.
|
||||
|
||||
>>> np.arange(3) / 0.
|
||||
array([nan, inf, inf])
|
||||
>>> with np.errstate(divide='warn'):
|
||||
... np.arange(3) / 0.
|
||||
array([nan, inf, inf])
|
||||
|
||||
>>> np.sqrt(-1)
|
||||
nan
|
||||
>>> with np.errstate(invalid='raise'):
|
||||
... np.sqrt(-1)
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 2, in <module>
|
||||
FloatingPointError: invalid value encountered in sqrt
|
||||
|
||||
Outside the context the error handling behavior has not changed:
|
||||
|
||||
>>> OrderedDict(sorted(np.geterr().items()))
|
||||
OrderedDict([('divide', 'ignore'), ('invalid', 'ignore'), ('over', 'ignore'), ('under', 'ignore')])
|
||||
|
||||
"""
|
||||
# Note that we don't want to run the above doctests because they will fail
|
||||
# without a from __future__ import with_statement
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.call = kwargs.pop('call', _Unspecified)
|
||||
self.kwargs = kwargs
|
||||
|
||||
def __enter__(self):
|
||||
self.oldstate = seterr(**self.kwargs)
|
||||
if self.call is not _Unspecified:
|
||||
self.oldcall = seterrcall(self.call)
|
||||
|
||||
def __exit__(self, *exc_info):
|
||||
seterr(**self.oldstate)
|
||||
if self.call is not _Unspecified:
|
||||
seterrcall(self.oldcall)
|
||||
|
||||
|
||||
def _setdef():
|
||||
defval = [UFUNC_BUFSIZE_DEFAULT, ERR_DEFAULT, None]
|
||||
umath.seterrobj(defval)
|
||||
|
||||
|
||||
# set the default values
|
||||
_setdef()
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,15 @@
|
||||
"""Simple script to compute the api hash of the current API.
|
||||
|
||||
The API has is defined by numpy_api_order and ufunc_api_order.
|
||||
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
from os.path import dirname
|
||||
|
||||
from code_generators.genapi import fullapi_hash
|
||||
from code_generators.numpy_api import full_api
|
||||
|
||||
if __name__ == '__main__':
|
||||
curdir = dirname(__file__)
|
||||
print(fullapi_hash(full_api))
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,470 @@
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
import functools
|
||||
import warnings
|
||||
import operator
|
||||
|
||||
from . import numeric as _nx
|
||||
from .numeric import (result_type, NaN, shares_memory, MAY_SHARE_BOUNDS,
|
||||
TooHardError, asanyarray, ndim)
|
||||
from numpy.core.multiarray import add_docstring
|
||||
from numpy.core import overrides
|
||||
|
||||
__all__ = ['logspace', 'linspace', 'geomspace']
|
||||
|
||||
|
||||
array_function_dispatch = functools.partial(
|
||||
overrides.array_function_dispatch, module='numpy')
|
||||
|
||||
|
||||
def _index_deprecate(i, stacklevel=2):
|
||||
try:
|
||||
i = operator.index(i)
|
||||
except TypeError:
|
||||
msg = ("object of type {} cannot be safely interpreted as "
|
||||
"an integer.".format(type(i)))
|
||||
i = int(i)
|
||||
stacklevel += 1
|
||||
warnings.warn(msg, DeprecationWarning, stacklevel=stacklevel)
|
||||
return i
|
||||
|
||||
|
||||
def _linspace_dispatcher(start, stop, num=None, endpoint=None, retstep=None,
|
||||
dtype=None, axis=None):
|
||||
return (start, stop)
|
||||
|
||||
|
||||
@array_function_dispatch(_linspace_dispatcher)
|
||||
def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None,
|
||||
axis=0):
|
||||
"""
|
||||
Return evenly spaced numbers over a specified interval.
|
||||
|
||||
Returns `num` evenly spaced samples, calculated over the
|
||||
interval [`start`, `stop`].
|
||||
|
||||
The endpoint of the interval can optionally be excluded.
|
||||
|
||||
.. versionchanged:: 1.16.0
|
||||
Non-scalar `start` and `stop` are now supported.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
start : array_like
|
||||
The starting value of the sequence.
|
||||
stop : array_like
|
||||
The end value of the sequence, unless `endpoint` is set to False.
|
||||
In that case, the sequence consists of all but the last of ``num + 1``
|
||||
evenly spaced samples, so that `stop` is excluded. Note that the step
|
||||
size changes when `endpoint` is False.
|
||||
num : int, optional
|
||||
Number of samples to generate. Default is 50. Must be non-negative.
|
||||
endpoint : bool, optional
|
||||
If True, `stop` is the last sample. Otherwise, it is not included.
|
||||
Default is True.
|
||||
retstep : bool, optional
|
||||
If True, return (`samples`, `step`), where `step` is the spacing
|
||||
between samples.
|
||||
dtype : dtype, optional
|
||||
The type of the output array. If `dtype` is not given, infer the data
|
||||
type from the other input arguments.
|
||||
|
||||
.. versionadded:: 1.9.0
|
||||
|
||||
axis : int, optional
|
||||
The axis in the result to store the samples. Relevant only if start
|
||||
or stop are array-like. By default (0), the samples will be along a
|
||||
new axis inserted at the beginning. Use -1 to get an axis at the end.
|
||||
|
||||
.. versionadded:: 1.16.0
|
||||
|
||||
Returns
|
||||
-------
|
||||
samples : ndarray
|
||||
There are `num` equally spaced samples in the closed interval
|
||||
``[start, stop]`` or the half-open interval ``[start, stop)``
|
||||
(depending on whether `endpoint` is True or False).
|
||||
step : float, optional
|
||||
Only returned if `retstep` is True
|
||||
|
||||
Size of spacing between samples.
|
||||
|
||||
|
||||
See Also
|
||||
--------
|
||||
arange : Similar to `linspace`, but uses a step size (instead of the
|
||||
number of samples).
|
||||
geomspace : Similar to `linspace`, but with numbers spaced evenly on a log
|
||||
scale (a geometric progression).
|
||||
logspace : Similar to `geomspace`, but with the end points specified as
|
||||
logarithms.
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> np.linspace(2.0, 3.0, num=5)
|
||||
array([2. , 2.25, 2.5 , 2.75, 3. ])
|
||||
>>> np.linspace(2.0, 3.0, num=5, endpoint=False)
|
||||
array([2. , 2.2, 2.4, 2.6, 2.8])
|
||||
>>> np.linspace(2.0, 3.0, num=5, retstep=True)
|
||||
(array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25)
|
||||
|
||||
Graphical illustration:
|
||||
|
||||
>>> import matplotlib.pyplot as plt
|
||||
>>> N = 8
|
||||
>>> y = np.zeros(N)
|
||||
>>> x1 = np.linspace(0, 10, N, endpoint=True)
|
||||
>>> x2 = np.linspace(0, 10, N, endpoint=False)
|
||||
>>> plt.plot(x1, y, 'o')
|
||||
[<matplotlib.lines.Line2D object at 0x...>]
|
||||
>>> plt.plot(x2, y + 0.5, 'o')
|
||||
[<matplotlib.lines.Line2D object at 0x...>]
|
||||
>>> plt.ylim([-0.5, 1])
|
||||
(-0.5, 1)
|
||||
>>> plt.show()
|
||||
|
||||
"""
|
||||
# 2016-02-25, 1.12
|
||||
num = _index_deprecate(num)
|
||||
if num < 0:
|
||||
raise ValueError("Number of samples, %s, must be non-negative." % num)
|
||||
div = (num - 1) if endpoint else num
|
||||
|
||||
# Convert float/complex array scalars to float, gh-3504
|
||||
# and make sure one can use variables that have an __array_interface__, gh-6634
|
||||
start = asanyarray(start) * 1.0
|
||||
stop = asanyarray(stop) * 1.0
|
||||
|
||||
dt = result_type(start, stop, float(num))
|
||||
if dtype is None:
|
||||
dtype = dt
|
||||
|
||||
delta = stop - start
|
||||
y = _nx.arange(0, num, dtype=dt).reshape((-1,) + (1,) * ndim(delta))
|
||||
# In-place multiplication y *= delta/div is faster, but prevents the multiplicant
|
||||
# from overriding what class is produced, and thus prevents, e.g. use of Quantities,
|
||||
# see gh-7142. Hence, we multiply in place only for standard scalar types.
|
||||
_mult_inplace = _nx.isscalar(delta)
|
||||
if num > 1:
|
||||
step = delta / div
|
||||
if _nx.any(step == 0):
|
||||
# Special handling for denormal numbers, gh-5437
|
||||
y /= div
|
||||
if _mult_inplace:
|
||||
y *= delta
|
||||
else:
|
||||
y = y * delta
|
||||
else:
|
||||
if _mult_inplace:
|
||||
y *= step
|
||||
else:
|
||||
y = y * step
|
||||
else:
|
||||
# 0 and 1 item long sequences have an undefined step
|
||||
step = NaN
|
||||
# Multiply with delta to allow possible override of output class.
|
||||
y = y * delta
|
||||
|
||||
y += start
|
||||
|
||||
if endpoint and num > 1:
|
||||
y[-1] = stop
|
||||
|
||||
if axis != 0:
|
||||
y = _nx.moveaxis(y, 0, axis)
|
||||
|
||||
if retstep:
|
||||
return y.astype(dtype, copy=False), step
|
||||
else:
|
||||
return y.astype(dtype, copy=False)
|
||||
|
||||
|
||||
def _logspace_dispatcher(start, stop, num=None, endpoint=None, base=None,
|
||||
dtype=None, axis=None):
|
||||
return (start, stop)
|
||||
|
||||
|
||||
@array_function_dispatch(_logspace_dispatcher)
|
||||
def logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None,
|
||||
axis=0):
|
||||
"""
|
||||
Return numbers spaced evenly on a log scale.
|
||||
|
||||
In linear space, the sequence starts at ``base ** start``
|
||||
(`base` to the power of `start`) and ends with ``base ** stop``
|
||||
(see `endpoint` below).
|
||||
|
||||
.. versionchanged:: 1.16.0
|
||||
Non-scalar `start` and `stop` are now supported.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
start : array_like
|
||||
``base ** start`` is the starting value of the sequence.
|
||||
stop : array_like
|
||||
``base ** stop`` is the final value of the sequence, unless `endpoint`
|
||||
is False. In that case, ``num + 1`` values are spaced over the
|
||||
interval in log-space, of which all but the last (a sequence of
|
||||
length `num`) are returned.
|
||||
num : integer, optional
|
||||
Number of samples to generate. Default is 50.
|
||||
endpoint : boolean, optional
|
||||
If true, `stop` is the last sample. Otherwise, it is not included.
|
||||
Default is True.
|
||||
base : float, optional
|
||||
The base of the log space. The step size between the elements in
|
||||
``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform.
|
||||
Default is 10.0.
|
||||
dtype : dtype
|
||||
The type of the output array. If `dtype` is not given, infer the data
|
||||
type from the other input arguments.
|
||||
axis : int, optional
|
||||
The axis in the result to store the samples. Relevant only if start
|
||||
or stop are array-like. By default (0), the samples will be along a
|
||||
new axis inserted at the beginning. Use -1 to get an axis at the end.
|
||||
|
||||
.. versionadded:: 1.16.0
|
||||
|
||||
|
||||
Returns
|
||||
-------
|
||||
samples : ndarray
|
||||
`num` samples, equally spaced on a log scale.
|
||||
|
||||
See Also
|
||||
--------
|
||||
arange : Similar to linspace, with the step size specified instead of the
|
||||
number of samples. Note that, when used with a float endpoint, the
|
||||
endpoint may or may not be included.
|
||||
linspace : Similar to logspace, but with the samples uniformly distributed
|
||||
in linear space, instead of log space.
|
||||
geomspace : Similar to logspace, but with endpoints specified directly.
|
||||
|
||||
Notes
|
||||
-----
|
||||
Logspace is equivalent to the code
|
||||
|
||||
>>> y = np.linspace(start, stop, num=num, endpoint=endpoint)
|
||||
... # doctest: +SKIP
|
||||
>>> power(base, y).astype(dtype)
|
||||
... # doctest: +SKIP
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> np.logspace(2.0, 3.0, num=4)
|
||||
array([ 100. , 215.443469 , 464.15888336, 1000. ])
|
||||
>>> np.logspace(2.0, 3.0, num=4, endpoint=False)
|
||||
array([100. , 177.827941 , 316.22776602, 562.34132519])
|
||||
>>> np.logspace(2.0, 3.0, num=4, base=2.0)
|
||||
array([4. , 5.0396842 , 6.34960421, 8. ])
|
||||
|
||||
Graphical illustration:
|
||||
|
||||
>>> import matplotlib.pyplot as plt
|
||||
>>> N = 10
|
||||
>>> x1 = np.logspace(0.1, 1, N, endpoint=True)
|
||||
>>> x2 = np.logspace(0.1, 1, N, endpoint=False)
|
||||
>>> y = np.zeros(N)
|
||||
>>> plt.plot(x1, y, 'o')
|
||||
[<matplotlib.lines.Line2D object at 0x...>]
|
||||
>>> plt.plot(x2, y + 0.5, 'o')
|
||||
[<matplotlib.lines.Line2D object at 0x...>]
|
||||
>>> plt.ylim([-0.5, 1])
|
||||
(-0.5, 1)
|
||||
>>> plt.show()
|
||||
|
||||
"""
|
||||
y = linspace(start, stop, num=num, endpoint=endpoint, axis=axis)
|
||||
if dtype is None:
|
||||
return _nx.power(base, y)
|
||||
return _nx.power(base, y).astype(dtype, copy=False)
|
||||
|
||||
|
||||
def _geomspace_dispatcher(start, stop, num=None, endpoint=None, dtype=None,
|
||||
axis=None):
|
||||
return (start, stop)
|
||||
|
||||
|
||||
@array_function_dispatch(_geomspace_dispatcher)
|
||||
def geomspace(start, stop, num=50, endpoint=True, dtype=None, axis=0):
|
||||
"""
|
||||
Return numbers spaced evenly on a log scale (a geometric progression).
|
||||
|
||||
This is similar to `logspace`, but with endpoints specified directly.
|
||||
Each output sample is a constant multiple of the previous.
|
||||
|
||||
.. versionchanged:: 1.16.0
|
||||
Non-scalar `start` and `stop` are now supported.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
start : array_like
|
||||
The starting value of the sequence.
|
||||
stop : array_like
|
||||
The final value of the sequence, unless `endpoint` is False.
|
||||
In that case, ``num + 1`` values are spaced over the
|
||||
interval in log-space, of which all but the last (a sequence of
|
||||
length `num`) are returned.
|
||||
num : integer, optional
|
||||
Number of samples to generate. Default is 50.
|
||||
endpoint : boolean, optional
|
||||
If true, `stop` is the last sample. Otherwise, it is not included.
|
||||
Default is True.
|
||||
dtype : dtype
|
||||
The type of the output array. If `dtype` is not given, infer the data
|
||||
type from the other input arguments.
|
||||
axis : int, optional
|
||||
The axis in the result to store the samples. Relevant only if start
|
||||
or stop are array-like. By default (0), the samples will be along a
|
||||
new axis inserted at the beginning. Use -1 to get an axis at the end.
|
||||
|
||||
.. versionadded:: 1.16.0
|
||||
|
||||
Returns
|
||||
-------
|
||||
samples : ndarray
|
||||
`num` samples, equally spaced on a log scale.
|
||||
|
||||
See Also
|
||||
--------
|
||||
logspace : Similar to geomspace, but with endpoints specified using log
|
||||
and base.
|
||||
linspace : Similar to geomspace, but with arithmetic instead of geometric
|
||||
progression.
|
||||
arange : Similar to linspace, with the step size specified instead of the
|
||||
number of samples.
|
||||
|
||||
Notes
|
||||
-----
|
||||
If the inputs or dtype are complex, the output will follow a logarithmic
|
||||
spiral in the complex plane. (There are an infinite number of spirals
|
||||
passing through two points; the output will follow the shortest such path.)
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> np.geomspace(1, 1000, num=4)
|
||||
array([ 1., 10., 100., 1000.])
|
||||
>>> np.geomspace(1, 1000, num=3, endpoint=False)
|
||||
array([ 1., 10., 100.])
|
||||
>>> np.geomspace(1, 1000, num=4, endpoint=False)
|
||||
array([ 1. , 5.62341325, 31.6227766 , 177.827941 ])
|
||||
>>> np.geomspace(1, 256, num=9)
|
||||
array([ 1., 2., 4., 8., 16., 32., 64., 128., 256.])
|
||||
|
||||
Note that the above may not produce exact integers:
|
||||
|
||||
>>> np.geomspace(1, 256, num=9, dtype=int)
|
||||
array([ 1, 2, 4, 7, 16, 32, 63, 127, 256])
|
||||
>>> np.around(np.geomspace(1, 256, num=9)).astype(int)
|
||||
array([ 1, 2, 4, 8, 16, 32, 64, 128, 256])
|
||||
|
||||
Negative, decreasing, and complex inputs are allowed:
|
||||
|
||||
>>> np.geomspace(1000, 1, num=4)
|
||||
array([1000., 100., 10., 1.])
|
||||
>>> np.geomspace(-1000, -1, num=4)
|
||||
array([-1000., -100., -10., -1.])
|
||||
>>> np.geomspace(1j, 1000j, num=4) # Straight line
|
||||
array([0. +1.j, 0. +10.j, 0. +100.j, 0.+1000.j])
|
||||
>>> np.geomspace(-1+0j, 1+0j, num=5) # Circle
|
||||
array([-1.00000000e+00+1.22464680e-16j, -7.07106781e-01+7.07106781e-01j,
|
||||
6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j,
|
||||
1.00000000e+00+0.00000000e+00j])
|
||||
|
||||
Graphical illustration of ``endpoint`` parameter:
|
||||
|
||||
>>> import matplotlib.pyplot as plt
|
||||
>>> N = 10
|
||||
>>> y = np.zeros(N)
|
||||
>>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=True), y + 1, 'o')
|
||||
[<matplotlib.lines.Line2D object at 0x...>]
|
||||
>>> plt.semilogx(np.geomspace(1, 1000, N, endpoint=False), y + 2, 'o')
|
||||
[<matplotlib.lines.Line2D object at 0x...>]
|
||||
>>> plt.axis([0.5, 2000, 0, 3])
|
||||
[0.5, 2000, 0, 3]
|
||||
>>> plt.grid(True, color='0.7', linestyle='-', which='both', axis='both')
|
||||
>>> plt.show()
|
||||
|
||||
"""
|
||||
start = asanyarray(start)
|
||||
stop = asanyarray(stop)
|
||||
if _nx.any(start == 0) or _nx.any(stop == 0):
|
||||
raise ValueError('Geometric sequence cannot include zero')
|
||||
|
||||
dt = result_type(start, stop, float(num), _nx.zeros((), dtype))
|
||||
if dtype is None:
|
||||
dtype = dt
|
||||
else:
|
||||
# complex to dtype('complex128'), for instance
|
||||
dtype = _nx.dtype(dtype)
|
||||
|
||||
# Promote both arguments to the same dtype in case, for instance, one is
|
||||
# complex and another is negative and log would produce NaN otherwise.
|
||||
# Copy since we may change things in-place further down.
|
||||
start = start.astype(dt, copy=True)
|
||||
stop = stop.astype(dt, copy=True)
|
||||
|
||||
out_sign = _nx.ones(_nx.broadcast(start, stop).shape, dt)
|
||||
# Avoid negligible real or imaginary parts in output by rotating to
|
||||
# positive real, calculating, then undoing rotation
|
||||
if _nx.issubdtype(dt, _nx.complexfloating):
|
||||
all_imag = (start.real == 0.) & (stop.real == 0.)
|
||||
if _nx.any(all_imag):
|
||||
start[all_imag] = start[all_imag].imag
|
||||
stop[all_imag] = stop[all_imag].imag
|
||||
out_sign[all_imag] = 1j
|
||||
|
||||
both_negative = (_nx.sign(start) == -1) & (_nx.sign(stop) == -1)
|
||||
if _nx.any(both_negative):
|
||||
_nx.negative(start, out=start, where=both_negative)
|
||||
_nx.negative(stop, out=stop, where=both_negative)
|
||||
_nx.negative(out_sign, out=out_sign, where=both_negative)
|
||||
|
||||
log_start = _nx.log10(start)
|
||||
log_stop = _nx.log10(stop)
|
||||
result = out_sign * logspace(log_start, log_stop, num=num,
|
||||
endpoint=endpoint, base=10.0, dtype=dtype)
|
||||
if axis != 0:
|
||||
result = _nx.moveaxis(result, 0, axis)
|
||||
|
||||
return result.astype(dtype, copy=False)
|
||||
|
||||
|
||||
#always succeed
|
||||
def _add_docstring(obj, doc):
|
||||
try:
|
||||
add_docstring(obj, doc)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def add_newdoc(place, obj, doc):
|
||||
"""
|
||||
Adds documentation to obj which is in module place.
|
||||
|
||||
If doc is a string add it to obj as a docstring
|
||||
|
||||
If doc is a tuple, then the first element is interpreted as
|
||||
an attribute of obj and the second as the docstring
|
||||
(method, docstring)
|
||||
|
||||
If doc is a list, then each element of the list should be a
|
||||
sequence of length two --> [(method1, docstring1),
|
||||
(method2, docstring2), ...]
|
||||
|
||||
This routine never raises an error if the docstring can't be written, but
|
||||
will raise an error if the object being documented does not exist.
|
||||
|
||||
This routine cannot modify read-only docstrings, as appear
|
||||
in new-style classes or built-in functions. Because this
|
||||
routine never raises an error the caller must check manually
|
||||
that the docstrings were changed.
|
||||
"""
|
||||
new = getattr(__import__(place, globals(), {}, [obj]), obj)
|
||||
if isinstance(doc, str):
|
||||
_add_docstring(new, doc.strip())
|
||||
elif isinstance(doc, tuple):
|
||||
_add_docstring(getattr(new, doc[0]), doc[1].strip())
|
||||
elif isinstance(doc, list):
|
||||
for val in doc:
|
||||
_add_docstring(getattr(new, val[0]), val[1].strip())
|
@ -0,0 +1,254 @@
|
||||
from __future__ import division, print_function
|
||||
|
||||
import os
|
||||
import genapi
|
||||
|
||||
from genapi import \
|
||||
TypeApi, GlobalVarApi, FunctionApi, BoolValuesApi
|
||||
|
||||
import numpy_api
|
||||
|
||||
# use annotated api when running under cpychecker
|
||||
h_template = r"""
|
||||
#if defined(_MULTIARRAYMODULE) || defined(WITH_CPYCHECKER_STEALS_REFERENCE_TO_ARG_ATTRIBUTE)
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
npy_bool obval;
|
||||
} PyBoolScalarObject;
|
||||
|
||||
extern NPY_NO_EXPORT PyTypeObject PyArrayMapIter_Type;
|
||||
extern NPY_NO_EXPORT PyTypeObject PyArrayNeighborhoodIter_Type;
|
||||
extern NPY_NO_EXPORT PyBoolScalarObject _PyArrayScalar_BoolValues[2];
|
||||
|
||||
%s
|
||||
|
||||
#else
|
||||
|
||||
#if defined(PY_ARRAY_UNIQUE_SYMBOL)
|
||||
#define PyArray_API PY_ARRAY_UNIQUE_SYMBOL
|
||||
#endif
|
||||
|
||||
#if defined(NO_IMPORT) || defined(NO_IMPORT_ARRAY)
|
||||
extern void **PyArray_API;
|
||||
#else
|
||||
#if defined(PY_ARRAY_UNIQUE_SYMBOL)
|
||||
void **PyArray_API;
|
||||
#else
|
||||
static void **PyArray_API=NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
%s
|
||||
|
||||
#if !defined(NO_IMPORT_ARRAY) && !defined(NO_IMPORT)
|
||||
static int
|
||||
_import_array(void)
|
||||
{
|
||||
int st;
|
||||
PyObject *numpy = PyImport_ImportModule("numpy.core._multiarray_umath");
|
||||
PyObject *c_api = NULL;
|
||||
|
||||
if (numpy == NULL) {
|
||||
return -1;
|
||||
}
|
||||
c_api = PyObject_GetAttrString(numpy, "_ARRAY_API");
|
||||
Py_DECREF(numpy);
|
||||
if (c_api == NULL) {
|
||||
PyErr_SetString(PyExc_AttributeError, "_ARRAY_API not found");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
if (!PyCapsule_CheckExact(c_api)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "_ARRAY_API is not PyCapsule object");
|
||||
Py_DECREF(c_api);
|
||||
return -1;
|
||||
}
|
||||
PyArray_API = (void **)PyCapsule_GetPointer(c_api, NULL);
|
||||
#else
|
||||
if (!PyCObject_Check(c_api)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "_ARRAY_API is not PyCObject object");
|
||||
Py_DECREF(c_api);
|
||||
return -1;
|
||||
}
|
||||
PyArray_API = (void **)PyCObject_AsVoidPtr(c_api);
|
||||
#endif
|
||||
Py_DECREF(c_api);
|
||||
if (PyArray_API == NULL) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "_ARRAY_API is NULL pointer");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Perform runtime check of C API version */
|
||||
if (NPY_VERSION != PyArray_GetNDArrayCVersion()) {
|
||||
PyErr_Format(PyExc_RuntimeError, "module compiled against "\
|
||||
"ABI version 0x%%x but this version of numpy is 0x%%x", \
|
||||
(int) NPY_VERSION, (int) PyArray_GetNDArrayCVersion());
|
||||
return -1;
|
||||
}
|
||||
if (NPY_FEATURE_VERSION > PyArray_GetNDArrayCFeatureVersion()) {
|
||||
PyErr_Format(PyExc_RuntimeError, "module compiled against "\
|
||||
"API version 0x%%x but this version of numpy is 0x%%x", \
|
||||
(int) NPY_FEATURE_VERSION, (int) PyArray_GetNDArrayCFeatureVersion());
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform runtime check of endianness and check it matches the one set by
|
||||
* the headers (npy_endian.h) as a safeguard
|
||||
*/
|
||||
st = PyArray_GetEndianness();
|
||||
if (st == NPY_CPU_UNKNOWN_ENDIAN) {
|
||||
PyErr_Format(PyExc_RuntimeError, "FATAL: module compiled as unknown endian");
|
||||
return -1;
|
||||
}
|
||||
#if NPY_BYTE_ORDER == NPY_BIG_ENDIAN
|
||||
if (st != NPY_CPU_BIG) {
|
||||
PyErr_Format(PyExc_RuntimeError, "FATAL: module compiled as "\
|
||||
"big endian, but detected different endianness at runtime");
|
||||
return -1;
|
||||
}
|
||||
#elif NPY_BYTE_ORDER == NPY_LITTLE_ENDIAN
|
||||
if (st != NPY_CPU_LITTLE) {
|
||||
PyErr_Format(PyExc_RuntimeError, "FATAL: module compiled as "\
|
||||
"little endian, but detected different endianness at runtime");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
#define NUMPY_IMPORT_ARRAY_RETVAL NULL
|
||||
#else
|
||||
#define NUMPY_IMPORT_ARRAY_RETVAL
|
||||
#endif
|
||||
|
||||
#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NUMPY_IMPORT_ARRAY_RETVAL; } }
|
||||
|
||||
#define import_array1(ret) {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return ret; } }
|
||||
|
||||
#define import_array2(msg, ret) {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, msg); return ret; } }
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
"""
|
||||
|
||||
|
||||
c_template = r"""
|
||||
/* These pointers will be stored in the C-object for use in other
|
||||
extension modules
|
||||
*/
|
||||
|
||||
void *PyArray_API[] = {
|
||||
%s
|
||||
};
|
||||
"""
|
||||
|
||||
c_api_header = """
|
||||
===========
|
||||
NumPy C-API
|
||||
===========
|
||||
"""
|
||||
|
||||
def generate_api(output_dir, force=False):
|
||||
basename = 'multiarray_api'
|
||||
|
||||
h_file = os.path.join(output_dir, '__%s.h' % basename)
|
||||
c_file = os.path.join(output_dir, '__%s.c' % basename)
|
||||
d_file = os.path.join(output_dir, '%s.txt' % basename)
|
||||
targets = (h_file, c_file, d_file)
|
||||
|
||||
sources = numpy_api.multiarray_api
|
||||
|
||||
if (not force and not genapi.should_rebuild(targets, [numpy_api.__file__, __file__])):
|
||||
return targets
|
||||
else:
|
||||
do_generate_api(targets, sources)
|
||||
|
||||
return targets
|
||||
|
||||
def do_generate_api(targets, sources):
|
||||
header_file = targets[0]
|
||||
c_file = targets[1]
|
||||
doc_file = targets[2]
|
||||
|
||||
global_vars = sources[0]
|
||||
scalar_bool_values = sources[1]
|
||||
types_api = sources[2]
|
||||
multiarray_funcs = sources[3]
|
||||
|
||||
multiarray_api = sources[:]
|
||||
|
||||
module_list = []
|
||||
extension_list = []
|
||||
init_list = []
|
||||
|
||||
# Check multiarray api indexes
|
||||
multiarray_api_index = genapi.merge_api_dicts(multiarray_api)
|
||||
genapi.check_api_dict(multiarray_api_index)
|
||||
|
||||
numpyapi_list = genapi.get_api_functions('NUMPY_API',
|
||||
multiarray_funcs)
|
||||
|
||||
# FIXME: ordered_funcs_api is unused
|
||||
ordered_funcs_api = genapi.order_dict(multiarray_funcs)
|
||||
|
||||
# Create dict name -> *Api instance
|
||||
api_name = 'PyArray_API'
|
||||
multiarray_api_dict = {}
|
||||
for f in numpyapi_list:
|
||||
name = f.name
|
||||
index = multiarray_funcs[name][0]
|
||||
annotations = multiarray_funcs[name][1:]
|
||||
multiarray_api_dict[f.name] = FunctionApi(f.name, index, annotations,
|
||||
f.return_type,
|
||||
f.args, api_name)
|
||||
|
||||
for name, val in global_vars.items():
|
||||
index, type = val
|
||||
multiarray_api_dict[name] = GlobalVarApi(name, index, type, api_name)
|
||||
|
||||
for name, val in scalar_bool_values.items():
|
||||
index = val[0]
|
||||
multiarray_api_dict[name] = BoolValuesApi(name, index, api_name)
|
||||
|
||||
for name, val in types_api.items():
|
||||
index = val[0]
|
||||
multiarray_api_dict[name] = TypeApi(name, index, 'PyTypeObject', api_name)
|
||||
|
||||
if len(multiarray_api_dict) != len(multiarray_api_index):
|
||||
keys_dict = set(multiarray_api_dict.keys())
|
||||
keys_index = set(multiarray_api_index.keys())
|
||||
raise AssertionError(
|
||||
"Multiarray API size mismatch - "
|
||||
"index has extra keys {}, dict has extra keys {}"
|
||||
.format(keys_index - keys_dict, keys_dict - keys_index)
|
||||
)
|
||||
|
||||
extension_list = []
|
||||
for name, index in genapi.order_dict(multiarray_api_index):
|
||||
api_item = multiarray_api_dict[name]
|
||||
extension_list.append(api_item.define_from_array_api_string())
|
||||
init_list.append(api_item.array_api_define())
|
||||
module_list.append(api_item.internal_define())
|
||||
|
||||
# Write to header
|
||||
s = h_template % ('\n'.join(module_list), '\n'.join(extension_list))
|
||||
genapi.write_file(header_file, s)
|
||||
|
||||
# Write to c-code
|
||||
s = c_template % ',\n'.join(init_list)
|
||||
genapi.write_file(c_file, s)
|
||||
|
||||
# write to documentation
|
||||
s = c_api_header
|
||||
for func in numpyapi_list:
|
||||
s += func.to_ReST()
|
||||
s += '\n\n'
|
||||
genapi.write_file(doc_file, s)
|
||||
|
||||
return targets
|
@ -0,0 +1,548 @@
|
||||
"""Machine limits for Float32 and Float64 and (long double) if available...
|
||||
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
__all__ = ['finfo', 'iinfo']
|
||||
|
||||
import warnings
|
||||
|
||||
from .machar import MachAr
|
||||
from .overrides import set_module
|
||||
from . import numeric
|
||||
from . import numerictypes as ntypes
|
||||
from .numeric import array, inf
|
||||
from .umath import log10, exp2
|
||||
from . import umath
|
||||
|
||||
|
||||
def _fr0(a):
|
||||
"""fix rank-0 --> rank-1"""
|
||||
if a.ndim == 0:
|
||||
a = a.copy()
|
||||
a.shape = (1,)
|
||||
return a
|
||||
|
||||
|
||||
def _fr1(a):
|
||||
"""fix rank > 0 --> rank-0"""
|
||||
if a.size == 1:
|
||||
a = a.copy()
|
||||
a.shape = ()
|
||||
return a
|
||||
|
||||
class MachArLike(object):
|
||||
""" Object to simulate MachAr instance """
|
||||
|
||||
def __init__(self,
|
||||
ftype,
|
||||
**kwargs):
|
||||
params = _MACHAR_PARAMS[ftype]
|
||||
float_conv = lambda v: array([v], ftype)
|
||||
float_to_float = lambda v : _fr1(float_conv(v))
|
||||
float_to_str = lambda v: (params['fmt'] % array(_fr0(v)[0], ftype))
|
||||
|
||||
self.title = params['title']
|
||||
# Parameter types same as for discovered MachAr object.
|
||||
self.epsilon = self.eps = float_to_float(kwargs.pop('eps'))
|
||||
self.epsneg = float_to_float(kwargs.pop('epsneg'))
|
||||
self.xmax = self.huge = float_to_float(kwargs.pop('huge'))
|
||||
self.xmin = self.tiny = float_to_float(kwargs.pop('tiny'))
|
||||
self.ibeta = params['itype'](kwargs.pop('ibeta'))
|
||||
self.__dict__.update(kwargs)
|
||||
self.precision = int(-log10(self.eps))
|
||||
self.resolution = float_to_float(float_conv(10) ** (-self.precision))
|
||||
self._str_eps = float_to_str(self.eps)
|
||||
self._str_epsneg = float_to_str(self.epsneg)
|
||||
self._str_xmin = float_to_str(self.xmin)
|
||||
self._str_xmax = float_to_str(self.xmax)
|
||||
self._str_resolution = float_to_str(self.resolution)
|
||||
|
||||
_convert_to_float = {
|
||||
ntypes.csingle: ntypes.single,
|
||||
ntypes.complex_: ntypes.float_,
|
||||
ntypes.clongfloat: ntypes.longfloat
|
||||
}
|
||||
|
||||
# Parameters for creating MachAr / MachAr-like objects
|
||||
_title_fmt = 'numpy {} precision floating point number'
|
||||
_MACHAR_PARAMS = {
|
||||
ntypes.double: dict(
|
||||
itype = ntypes.int64,
|
||||
fmt = '%24.16e',
|
||||
title = _title_fmt.format('double')),
|
||||
ntypes.single: dict(
|
||||
itype = ntypes.int32,
|
||||
fmt = '%15.7e',
|
||||
title = _title_fmt.format('single')),
|
||||
ntypes.longdouble: dict(
|
||||
itype = ntypes.longlong,
|
||||
fmt = '%s',
|
||||
title = _title_fmt.format('long double')),
|
||||
ntypes.half: dict(
|
||||
itype = ntypes.int16,
|
||||
fmt = '%12.5e',
|
||||
title = _title_fmt.format('half'))}
|
||||
|
||||
# Key to identify the floating point type. Key is result of
|
||||
# ftype('-0.1').newbyteorder('<').tobytes()
|
||||
# See:
|
||||
# https://perl5.git.perl.org/perl.git/blob/3118d7d684b56cbeb702af874f4326683c45f045:/Configure
|
||||
_KNOWN_TYPES = {}
|
||||
def _register_type(machar, bytepat):
|
||||
_KNOWN_TYPES[bytepat] = machar
|
||||
_float_ma = {}
|
||||
|
||||
def _register_known_types():
|
||||
# Known parameters for float16
|
||||
# See docstring of MachAr class for description of parameters.
|
||||
f16 = ntypes.float16
|
||||
float16_ma = MachArLike(f16,
|
||||
machep=-10,
|
||||
negep=-11,
|
||||
minexp=-14,
|
||||
maxexp=16,
|
||||
it=10,
|
||||
iexp=5,
|
||||
ibeta=2,
|
||||
irnd=5,
|
||||
ngrd=0,
|
||||
eps=exp2(f16(-10)),
|
||||
epsneg=exp2(f16(-11)),
|
||||
huge=f16(65504),
|
||||
tiny=f16(2 ** -14))
|
||||
_register_type(float16_ma, b'f\xae')
|
||||
_float_ma[16] = float16_ma
|
||||
|
||||
# Known parameters for float32
|
||||
f32 = ntypes.float32
|
||||
float32_ma = MachArLike(f32,
|
||||
machep=-23,
|
||||
negep=-24,
|
||||
minexp=-126,
|
||||
maxexp=128,
|
||||
it=23,
|
||||
iexp=8,
|
||||
ibeta=2,
|
||||
irnd=5,
|
||||
ngrd=0,
|
||||
eps=exp2(f32(-23)),
|
||||
epsneg=exp2(f32(-24)),
|
||||
huge=f32((1 - 2 ** -24) * 2**128),
|
||||
tiny=exp2(f32(-126)))
|
||||
_register_type(float32_ma, b'\xcd\xcc\xcc\xbd')
|
||||
_float_ma[32] = float32_ma
|
||||
|
||||
# Known parameters for float64
|
||||
f64 = ntypes.float64
|
||||
epsneg_f64 = 2.0 ** -53.0
|
||||
tiny_f64 = 2.0 ** -1022.0
|
||||
float64_ma = MachArLike(f64,
|
||||
machep=-52,
|
||||
negep=-53,
|
||||
minexp=-1022,
|
||||
maxexp=1024,
|
||||
it=52,
|
||||
iexp=11,
|
||||
ibeta=2,
|
||||
irnd=5,
|
||||
ngrd=0,
|
||||
eps=2.0 ** -52.0,
|
||||
epsneg=epsneg_f64,
|
||||
huge=(1.0 - epsneg_f64) / tiny_f64 * f64(4),
|
||||
tiny=tiny_f64)
|
||||
_register_type(float64_ma, b'\x9a\x99\x99\x99\x99\x99\xb9\xbf')
|
||||
_float_ma[64] = float64_ma
|
||||
|
||||
# Known parameters for IEEE 754 128-bit binary float
|
||||
ld = ntypes.longdouble
|
||||
epsneg_f128 = exp2(ld(-113))
|
||||
tiny_f128 = exp2(ld(-16382))
|
||||
# Ignore runtime error when this is not f128
|
||||
with numeric.errstate(all='ignore'):
|
||||
huge_f128 = (ld(1) - epsneg_f128) / tiny_f128 * ld(4)
|
||||
float128_ma = MachArLike(ld,
|
||||
machep=-112,
|
||||
negep=-113,
|
||||
minexp=-16382,
|
||||
maxexp=16384,
|
||||
it=112,
|
||||
iexp=15,
|
||||
ibeta=2,
|
||||
irnd=5,
|
||||
ngrd=0,
|
||||
eps=exp2(ld(-112)),
|
||||
epsneg=epsneg_f128,
|
||||
huge=huge_f128,
|
||||
tiny=tiny_f128)
|
||||
# IEEE 754 128-bit binary float
|
||||
_register_type(float128_ma,
|
||||
b'\x9a\x99\x99\x99\x99\x99\x99\x99\x99\x99\x99\x99\x99\x99\xfb\xbf')
|
||||
_register_type(float128_ma,
|
||||
b'\x9a\x99\x99\x99\x99\x99\x99\x99\x99\x99\x99\x99\x99\x99\xfb\xbf')
|
||||
_float_ma[128] = float128_ma
|
||||
|
||||
# Known parameters for float80 (Intel 80-bit extended precision)
|
||||
epsneg_f80 = exp2(ld(-64))
|
||||
tiny_f80 = exp2(ld(-16382))
|
||||
# Ignore runtime error when this is not f80
|
||||
with numeric.errstate(all='ignore'):
|
||||
huge_f80 = (ld(1) - epsneg_f80) / tiny_f80 * ld(4)
|
||||
float80_ma = MachArLike(ld,
|
||||
machep=-63,
|
||||
negep=-64,
|
||||
minexp=-16382,
|
||||
maxexp=16384,
|
||||
it=63,
|
||||
iexp=15,
|
||||
ibeta=2,
|
||||
irnd=5,
|
||||
ngrd=0,
|
||||
eps=exp2(ld(-63)),
|
||||
epsneg=epsneg_f80,
|
||||
huge=huge_f80,
|
||||
tiny=tiny_f80)
|
||||
# float80, first 10 bytes containing actual storage
|
||||
_register_type(float80_ma, b'\xcd\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xfb\xbf')
|
||||
_float_ma[80] = float80_ma
|
||||
|
||||
# Guessed / known parameters for double double; see:
|
||||
# https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format#Double-double_arithmetic
|
||||
# These numbers have the same exponent range as float64, but extended number of
|
||||
# digits in the significand.
|
||||
huge_dd = (umath.nextafter(ld(inf), ld(0))
|
||||
if hasattr(umath, 'nextafter') # Missing on some platforms?
|
||||
else float64_ma.huge)
|
||||
float_dd_ma = MachArLike(ld,
|
||||
machep=-105,
|
||||
negep=-106,
|
||||
minexp=-1022,
|
||||
maxexp=1024,
|
||||
it=105,
|
||||
iexp=11,
|
||||
ibeta=2,
|
||||
irnd=5,
|
||||
ngrd=0,
|
||||
eps=exp2(ld(-105)),
|
||||
epsneg= exp2(ld(-106)),
|
||||
huge=huge_dd,
|
||||
tiny=exp2(ld(-1022)))
|
||||
# double double; low, high order (e.g. PPC 64)
|
||||
_register_type(float_dd_ma,
|
||||
b'\x9a\x99\x99\x99\x99\x99Y<\x9a\x99\x99\x99\x99\x99\xb9\xbf')
|
||||
# double double; high, low order (e.g. PPC 64 le)
|
||||
_register_type(float_dd_ma,
|
||||
b'\x9a\x99\x99\x99\x99\x99\xb9\xbf\x9a\x99\x99\x99\x99\x99Y<')
|
||||
_float_ma['dd'] = float_dd_ma
|
||||
|
||||
|
||||
def _get_machar(ftype):
|
||||
""" Get MachAr instance or MachAr-like instance
|
||||
|
||||
Get parameters for floating point type, by first trying signatures of
|
||||
various known floating point types, then, if none match, attempting to
|
||||
identify parameters by analysis.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
ftype : class
|
||||
Numpy floating point type class (e.g. ``np.float64``)
|
||||
|
||||
Returns
|
||||
-------
|
||||
ma_like : instance of :class:`MachAr` or :class:`MachArLike`
|
||||
Object giving floating point parameters for `ftype`.
|
||||
|
||||
Warns
|
||||
-----
|
||||
UserWarning
|
||||
If the binary signature of the float type is not in the dictionary of
|
||||
known float types.
|
||||
"""
|
||||
params = _MACHAR_PARAMS.get(ftype)
|
||||
if params is None:
|
||||
raise ValueError(repr(ftype))
|
||||
# Detect known / suspected types
|
||||
key = ftype('-0.1').newbyteorder('<').tobytes()
|
||||
ma_like = _KNOWN_TYPES.get(key)
|
||||
# Could be 80 bit == 10 byte extended precision, where last bytes can be
|
||||
# random garbage. Try comparing first 10 bytes to pattern.
|
||||
if ma_like is None and ftype == ntypes.longdouble:
|
||||
ma_like = _KNOWN_TYPES.get(key[:10])
|
||||
if ma_like is not None:
|
||||
return ma_like
|
||||
# Fall back to parameter discovery
|
||||
warnings.warn(
|
||||
'Signature {} for {} does not match any known type: '
|
||||
'falling back to type probe function'.format(key, ftype),
|
||||
UserWarning, stacklevel=2)
|
||||
return _discovered_machar(ftype)
|
||||
|
||||
|
||||
def _discovered_machar(ftype):
|
||||
""" Create MachAr instance with found information on float types
|
||||
"""
|
||||
params = _MACHAR_PARAMS[ftype]
|
||||
return MachAr(lambda v: array([v], ftype),
|
||||
lambda v:_fr0(v.astype(params['itype']))[0],
|
||||
lambda v:array(_fr0(v)[0], ftype),
|
||||
lambda v: params['fmt'] % array(_fr0(v)[0], ftype),
|
||||
params['title'])
|
||||
|
||||
|
||||
@set_module('numpy')
|
||||
class finfo(object):
|
||||
"""
|
||||
finfo(dtype)
|
||||
|
||||
Machine limits for floating point types.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
bits : int
|
||||
The number of bits occupied by the type.
|
||||
eps : float
|
||||
The smallest representable positive number such that
|
||||
``1.0 + eps != 1.0``. Type of `eps` is an appropriate floating
|
||||
point type.
|
||||
epsneg : floating point number of the appropriate type
|
||||
The smallest representable positive number such that
|
||||
``1.0 - epsneg != 1.0``.
|
||||
iexp : int
|
||||
The number of bits in the exponent portion of the floating point
|
||||
representation.
|
||||
machar : MachAr
|
||||
The object which calculated these parameters and holds more
|
||||
detailed information.
|
||||
machep : int
|
||||
The exponent that yields `eps`.
|
||||
max : floating point number of the appropriate type
|
||||
The largest representable number.
|
||||
maxexp : int
|
||||
The smallest positive power of the base (2) that causes overflow.
|
||||
min : floating point number of the appropriate type
|
||||
The smallest representable number, typically ``-max``.
|
||||
minexp : int
|
||||
The most negative power of the base (2) consistent with there
|
||||
being no leading 0's in the mantissa.
|
||||
negep : int
|
||||
The exponent that yields `epsneg`.
|
||||
nexp : int
|
||||
The number of bits in the exponent including its sign and bias.
|
||||
nmant : int
|
||||
The number of bits in the mantissa.
|
||||
precision : int
|
||||
The approximate number of decimal digits to which this kind of
|
||||
float is precise.
|
||||
resolution : floating point number of the appropriate type
|
||||
The approximate decimal resolution of this type, i.e.,
|
||||
``10**-precision``.
|
||||
tiny : float
|
||||
The smallest positive usable number. Type of `tiny` is an
|
||||
appropriate floating point type.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
dtype : float, dtype, or instance
|
||||
Kind of floating point data-type about which to get information.
|
||||
|
||||
See Also
|
||||
--------
|
||||
MachAr : The implementation of the tests that produce this information.
|
||||
iinfo : The equivalent for integer data types.
|
||||
|
||||
Notes
|
||||
-----
|
||||
For developers of NumPy: do not instantiate this at the module level.
|
||||
The initial calculation of these parameters is expensive and negatively
|
||||
impacts import times. These objects are cached, so calling ``finfo()``
|
||||
repeatedly inside your functions is not a problem.
|
||||
|
||||
"""
|
||||
|
||||
_finfo_cache = {}
|
||||
|
||||
def __new__(cls, dtype):
|
||||
try:
|
||||
dtype = numeric.dtype(dtype)
|
||||
except TypeError:
|
||||
# In case a float instance was given
|
||||
dtype = numeric.dtype(type(dtype))
|
||||
|
||||
obj = cls._finfo_cache.get(dtype, None)
|
||||
if obj is not None:
|
||||
return obj
|
||||
dtypes = [dtype]
|
||||
newdtype = numeric.obj2sctype(dtype)
|
||||
if newdtype is not dtype:
|
||||
dtypes.append(newdtype)
|
||||
dtype = newdtype
|
||||
if not issubclass(dtype, numeric.inexact):
|
||||
raise ValueError("data type %r not inexact" % (dtype))
|
||||
obj = cls._finfo_cache.get(dtype, None)
|
||||
if obj is not None:
|
||||
return obj
|
||||
if not issubclass(dtype, numeric.floating):
|
||||
newdtype = _convert_to_float[dtype]
|
||||
if newdtype is not dtype:
|
||||
dtypes.append(newdtype)
|
||||
dtype = newdtype
|
||||
obj = cls._finfo_cache.get(dtype, None)
|
||||
if obj is not None:
|
||||
return obj
|
||||
obj = object.__new__(cls)._init(dtype)
|
||||
for dt in dtypes:
|
||||
cls._finfo_cache[dt] = obj
|
||||
return obj
|
||||
|
||||
def _init(self, dtype):
|
||||
self.dtype = numeric.dtype(dtype)
|
||||
machar = _get_machar(dtype)
|
||||
|
||||
for word in ['precision', 'iexp',
|
||||
'maxexp', 'minexp', 'negep',
|
||||
'machep']:
|
||||
setattr(self, word, getattr(machar, word))
|
||||
for word in ['tiny', 'resolution', 'epsneg']:
|
||||
setattr(self, word, getattr(machar, word).flat[0])
|
||||
self.bits = self.dtype.itemsize * 8
|
||||
self.max = machar.huge.flat[0]
|
||||
self.min = -self.max
|
||||
self.eps = machar.eps.flat[0]
|
||||
self.nexp = machar.iexp
|
||||
self.nmant = machar.it
|
||||
self.machar = machar
|
||||
self._str_tiny = machar._str_xmin.strip()
|
||||
self._str_max = machar._str_xmax.strip()
|
||||
self._str_epsneg = machar._str_epsneg.strip()
|
||||
self._str_eps = machar._str_eps.strip()
|
||||
self._str_resolution = machar._str_resolution.strip()
|
||||
return self
|
||||
|
||||
def __str__(self):
|
||||
fmt = (
|
||||
'Machine parameters for %(dtype)s\n'
|
||||
'---------------------------------------------------------------\n'
|
||||
'precision = %(precision)3s resolution = %(_str_resolution)s\n'
|
||||
'machep = %(machep)6s eps = %(_str_eps)s\n'
|
||||
'negep = %(negep)6s epsneg = %(_str_epsneg)s\n'
|
||||
'minexp = %(minexp)6s tiny = %(_str_tiny)s\n'
|
||||
'maxexp = %(maxexp)6s max = %(_str_max)s\n'
|
||||
'nexp = %(nexp)6s min = -max\n'
|
||||
'---------------------------------------------------------------\n'
|
||||
)
|
||||
return fmt % self.__dict__
|
||||
|
||||
def __repr__(self):
|
||||
c = self.__class__.__name__
|
||||
d = self.__dict__.copy()
|
||||
d['klass'] = c
|
||||
return (("%(klass)s(resolution=%(resolution)s, min=-%(_str_max)s,"
|
||||
" max=%(_str_max)s, dtype=%(dtype)s)") % d)
|
||||
|
||||
|
||||
@set_module('numpy')
|
||||
class iinfo(object):
|
||||
"""
|
||||
iinfo(type)
|
||||
|
||||
Machine limits for integer types.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
bits : int
|
||||
The number of bits occupied by the type.
|
||||
min : int
|
||||
The smallest integer expressible by the type.
|
||||
max : int
|
||||
The largest integer expressible by the type.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
int_type : integer type, dtype, or instance
|
||||
The kind of integer data type to get information about.
|
||||
|
||||
See Also
|
||||
--------
|
||||
finfo : The equivalent for floating point data types.
|
||||
|
||||
Examples
|
||||
--------
|
||||
With types:
|
||||
|
||||
>>> ii16 = np.iinfo(np.int16)
|
||||
>>> ii16.min
|
||||
-32768
|
||||
>>> ii16.max
|
||||
32767
|
||||
>>> ii32 = np.iinfo(np.int32)
|
||||
>>> ii32.min
|
||||
-2147483648
|
||||
>>> ii32.max
|
||||
2147483647
|
||||
|
||||
With instances:
|
||||
|
||||
>>> ii32 = np.iinfo(np.int32(10))
|
||||
>>> ii32.min
|
||||
-2147483648
|
||||
>>> ii32.max
|
||||
2147483647
|
||||
|
||||
"""
|
||||
|
||||
_min_vals = {}
|
||||
_max_vals = {}
|
||||
|
||||
def __init__(self, int_type):
|
||||
try:
|
||||
self.dtype = numeric.dtype(int_type)
|
||||
except TypeError:
|
||||
self.dtype = numeric.dtype(type(int_type))
|
||||
self.kind = self.dtype.kind
|
||||
self.bits = self.dtype.itemsize * 8
|
||||
self.key = "%s%d" % (self.kind, self.bits)
|
||||
if self.kind not in 'iu':
|
||||
raise ValueError("Invalid integer data type %r." % (self.kind,))
|
||||
|
||||
@property
|
||||
def min(self):
|
||||
"""Minimum value of given dtype."""
|
||||
if self.kind == 'u':
|
||||
return 0
|
||||
else:
|
||||
try:
|
||||
val = iinfo._min_vals[self.key]
|
||||
except KeyError:
|
||||
val = int(-(1 << (self.bits-1)))
|
||||
iinfo._min_vals[self.key] = val
|
||||
return val
|
||||
|
||||
@property
|
||||
def max(self):
|
||||
"""Maximum value of given dtype."""
|
||||
try:
|
||||
val = iinfo._max_vals[self.key]
|
||||
except KeyError:
|
||||
if self.kind == 'u':
|
||||
val = int((1 << self.bits) - 1)
|
||||
else:
|
||||
val = int((1 << (self.bits-1)) - 1)
|
||||
iinfo._max_vals[self.key] = val
|
||||
return val
|
||||
|
||||
def __str__(self):
|
||||
"""String representation."""
|
||||
fmt = (
|
||||
'Machine parameters for %(dtype)s\n'
|
||||
'---------------------------------------------------------------\n'
|
||||
'min = %(min)s\n'
|
||||
'max = %(max)s\n'
|
||||
'---------------------------------------------------------------\n'
|
||||
)
|
||||
return fmt % {'dtype': self.dtype, 'min': self.min, 'max': self.max}
|
||||
|
||||
def __repr__(self):
|
||||
return "%s(min=%s, max=%s, dtype=%s)" % (self.__class__.__name__,
|
||||
self.min, self.max, self.dtype)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,326 @@
|
||||
|
||||
#ifdef _UMATHMODULE
|
||||
|
||||
extern NPY_NO_EXPORT PyTypeObject PyUFunc_Type;
|
||||
|
||||
extern NPY_NO_EXPORT PyTypeObject PyUFunc_Type;
|
||||
|
||||
NPY_NO_EXPORT PyObject * PyUFunc_FromFuncAndData \
|
||||
(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int);
|
||||
NPY_NO_EXPORT int PyUFunc_RegisterLoopForType \
|
||||
(PyUFuncObject *, int, PyUFuncGenericFunction, int *, void *);
|
||||
NPY_NO_EXPORT int PyUFunc_GenericFunction \
|
||||
(PyUFuncObject *, PyObject *, PyObject *, PyArrayObject **);
|
||||
NPY_NO_EXPORT void PyUFunc_f_f_As_d_d \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_d_d \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_f_f \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_g_g \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_F_F_As_D_D \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_F_F \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_D_D \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_G_G \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_O_O \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_ff_f_As_dd_d \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_ff_f \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_dd_d \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_gg_g \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_FF_F_As_DD_D \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_DD_D \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_FF_F \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_GG_G \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_OO_O \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_O_O_method \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_OO_O_method \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_On_Om \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT int PyUFunc_GetPyValues \
|
||||
(char *, int *, int *, PyObject **);
|
||||
NPY_NO_EXPORT int PyUFunc_checkfperr \
|
||||
(int, PyObject *, int *);
|
||||
NPY_NO_EXPORT void PyUFunc_clearfperr \
|
||||
(void);
|
||||
NPY_NO_EXPORT int PyUFunc_getfperr \
|
||||
(void);
|
||||
NPY_NO_EXPORT int PyUFunc_handlefperr \
|
||||
(int, PyObject *, int, int *);
|
||||
NPY_NO_EXPORT int PyUFunc_ReplaceLoopBySignature \
|
||||
(PyUFuncObject *, PyUFuncGenericFunction, int *, PyUFuncGenericFunction *);
|
||||
NPY_NO_EXPORT PyObject * PyUFunc_FromFuncAndDataAndSignature \
|
||||
(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int, const char *);
|
||||
NPY_NO_EXPORT int PyUFunc_SetUsesArraysAsData \
|
||||
(void **, size_t);
|
||||
NPY_NO_EXPORT void PyUFunc_e_e \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_e_e_As_f_f \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_e_e_As_d_d \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_ee_e \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_ee_e_As_ff_f \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT void PyUFunc_ee_e_As_dd_d \
|
||||
(char **, npy_intp *, npy_intp *, void *);
|
||||
NPY_NO_EXPORT int PyUFunc_DefaultTypeResolver \
|
||||
(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyObject *, PyArray_Descr **);
|
||||
NPY_NO_EXPORT int PyUFunc_ValidateCasting \
|
||||
(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyArray_Descr **);
|
||||
NPY_NO_EXPORT int PyUFunc_RegisterLoopForDescr \
|
||||
(PyUFuncObject *, PyArray_Descr *, PyUFuncGenericFunction, PyArray_Descr **, void *);
|
||||
NPY_NO_EXPORT PyObject * PyUFunc_FromFuncAndDataAndSignatureAndIdentity \
|
||||
(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int, const char *, PyObject *);
|
||||
|
||||
#else
|
||||
|
||||
#if defined(PY_UFUNC_UNIQUE_SYMBOL)
|
||||
#define PyUFunc_API PY_UFUNC_UNIQUE_SYMBOL
|
||||
#endif
|
||||
|
||||
#if defined(NO_IMPORT) || defined(NO_IMPORT_UFUNC)
|
||||
extern void **PyUFunc_API;
|
||||
#else
|
||||
#if defined(PY_UFUNC_UNIQUE_SYMBOL)
|
||||
void **PyUFunc_API;
|
||||
#else
|
||||
static void **PyUFunc_API=NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define PyUFunc_Type (*(PyTypeObject *)PyUFunc_API[0])
|
||||
#define PyUFunc_FromFuncAndData \
|
||||
(*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int)) \
|
||||
PyUFunc_API[1])
|
||||
#define PyUFunc_RegisterLoopForType \
|
||||
(*(int (*)(PyUFuncObject *, int, PyUFuncGenericFunction, int *, void *)) \
|
||||
PyUFunc_API[2])
|
||||
#define PyUFunc_GenericFunction \
|
||||
(*(int (*)(PyUFuncObject *, PyObject *, PyObject *, PyArrayObject **)) \
|
||||
PyUFunc_API[3])
|
||||
#define PyUFunc_f_f_As_d_d \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[4])
|
||||
#define PyUFunc_d_d \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[5])
|
||||
#define PyUFunc_f_f \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[6])
|
||||
#define PyUFunc_g_g \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[7])
|
||||
#define PyUFunc_F_F_As_D_D \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[8])
|
||||
#define PyUFunc_F_F \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[9])
|
||||
#define PyUFunc_D_D \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[10])
|
||||
#define PyUFunc_G_G \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[11])
|
||||
#define PyUFunc_O_O \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[12])
|
||||
#define PyUFunc_ff_f_As_dd_d \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[13])
|
||||
#define PyUFunc_ff_f \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[14])
|
||||
#define PyUFunc_dd_d \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[15])
|
||||
#define PyUFunc_gg_g \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[16])
|
||||
#define PyUFunc_FF_F_As_DD_D \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[17])
|
||||
#define PyUFunc_DD_D \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[18])
|
||||
#define PyUFunc_FF_F \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[19])
|
||||
#define PyUFunc_GG_G \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[20])
|
||||
#define PyUFunc_OO_O \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[21])
|
||||
#define PyUFunc_O_O_method \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[22])
|
||||
#define PyUFunc_OO_O_method \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[23])
|
||||
#define PyUFunc_On_Om \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[24])
|
||||
#define PyUFunc_GetPyValues \
|
||||
(*(int (*)(char *, int *, int *, PyObject **)) \
|
||||
PyUFunc_API[25])
|
||||
#define PyUFunc_checkfperr \
|
||||
(*(int (*)(int, PyObject *, int *)) \
|
||||
PyUFunc_API[26])
|
||||
#define PyUFunc_clearfperr \
|
||||
(*(void (*)(void)) \
|
||||
PyUFunc_API[27])
|
||||
#define PyUFunc_getfperr \
|
||||
(*(int (*)(void)) \
|
||||
PyUFunc_API[28])
|
||||
#define PyUFunc_handlefperr \
|
||||
(*(int (*)(int, PyObject *, int, int *)) \
|
||||
PyUFunc_API[29])
|
||||
#define PyUFunc_ReplaceLoopBySignature \
|
||||
(*(int (*)(PyUFuncObject *, PyUFuncGenericFunction, int *, PyUFuncGenericFunction *)) \
|
||||
PyUFunc_API[30])
|
||||
#define PyUFunc_FromFuncAndDataAndSignature \
|
||||
(*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int, const char *)) \
|
||||
PyUFunc_API[31])
|
||||
#define PyUFunc_SetUsesArraysAsData \
|
||||
(*(int (*)(void **, size_t)) \
|
||||
PyUFunc_API[32])
|
||||
#define PyUFunc_e_e \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[33])
|
||||
#define PyUFunc_e_e_As_f_f \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[34])
|
||||
#define PyUFunc_e_e_As_d_d \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[35])
|
||||
#define PyUFunc_ee_e \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[36])
|
||||
#define PyUFunc_ee_e_As_ff_f \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[37])
|
||||
#define PyUFunc_ee_e_As_dd_d \
|
||||
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
|
||||
PyUFunc_API[38])
|
||||
#define PyUFunc_DefaultTypeResolver \
|
||||
(*(int (*)(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyObject *, PyArray_Descr **)) \
|
||||
PyUFunc_API[39])
|
||||
#define PyUFunc_ValidateCasting \
|
||||
(*(int (*)(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyArray_Descr **)) \
|
||||
PyUFunc_API[40])
|
||||
#define PyUFunc_RegisterLoopForDescr \
|
||||
(*(int (*)(PyUFuncObject *, PyArray_Descr *, PyUFuncGenericFunction, PyArray_Descr **, void *)) \
|
||||
PyUFunc_API[41])
|
||||
#define PyUFunc_FromFuncAndDataAndSignatureAndIdentity \
|
||||
(*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int, const char *, PyObject *)) \
|
||||
PyUFunc_API[42])
|
||||
|
||||
static NPY_INLINE int
|
||||
_import_umath(void)
|
||||
{
|
||||
PyObject *numpy = PyImport_ImportModule("numpy.core._multiarray_umath");
|
||||
PyObject *c_api = NULL;
|
||||
|
||||
if (numpy == NULL) {
|
||||
PyErr_SetString(PyExc_ImportError,
|
||||
"numpy.core._multiarray_umath failed to import");
|
||||
return -1;
|
||||
}
|
||||
c_api = PyObject_GetAttrString(numpy, "_UFUNC_API");
|
||||
Py_DECREF(numpy);
|
||||
if (c_api == NULL) {
|
||||
PyErr_SetString(PyExc_AttributeError, "_UFUNC_API not found");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
if (!PyCapsule_CheckExact(c_api)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "_UFUNC_API is not PyCapsule object");
|
||||
Py_DECREF(c_api);
|
||||
return -1;
|
||||
}
|
||||
PyUFunc_API = (void **)PyCapsule_GetPointer(c_api, NULL);
|
||||
#else
|
||||
if (!PyCObject_Check(c_api)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "_UFUNC_API is not PyCObject object");
|
||||
Py_DECREF(c_api);
|
||||
return -1;
|
||||
}
|
||||
PyUFunc_API = (void **)PyCObject_AsVoidPtr(c_api);
|
||||
#endif
|
||||
Py_DECREF(c_api);
|
||||
if (PyUFunc_API == NULL) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "_UFUNC_API is NULL pointer");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
#define NUMPY_IMPORT_UMATH_RETVAL NULL
|
||||
#else
|
||||
#define NUMPY_IMPORT_UMATH_RETVAL
|
||||
#endif
|
||||
|
||||
#define import_umath() \
|
||||
do {\
|
||||
UFUNC_NOFPE\
|
||||
if (_import_umath() < 0) {\
|
||||
PyErr_Print();\
|
||||
PyErr_SetString(PyExc_ImportError,\
|
||||
"numpy.core.umath failed to import");\
|
||||
return NUMPY_IMPORT_UMATH_RETVAL;\
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
#define import_umath1(ret) \
|
||||
do {\
|
||||
UFUNC_NOFPE\
|
||||
if (_import_umath() < 0) {\
|
||||
PyErr_Print();\
|
||||
PyErr_SetString(PyExc_ImportError,\
|
||||
"numpy.core.umath failed to import");\
|
||||
return ret;\
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
#define import_umath2(ret, msg) \
|
||||
do {\
|
||||
UFUNC_NOFPE\
|
||||
if (_import_umath() < 0) {\
|
||||
PyErr_Print();\
|
||||
PyErr_SetString(PyExc_ImportError, msg);\
|
||||
return ret;\
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
#define import_ufunc() \
|
||||
do {\
|
||||
UFUNC_NOFPE\
|
||||
if (_import_umath() < 0) {\
|
||||
PyErr_Print();\
|
||||
PyErr_SetString(PyExc_ImportError,\
|
||||
"numpy.core.umath failed to import");\
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
#endif
|
@ -0,0 +1,90 @@
|
||||
#ifndef _NPY_INCLUDE_NEIGHBORHOOD_IMP
|
||||
#error You should not include this header directly
|
||||
#endif
|
||||
/*
|
||||
* Private API (here for inline)
|
||||
*/
|
||||
static NPY_INLINE int
|
||||
_PyArrayNeighborhoodIter_IncrCoord(PyArrayNeighborhoodIterObject* iter);
|
||||
|
||||
/*
|
||||
* Update to next item of the iterator
|
||||
*
|
||||
* Note: this simply increment the coordinates vector, last dimension
|
||||
* incremented first , i.e, for dimension 3
|
||||
* ...
|
||||
* -1, -1, -1
|
||||
* -1, -1, 0
|
||||
* -1, -1, 1
|
||||
* ....
|
||||
* -1, 0, -1
|
||||
* -1, 0, 0
|
||||
* ....
|
||||
* 0, -1, -1
|
||||
* 0, -1, 0
|
||||
* ....
|
||||
*/
|
||||
#define _UPDATE_COORD_ITER(c) \
|
||||
wb = iter->coordinates[c] < iter->bounds[c][1]; \
|
||||
if (wb) { \
|
||||
iter->coordinates[c] += 1; \
|
||||
return 0; \
|
||||
} \
|
||||
else { \
|
||||
iter->coordinates[c] = iter->bounds[c][0]; \
|
||||
}
|
||||
|
||||
static NPY_INLINE int
|
||||
_PyArrayNeighborhoodIter_IncrCoord(PyArrayNeighborhoodIterObject* iter)
|
||||
{
|
||||
npy_intp i, wb;
|
||||
|
||||
for (i = iter->nd - 1; i >= 0; --i) {
|
||||
_UPDATE_COORD_ITER(i)
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Version optimized for 2d arrays, manual loop unrolling
|
||||
*/
|
||||
static NPY_INLINE int
|
||||
_PyArrayNeighborhoodIter_IncrCoord2D(PyArrayNeighborhoodIterObject* iter)
|
||||
{
|
||||
npy_intp wb;
|
||||
|
||||
_UPDATE_COORD_ITER(1)
|
||||
_UPDATE_COORD_ITER(0)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#undef _UPDATE_COORD_ITER
|
||||
|
||||
/*
|
||||
* Advance to the next neighbour
|
||||
*/
|
||||
static NPY_INLINE int
|
||||
PyArrayNeighborhoodIter_Next(PyArrayNeighborhoodIterObject* iter)
|
||||
{
|
||||
_PyArrayNeighborhoodIter_IncrCoord (iter);
|
||||
iter->dataptr = iter->translate((PyArrayIterObject*)iter, iter->coordinates);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset functions
|
||||
*/
|
||||
static NPY_INLINE int
|
||||
PyArrayNeighborhoodIter_Reset(PyArrayNeighborhoodIterObject* iter)
|
||||
{
|
||||
npy_intp i;
|
||||
|
||||
for (i = 0; i < iter->nd; ++i) {
|
||||
iter->coordinates[i] = iter->bounds[i][0];
|
||||
}
|
||||
iter->dataptr = iter->translate((PyArrayIterObject*)iter, iter->coordinates);
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
#define NPY_SIZEOF_SHORT SIZEOF_SHORT
|
||||
#define NPY_SIZEOF_INT SIZEOF_INT
|
||||
#define NPY_SIZEOF_LONG SIZEOF_LONG
|
||||
#define NPY_SIZEOF_FLOAT 4
|
||||
#define NPY_SIZEOF_COMPLEX_FLOAT 8
|
||||
#define NPY_SIZEOF_DOUBLE 8
|
||||
#define NPY_SIZEOF_COMPLEX_DOUBLE 16
|
||||
#define NPY_SIZEOF_LONGDOUBLE 8
|
||||
#define NPY_SIZEOF_COMPLEX_LONGDOUBLE 16
|
||||
#define NPY_SIZEOF_PY_INTPTR_T 8
|
||||
#define NPY_SIZEOF_OFF_T 4
|
||||
#define NPY_SIZEOF_PY_LONG_LONG 8
|
||||
#define NPY_SIZEOF_LONGLONG 8
|
||||
#define NPY_NO_SIGNAL 1
|
||||
#define NPY_NO_SMP 0
|
||||
#define NPY_HAVE_DECL_ISNAN
|
||||
#define NPY_HAVE_DECL_ISINF
|
||||
#define NPY_HAVE_DECL_SIGNBIT
|
||||
#define NPY_HAVE_DECL_ISFINITE
|
||||
#define NPY_USE_C99_COMPLEX 1
|
||||
#define NPY_RELAXED_STRIDES_CHECKING 1
|
||||
#define NPY_USE_C99_FORMATS 1
|
||||
#define NPY_VISIBILITY_HIDDEN
|
||||
#define NPY_ABI_VERSION 0x01000009
|
||||
#define NPY_API_VERSION 0x0000000D
|
||||
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS 1
|
||||
#endif
|
@ -0,0 +1,11 @@
|
||||
#ifndef Py_ARRAYOBJECT_H
|
||||
#define Py_ARRAYOBJECT_H
|
||||
|
||||
#include "ndarrayobject.h"
|
||||
#include "npy_interrupt.h"
|
||||
|
||||
#ifdef NPY_NO_PREFIX
|
||||
#include "noprefix.h"
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,175 @@
|
||||
#ifndef _NPY_ARRAYSCALARS_H_
|
||||
#define _NPY_ARRAYSCALARS_H_
|
||||
|
||||
#ifndef _MULTIARRAYMODULE
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
npy_bool obval;
|
||||
} PyBoolScalarObject;
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
signed char obval;
|
||||
} PyByteScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
short obval;
|
||||
} PyShortScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
int obval;
|
||||
} PyIntScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
long obval;
|
||||
} PyLongScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
npy_longlong obval;
|
||||
} PyLongLongScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
unsigned char obval;
|
||||
} PyUByteScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
unsigned short obval;
|
||||
} PyUShortScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
unsigned int obval;
|
||||
} PyUIntScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
unsigned long obval;
|
||||
} PyULongScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
npy_ulonglong obval;
|
||||
} PyULongLongScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
npy_half obval;
|
||||
} PyHalfScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
float obval;
|
||||
} PyFloatScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
double obval;
|
||||
} PyDoubleScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
npy_longdouble obval;
|
||||
} PyLongDoubleScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
npy_cfloat obval;
|
||||
} PyCFloatScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
npy_cdouble obval;
|
||||
} PyCDoubleScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
npy_clongdouble obval;
|
||||
} PyCLongDoubleScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject * obval;
|
||||
} PyObjectScalarObject;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
npy_datetime obval;
|
||||
PyArray_DatetimeMetaData obmeta;
|
||||
} PyDatetimeScalarObject;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
npy_timedelta obval;
|
||||
PyArray_DatetimeMetaData obmeta;
|
||||
} PyTimedeltaScalarObject;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
char obval;
|
||||
} PyScalarObject;
|
||||
|
||||
#define PyStringScalarObject PyStringObject
|
||||
#define PyUnicodeScalarObject PyUnicodeObject
|
||||
|
||||
typedef struct {
|
||||
PyObject_VAR_HEAD
|
||||
char *obval;
|
||||
PyArray_Descr *descr;
|
||||
int flags;
|
||||
PyObject *base;
|
||||
} PyVoidScalarObject;
|
||||
|
||||
/* Macros
|
||||
Py<Cls><bitsize>ScalarObject
|
||||
Py<Cls><bitsize>ArrType_Type
|
||||
are defined in ndarrayobject.h
|
||||
*/
|
||||
|
||||
#define PyArrayScalar_False ((PyObject *)(&(_PyArrayScalar_BoolValues[0])))
|
||||
#define PyArrayScalar_True ((PyObject *)(&(_PyArrayScalar_BoolValues[1])))
|
||||
#define PyArrayScalar_FromLong(i) \
|
||||
((PyObject *)(&(_PyArrayScalar_BoolValues[((i)!=0)])))
|
||||
#define PyArrayScalar_RETURN_BOOL_FROM_LONG(i) \
|
||||
return Py_INCREF(PyArrayScalar_FromLong(i)), \
|
||||
PyArrayScalar_FromLong(i)
|
||||
#define PyArrayScalar_RETURN_FALSE \
|
||||
return Py_INCREF(PyArrayScalar_False), \
|
||||
PyArrayScalar_False
|
||||
#define PyArrayScalar_RETURN_TRUE \
|
||||
return Py_INCREF(PyArrayScalar_True), \
|
||||
PyArrayScalar_True
|
||||
|
||||
#define PyArrayScalar_New(cls) \
|
||||
Py##cls##ArrType_Type.tp_alloc(&Py##cls##ArrType_Type, 0)
|
||||
#define PyArrayScalar_VAL(obj, cls) \
|
||||
((Py##cls##ScalarObject *)obj)->obval
|
||||
#define PyArrayScalar_ASSIGN(obj, cls, val) \
|
||||
PyArrayScalar_VAL(obj, cls) = val
|
||||
|
||||
#endif
|
@ -0,0 +1,70 @@
|
||||
#ifndef __NPY_HALFFLOAT_H__
|
||||
#define __NPY_HALFFLOAT_H__
|
||||
|
||||
#include <Python.h>
|
||||
#include <numpy/npy_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Half-precision routines
|
||||
*/
|
||||
|
||||
/* Conversions */
|
||||
float npy_half_to_float(npy_half h);
|
||||
double npy_half_to_double(npy_half h);
|
||||
npy_half npy_float_to_half(float f);
|
||||
npy_half npy_double_to_half(double d);
|
||||
/* Comparisons */
|
||||
int npy_half_eq(npy_half h1, npy_half h2);
|
||||
int npy_half_ne(npy_half h1, npy_half h2);
|
||||
int npy_half_le(npy_half h1, npy_half h2);
|
||||
int npy_half_lt(npy_half h1, npy_half h2);
|
||||
int npy_half_ge(npy_half h1, npy_half h2);
|
||||
int npy_half_gt(npy_half h1, npy_half h2);
|
||||
/* faster *_nonan variants for when you know h1 and h2 are not NaN */
|
||||
int npy_half_eq_nonan(npy_half h1, npy_half h2);
|
||||
int npy_half_lt_nonan(npy_half h1, npy_half h2);
|
||||
int npy_half_le_nonan(npy_half h1, npy_half h2);
|
||||
/* Miscellaneous functions */
|
||||
int npy_half_iszero(npy_half h);
|
||||
int npy_half_isnan(npy_half h);
|
||||
int npy_half_isinf(npy_half h);
|
||||
int npy_half_isfinite(npy_half h);
|
||||
int npy_half_signbit(npy_half h);
|
||||
npy_half npy_half_copysign(npy_half x, npy_half y);
|
||||
npy_half npy_half_spacing(npy_half h);
|
||||
npy_half npy_half_nextafter(npy_half x, npy_half y);
|
||||
npy_half npy_half_divmod(npy_half x, npy_half y, npy_half *modulus);
|
||||
|
||||
/*
|
||||
* Half-precision constants
|
||||
*/
|
||||
|
||||
#define NPY_HALF_ZERO (0x0000u)
|
||||
#define NPY_HALF_PZERO (0x0000u)
|
||||
#define NPY_HALF_NZERO (0x8000u)
|
||||
#define NPY_HALF_ONE (0x3c00u)
|
||||
#define NPY_HALF_NEGONE (0xbc00u)
|
||||
#define NPY_HALF_PINF (0x7c00u)
|
||||
#define NPY_HALF_NINF (0xfc00u)
|
||||
#define NPY_HALF_NAN (0x7e00u)
|
||||
|
||||
#define NPY_MAX_HALF (0x7bffu)
|
||||
|
||||
/*
|
||||
* Bit-level conversions
|
||||
*/
|
||||
|
||||
npy_uint16 npy_floatbits_to_halfbits(npy_uint32 f);
|
||||
npy_uint16 npy_doublebits_to_halfbits(npy_uint64 d);
|
||||
npy_uint32 npy_halfbits_to_floatbits(npy_uint16 h);
|
||||
npy_uint64 npy_halfbits_to_doublebits(npy_uint16 h);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,285 @@
|
||||
/*
|
||||
* DON'T INCLUDE THIS DIRECTLY.
|
||||
*/
|
||||
|
||||
#ifndef NPY_NDARRAYOBJECT_H
|
||||
#define NPY_NDARRAYOBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <Python.h>
|
||||
#include "ndarraytypes.h"
|
||||
|
||||
/* Includes the "function" C-API -- these are all stored in a
|
||||
list of pointers --- one for each file
|
||||
The two lists are concatenated into one in multiarray.
|
||||
|
||||
They are available as import_array()
|
||||
*/
|
||||
|
||||
#include "__multiarray_api.h"
|
||||
|
||||
|
||||
/* C-API that requires previous API to be defined */
|
||||
|
||||
#define PyArray_DescrCheck(op) (((PyObject*)(op))->ob_type==&PyArrayDescr_Type)
|
||||
|
||||
#define PyArray_Check(op) PyObject_TypeCheck(op, &PyArray_Type)
|
||||
#define PyArray_CheckExact(op) (((PyObject*)(op))->ob_type == &PyArray_Type)
|
||||
|
||||
#define PyArray_HasArrayInterfaceType(op, type, context, out) \
|
||||
((((out)=PyArray_FromStructInterface(op)) != Py_NotImplemented) || \
|
||||
(((out)=PyArray_FromInterface(op)) != Py_NotImplemented) || \
|
||||
(((out)=PyArray_FromArrayAttr(op, type, context)) != \
|
||||
Py_NotImplemented))
|
||||
|
||||
#define PyArray_HasArrayInterface(op, out) \
|
||||
PyArray_HasArrayInterfaceType(op, NULL, NULL, out)
|
||||
|
||||
#define PyArray_IsZeroDim(op) (PyArray_Check(op) && \
|
||||
(PyArray_NDIM((PyArrayObject *)op) == 0))
|
||||
|
||||
#define PyArray_IsScalar(obj, cls) \
|
||||
(PyObject_TypeCheck(obj, &Py##cls##ArrType_Type))
|
||||
|
||||
#define PyArray_CheckScalar(m) (PyArray_IsScalar(m, Generic) || \
|
||||
PyArray_IsZeroDim(m))
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
#define PyArray_IsPythonNumber(obj) \
|
||||
(PyFloat_Check(obj) || PyComplex_Check(obj) || \
|
||||
PyLong_Check(obj) || PyBool_Check(obj))
|
||||
#define PyArray_IsIntegerScalar(obj) (PyLong_Check(obj) \
|
||||
|| PyArray_IsScalar((obj), Integer))
|
||||
#define PyArray_IsPythonScalar(obj) \
|
||||
(PyArray_IsPythonNumber(obj) || PyBytes_Check(obj) || \
|
||||
PyUnicode_Check(obj))
|
||||
#else
|
||||
#define PyArray_IsPythonNumber(obj) \
|
||||
(PyInt_Check(obj) || PyFloat_Check(obj) || PyComplex_Check(obj) || \
|
||||
PyLong_Check(obj) || PyBool_Check(obj))
|
||||
#define PyArray_IsIntegerScalar(obj) (PyInt_Check(obj) \
|
||||
|| PyLong_Check(obj) \
|
||||
|| PyArray_IsScalar((obj), Integer))
|
||||
#define PyArray_IsPythonScalar(obj) \
|
||||
(PyArray_IsPythonNumber(obj) || PyString_Check(obj) || \
|
||||
PyUnicode_Check(obj))
|
||||
#endif
|
||||
|
||||
#define PyArray_IsAnyScalar(obj) \
|
||||
(PyArray_IsScalar(obj, Generic) || PyArray_IsPythonScalar(obj))
|
||||
|
||||
#define PyArray_CheckAnyScalar(obj) (PyArray_IsPythonScalar(obj) || \
|
||||
PyArray_CheckScalar(obj))
|
||||
|
||||
|
||||
#define PyArray_GETCONTIGUOUS(m) (PyArray_ISCONTIGUOUS(m) ? \
|
||||
Py_INCREF(m), (m) : \
|
||||
(PyArrayObject *)(PyArray_Copy(m)))
|
||||
|
||||
#define PyArray_SAMESHAPE(a1,a2) ((PyArray_NDIM(a1) == PyArray_NDIM(a2)) && \
|
||||
PyArray_CompareLists(PyArray_DIMS(a1), \
|
||||
PyArray_DIMS(a2), \
|
||||
PyArray_NDIM(a1)))
|
||||
|
||||
#define PyArray_SIZE(m) PyArray_MultiplyList(PyArray_DIMS(m), PyArray_NDIM(m))
|
||||
#define PyArray_NBYTES(m) (PyArray_ITEMSIZE(m) * PyArray_SIZE(m))
|
||||
#define PyArray_FROM_O(m) PyArray_FromAny(m, NULL, 0, 0, 0, NULL)
|
||||
|
||||
#define PyArray_FROM_OF(m,flags) PyArray_CheckFromAny(m, NULL, 0, 0, flags, \
|
||||
NULL)
|
||||
|
||||
#define PyArray_FROM_OT(m,type) PyArray_FromAny(m, \
|
||||
PyArray_DescrFromType(type), 0, 0, 0, NULL)
|
||||
|
||||
#define PyArray_FROM_OTF(m, type, flags) \
|
||||
PyArray_FromAny(m, PyArray_DescrFromType(type), 0, 0, \
|
||||
(((flags) & NPY_ARRAY_ENSURECOPY) ? \
|
||||
((flags) | NPY_ARRAY_DEFAULT) : (flags)), NULL)
|
||||
|
||||
#define PyArray_FROMANY(m, type, min, max, flags) \
|
||||
PyArray_FromAny(m, PyArray_DescrFromType(type), min, max, \
|
||||
(((flags) & NPY_ARRAY_ENSURECOPY) ? \
|
||||
(flags) | NPY_ARRAY_DEFAULT : (flags)), NULL)
|
||||
|
||||
#define PyArray_ZEROS(m, dims, type, is_f_order) \
|
||||
PyArray_Zeros(m, dims, PyArray_DescrFromType(type), is_f_order)
|
||||
|
||||
#define PyArray_EMPTY(m, dims, type, is_f_order) \
|
||||
PyArray_Empty(m, dims, PyArray_DescrFromType(type), is_f_order)
|
||||
|
||||
#define PyArray_FILLWBYTE(obj, val) memset(PyArray_DATA(obj), val, \
|
||||
PyArray_NBYTES(obj))
|
||||
#ifndef PYPY_VERSION
|
||||
#define PyArray_REFCOUNT(obj) (((PyObject *)(obj))->ob_refcnt)
|
||||
#define NPY_REFCOUNT PyArray_REFCOUNT
|
||||
#endif
|
||||
#define NPY_MAX_ELSIZE (2 * NPY_SIZEOF_LONGDOUBLE)
|
||||
|
||||
#define PyArray_ContiguousFromAny(op, type, min_depth, max_depth) \
|
||||
PyArray_FromAny(op, PyArray_DescrFromType(type), min_depth, \
|
||||
max_depth, NPY_ARRAY_DEFAULT, NULL)
|
||||
|
||||
#define PyArray_EquivArrTypes(a1, a2) \
|
||||
PyArray_EquivTypes(PyArray_DESCR(a1), PyArray_DESCR(a2))
|
||||
|
||||
#define PyArray_EquivByteorders(b1, b2) \
|
||||
(((b1) == (b2)) || (PyArray_ISNBO(b1) == PyArray_ISNBO(b2)))
|
||||
|
||||
#define PyArray_SimpleNew(nd, dims, typenum) \
|
||||
PyArray_New(&PyArray_Type, nd, dims, typenum, NULL, NULL, 0, 0, NULL)
|
||||
|
||||
#define PyArray_SimpleNewFromData(nd, dims, typenum, data) \
|
||||
PyArray_New(&PyArray_Type, nd, dims, typenum, NULL, \
|
||||
data, 0, NPY_ARRAY_CARRAY, NULL)
|
||||
|
||||
#define PyArray_SimpleNewFromDescr(nd, dims, descr) \
|
||||
PyArray_NewFromDescr(&PyArray_Type, descr, nd, dims, \
|
||||
NULL, NULL, 0, NULL)
|
||||
|
||||
#define PyArray_ToScalar(data, arr) \
|
||||
PyArray_Scalar(data, PyArray_DESCR(arr), (PyObject *)arr)
|
||||
|
||||
|
||||
/* These might be faster without the dereferencing of obj
|
||||
going on inside -- of course an optimizing compiler should
|
||||
inline the constants inside a for loop making it a moot point
|
||||
*/
|
||||
|
||||
#define PyArray_GETPTR1(obj, i) ((void *)(PyArray_BYTES(obj) + \
|
||||
(i)*PyArray_STRIDES(obj)[0]))
|
||||
|
||||
#define PyArray_GETPTR2(obj, i, j) ((void *)(PyArray_BYTES(obj) + \
|
||||
(i)*PyArray_STRIDES(obj)[0] + \
|
||||
(j)*PyArray_STRIDES(obj)[1]))
|
||||
|
||||
#define PyArray_GETPTR3(obj, i, j, k) ((void *)(PyArray_BYTES(obj) + \
|
||||
(i)*PyArray_STRIDES(obj)[0] + \
|
||||
(j)*PyArray_STRIDES(obj)[1] + \
|
||||
(k)*PyArray_STRIDES(obj)[2]))
|
||||
|
||||
#define PyArray_GETPTR4(obj, i, j, k, l) ((void *)(PyArray_BYTES(obj) + \
|
||||
(i)*PyArray_STRIDES(obj)[0] + \
|
||||
(j)*PyArray_STRIDES(obj)[1] + \
|
||||
(k)*PyArray_STRIDES(obj)[2] + \
|
||||
(l)*PyArray_STRIDES(obj)[3]))
|
||||
|
||||
/* Move to arrayobject.c once PyArray_XDECREF_ERR is removed */
|
||||
static NPY_INLINE void
|
||||
PyArray_DiscardWritebackIfCopy(PyArrayObject *arr)
|
||||
{
|
||||
PyArrayObject_fields *fa = (PyArrayObject_fields *)arr;
|
||||
if (fa && fa->base) {
|
||||
if ((fa->flags & NPY_ARRAY_UPDATEIFCOPY) ||
|
||||
(fa->flags & NPY_ARRAY_WRITEBACKIFCOPY)) {
|
||||
PyArray_ENABLEFLAGS((PyArrayObject*)fa->base, NPY_ARRAY_WRITEABLE);
|
||||
Py_DECREF(fa->base);
|
||||
fa->base = NULL;
|
||||
PyArray_CLEARFLAGS(arr, NPY_ARRAY_WRITEBACKIFCOPY);
|
||||
PyArray_CLEARFLAGS(arr, NPY_ARRAY_UPDATEIFCOPY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define PyArray_DESCR_REPLACE(descr) do { \
|
||||
PyArray_Descr *_new_; \
|
||||
_new_ = PyArray_DescrNew(descr); \
|
||||
Py_XDECREF(descr); \
|
||||
descr = _new_; \
|
||||
} while(0)
|
||||
|
||||
/* Copy should always return contiguous array */
|
||||
#define PyArray_Copy(obj) PyArray_NewCopy(obj, NPY_CORDER)
|
||||
|
||||
#define PyArray_FromObject(op, type, min_depth, max_depth) \
|
||||
PyArray_FromAny(op, PyArray_DescrFromType(type), min_depth, \
|
||||
max_depth, NPY_ARRAY_BEHAVED | \
|
||||
NPY_ARRAY_ENSUREARRAY, NULL)
|
||||
|
||||
#define PyArray_ContiguousFromObject(op, type, min_depth, max_depth) \
|
||||
PyArray_FromAny(op, PyArray_DescrFromType(type), min_depth, \
|
||||
max_depth, NPY_ARRAY_DEFAULT | \
|
||||
NPY_ARRAY_ENSUREARRAY, NULL)
|
||||
|
||||
#define PyArray_CopyFromObject(op, type, min_depth, max_depth) \
|
||||
PyArray_FromAny(op, PyArray_DescrFromType(type), min_depth, \
|
||||
max_depth, NPY_ARRAY_ENSURECOPY | \
|
||||
NPY_ARRAY_DEFAULT | \
|
||||
NPY_ARRAY_ENSUREARRAY, NULL)
|
||||
|
||||
#define PyArray_Cast(mp, type_num) \
|
||||
PyArray_CastToType(mp, PyArray_DescrFromType(type_num), 0)
|
||||
|
||||
#define PyArray_Take(ap, items, axis) \
|
||||
PyArray_TakeFrom(ap, items, axis, NULL, NPY_RAISE)
|
||||
|
||||
#define PyArray_Put(ap, items, values) \
|
||||
PyArray_PutTo(ap, items, values, NPY_RAISE)
|
||||
|
||||
/* Compatibility with old Numeric stuff -- don't use in new code */
|
||||
|
||||
#define PyArray_FromDimsAndData(nd, d, type, data) \
|
||||
PyArray_FromDimsAndDataAndDescr(nd, d, PyArray_DescrFromType(type), \
|
||||
data)
|
||||
|
||||
|
||||
/*
|
||||
Check to see if this key in the dictionary is the "title"
|
||||
entry of the tuple (i.e. a duplicate dictionary entry in the fields
|
||||
dict.
|
||||
*/
|
||||
|
||||
static NPY_INLINE int
|
||||
NPY_TITLE_KEY_check(PyObject *key, PyObject *value)
|
||||
{
|
||||
PyObject *title;
|
||||
if (PyTuple_Size(value) != 3) {
|
||||
return 0;
|
||||
}
|
||||
title = PyTuple_GetItem(value, 2);
|
||||
if (key == title) {
|
||||
return 1;
|
||||
}
|
||||
#ifdef PYPY_VERSION
|
||||
/*
|
||||
* On PyPy, dictionary keys do not always preserve object identity.
|
||||
* Fall back to comparison by value.
|
||||
*/
|
||||
if (PyUnicode_Check(title) && PyUnicode_Check(key)) {
|
||||
return PyUnicode_Compare(title, key) == 0 ? 1 : 0;
|
||||
}
|
||||
#if PY_VERSION_HEX < 0x03000000
|
||||
if (PyString_Check(title) && PyString_Check(key)) {
|
||||
return PyObject_Compare(title, key) == 0 ? 1 : 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Macro, for backward compat with "if NPY_TITLE_KEY(key, value) { ..." */
|
||||
#define NPY_TITLE_KEY(key, value) (NPY_TITLE_KEY_check((key), (value)))
|
||||
|
||||
#define DEPRECATE(msg) PyErr_WarnEx(PyExc_DeprecationWarning,msg,1)
|
||||
#define DEPRECATE_FUTUREWARNING(msg) PyErr_WarnEx(PyExc_FutureWarning,msg,1)
|
||||
|
||||
#if !defined(NPY_NO_DEPRECATED_API) || \
|
||||
(NPY_NO_DEPRECATED_API < NPY_1_14_API_VERSION)
|
||||
static NPY_INLINE void
|
||||
PyArray_XDECREF_ERR(PyArrayObject *arr)
|
||||
{
|
||||
/* 2017-Nov-10 1.14 */
|
||||
DEPRECATE("PyArray_XDECREF_ERR is deprecated, call "
|
||||
"PyArray_DiscardWritebackIfCopy then Py_XDECREF instead");
|
||||
PyArray_DiscardWritebackIfCopy(arr);
|
||||
Py_XDECREF(arr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* NPY_NDARRAYOBJECT_H */
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,212 @@
|
||||
#ifndef NPY_NOPREFIX_H
|
||||
#define NPY_NOPREFIX_H
|
||||
|
||||
/*
|
||||
* You can directly include noprefix.h as a backward
|
||||
* compatibility measure
|
||||
*/
|
||||
#ifndef NPY_NO_PREFIX
|
||||
#include "ndarrayobject.h"
|
||||
#include "npy_interrupt.h"
|
||||
#endif
|
||||
|
||||
#define SIGSETJMP NPY_SIGSETJMP
|
||||
#define SIGLONGJMP NPY_SIGLONGJMP
|
||||
#define SIGJMP_BUF NPY_SIGJMP_BUF
|
||||
|
||||
#define MAX_DIMS NPY_MAXDIMS
|
||||
|
||||
#define longlong npy_longlong
|
||||
#define ulonglong npy_ulonglong
|
||||
#define Bool npy_bool
|
||||
#define longdouble npy_longdouble
|
||||
#define byte npy_byte
|
||||
|
||||
#ifndef _BSD_SOURCE
|
||||
#define ushort npy_ushort
|
||||
#define uint npy_uint
|
||||
#define ulong npy_ulong
|
||||
#endif
|
||||
|
||||
#define ubyte npy_ubyte
|
||||
#define ushort npy_ushort
|
||||
#define uint npy_uint
|
||||
#define ulong npy_ulong
|
||||
#define cfloat npy_cfloat
|
||||
#define cdouble npy_cdouble
|
||||
#define clongdouble npy_clongdouble
|
||||
#define Int8 npy_int8
|
||||
#define UInt8 npy_uint8
|
||||
#define Int16 npy_int16
|
||||
#define UInt16 npy_uint16
|
||||
#define Int32 npy_int32
|
||||
#define UInt32 npy_uint32
|
||||
#define Int64 npy_int64
|
||||
#define UInt64 npy_uint64
|
||||
#define Int128 npy_int128
|
||||
#define UInt128 npy_uint128
|
||||
#define Int256 npy_int256
|
||||
#define UInt256 npy_uint256
|
||||
#define Float16 npy_float16
|
||||
#define Complex32 npy_complex32
|
||||
#define Float32 npy_float32
|
||||
#define Complex64 npy_complex64
|
||||
#define Float64 npy_float64
|
||||
#define Complex128 npy_complex128
|
||||
#define Float80 npy_float80
|
||||
#define Complex160 npy_complex160
|
||||
#define Float96 npy_float96
|
||||
#define Complex192 npy_complex192
|
||||
#define Float128 npy_float128
|
||||
#define Complex256 npy_complex256
|
||||
#define intp npy_intp
|
||||
#define uintp npy_uintp
|
||||
#define datetime npy_datetime
|
||||
#define timedelta npy_timedelta
|
||||
|
||||
#define SIZEOF_LONGLONG NPY_SIZEOF_LONGLONG
|
||||
#define SIZEOF_INTP NPY_SIZEOF_INTP
|
||||
#define SIZEOF_UINTP NPY_SIZEOF_UINTP
|
||||
#define SIZEOF_HALF NPY_SIZEOF_HALF
|
||||
#define SIZEOF_LONGDOUBLE NPY_SIZEOF_LONGDOUBLE
|
||||
#define SIZEOF_DATETIME NPY_SIZEOF_DATETIME
|
||||
#define SIZEOF_TIMEDELTA NPY_SIZEOF_TIMEDELTA
|
||||
|
||||
#define LONGLONG_FMT NPY_LONGLONG_FMT
|
||||
#define ULONGLONG_FMT NPY_ULONGLONG_FMT
|
||||
#define LONGLONG_SUFFIX NPY_LONGLONG_SUFFIX
|
||||
#define ULONGLONG_SUFFIX NPY_ULONGLONG_SUFFIX
|
||||
|
||||
#define MAX_INT8 127
|
||||
#define MIN_INT8 -128
|
||||
#define MAX_UINT8 255
|
||||
#define MAX_INT16 32767
|
||||
#define MIN_INT16 -32768
|
||||
#define MAX_UINT16 65535
|
||||
#define MAX_INT32 2147483647
|
||||
#define MIN_INT32 (-MAX_INT32 - 1)
|
||||
#define MAX_UINT32 4294967295U
|
||||
#define MAX_INT64 LONGLONG_SUFFIX(9223372036854775807)
|
||||
#define MIN_INT64 (-MAX_INT64 - LONGLONG_SUFFIX(1))
|
||||
#define MAX_UINT64 ULONGLONG_SUFFIX(18446744073709551615)
|
||||
#define MAX_INT128 LONGLONG_SUFFIX(85070591730234615865843651857942052864)
|
||||
#define MIN_INT128 (-MAX_INT128 - LONGLONG_SUFFIX(1))
|
||||
#define MAX_UINT128 ULONGLONG_SUFFIX(170141183460469231731687303715884105728)
|
||||
#define MAX_INT256 LONGLONG_SUFFIX(57896044618658097711785492504343953926634992332820282019728792003956564819967)
|
||||
#define MIN_INT256 (-MAX_INT256 - LONGLONG_SUFFIX(1))
|
||||
#define MAX_UINT256 ULONGLONG_SUFFIX(115792089237316195423570985008687907853269984665640564039457584007913129639935)
|
||||
|
||||
#define MAX_BYTE NPY_MAX_BYTE
|
||||
#define MIN_BYTE NPY_MIN_BYTE
|
||||
#define MAX_UBYTE NPY_MAX_UBYTE
|
||||
#define MAX_SHORT NPY_MAX_SHORT
|
||||
#define MIN_SHORT NPY_MIN_SHORT
|
||||
#define MAX_USHORT NPY_MAX_USHORT
|
||||
#define MAX_INT NPY_MAX_INT
|
||||
#define MIN_INT NPY_MIN_INT
|
||||
#define MAX_UINT NPY_MAX_UINT
|
||||
#define MAX_LONG NPY_MAX_LONG
|
||||
#define MIN_LONG NPY_MIN_LONG
|
||||
#define MAX_ULONG NPY_MAX_ULONG
|
||||
#define MAX_LONGLONG NPY_MAX_LONGLONG
|
||||
#define MIN_LONGLONG NPY_MIN_LONGLONG
|
||||
#define MAX_ULONGLONG NPY_MAX_ULONGLONG
|
||||
#define MIN_DATETIME NPY_MIN_DATETIME
|
||||
#define MAX_DATETIME NPY_MAX_DATETIME
|
||||
#define MIN_TIMEDELTA NPY_MIN_TIMEDELTA
|
||||
#define MAX_TIMEDELTA NPY_MAX_TIMEDELTA
|
||||
|
||||
#define BITSOF_BOOL NPY_BITSOF_BOOL
|
||||
#define BITSOF_CHAR NPY_BITSOF_CHAR
|
||||
#define BITSOF_SHORT NPY_BITSOF_SHORT
|
||||
#define BITSOF_INT NPY_BITSOF_INT
|
||||
#define BITSOF_LONG NPY_BITSOF_LONG
|
||||
#define BITSOF_LONGLONG NPY_BITSOF_LONGLONG
|
||||
#define BITSOF_HALF NPY_BITSOF_HALF
|
||||
#define BITSOF_FLOAT NPY_BITSOF_FLOAT
|
||||
#define BITSOF_DOUBLE NPY_BITSOF_DOUBLE
|
||||
#define BITSOF_LONGDOUBLE NPY_BITSOF_LONGDOUBLE
|
||||
#define BITSOF_DATETIME NPY_BITSOF_DATETIME
|
||||
#define BITSOF_TIMEDELTA NPY_BITSOF_TIMEDELTA
|
||||
|
||||
#define _pya_malloc PyArray_malloc
|
||||
#define _pya_free PyArray_free
|
||||
#define _pya_realloc PyArray_realloc
|
||||
|
||||
#define BEGIN_THREADS_DEF NPY_BEGIN_THREADS_DEF
|
||||
#define BEGIN_THREADS NPY_BEGIN_THREADS
|
||||
#define END_THREADS NPY_END_THREADS
|
||||
#define ALLOW_C_API_DEF NPY_ALLOW_C_API_DEF
|
||||
#define ALLOW_C_API NPY_ALLOW_C_API
|
||||
#define DISABLE_C_API NPY_DISABLE_C_API
|
||||
|
||||
#define PY_FAIL NPY_FAIL
|
||||
#define PY_SUCCEED NPY_SUCCEED
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE NPY_TRUE
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE NPY_FALSE
|
||||
#endif
|
||||
|
||||
#define LONGDOUBLE_FMT NPY_LONGDOUBLE_FMT
|
||||
|
||||
#define CONTIGUOUS NPY_CONTIGUOUS
|
||||
#define C_CONTIGUOUS NPY_C_CONTIGUOUS
|
||||
#define FORTRAN NPY_FORTRAN
|
||||
#define F_CONTIGUOUS NPY_F_CONTIGUOUS
|
||||
#define OWNDATA NPY_OWNDATA
|
||||
#define FORCECAST NPY_FORCECAST
|
||||
#define ENSURECOPY NPY_ENSURECOPY
|
||||
#define ENSUREARRAY NPY_ENSUREARRAY
|
||||
#define ELEMENTSTRIDES NPY_ELEMENTSTRIDES
|
||||
#define ALIGNED NPY_ALIGNED
|
||||
#define NOTSWAPPED NPY_NOTSWAPPED
|
||||
#define WRITEABLE NPY_WRITEABLE
|
||||
#define UPDATEIFCOPY NPY_UPDATEIFCOPY
|
||||
#define WRITEBACKIFCOPY NPY_ARRAY_WRITEBACKIFCOPY
|
||||
#define ARR_HAS_DESCR NPY_ARR_HAS_DESCR
|
||||
#define BEHAVED NPY_BEHAVED
|
||||
#define BEHAVED_NS NPY_BEHAVED_NS
|
||||
#define CARRAY NPY_CARRAY
|
||||
#define CARRAY_RO NPY_CARRAY_RO
|
||||
#define FARRAY NPY_FARRAY
|
||||
#define FARRAY_RO NPY_FARRAY_RO
|
||||
#define DEFAULT NPY_DEFAULT
|
||||
#define IN_ARRAY NPY_IN_ARRAY
|
||||
#define OUT_ARRAY NPY_OUT_ARRAY
|
||||
#define INOUT_ARRAY NPY_INOUT_ARRAY
|
||||
#define IN_FARRAY NPY_IN_FARRAY
|
||||
#define OUT_FARRAY NPY_OUT_FARRAY
|
||||
#define INOUT_FARRAY NPY_INOUT_FARRAY
|
||||
#define UPDATE_ALL NPY_UPDATE_ALL
|
||||
|
||||
#define OWN_DATA NPY_OWNDATA
|
||||
#define BEHAVED_FLAGS NPY_BEHAVED
|
||||
#define BEHAVED_FLAGS_NS NPY_BEHAVED_NS
|
||||
#define CARRAY_FLAGS_RO NPY_CARRAY_RO
|
||||
#define CARRAY_FLAGS NPY_CARRAY
|
||||
#define FARRAY_FLAGS NPY_FARRAY
|
||||
#define FARRAY_FLAGS_RO NPY_FARRAY_RO
|
||||
#define DEFAULT_FLAGS NPY_DEFAULT
|
||||
#define UPDATE_ALL_FLAGS NPY_UPDATE_ALL_FLAGS
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN PyArray_MIN
|
||||
#endif
|
||||
#ifndef MAX
|
||||
#define MAX PyArray_MAX
|
||||
#endif
|
||||
#define MAX_INTP NPY_MAX_INTP
|
||||
#define MIN_INTP NPY_MIN_INTP
|
||||
#define MAX_UINTP NPY_MAX_UINTP
|
||||
#define INTP_FMT NPY_INTP_FMT
|
||||
|
||||
#ifndef PYPY_VERSION
|
||||
#define REFCOUNT PyArray_REFCOUNT
|
||||
#define MAX_ELSIZE NPY_MAX_ELSIZE
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,133 @@
|
||||
#ifndef _NPY_1_7_DEPRECATED_API_H
|
||||
#define _NPY_1_7_DEPRECATED_API_H
|
||||
|
||||
#ifndef NPY_DEPRECATED_INCLUDES
|
||||
#error "Should never include npy_*_*_deprecated_api directly."
|
||||
#endif
|
||||
|
||||
/* Emit a warning if the user did not specifically request the old API */
|
||||
#ifndef NPY_NO_DEPRECATED_API
|
||||
#if defined(_WIN32)
|
||||
#define _WARN___STR2__(x) #x
|
||||
#define _WARN___STR1__(x) _WARN___STR2__(x)
|
||||
#define _WARN___LOC__ __FILE__ "(" _WARN___STR1__(__LINE__) ") : Warning Msg: "
|
||||
#pragma message(_WARN___LOC__"Using deprecated NumPy API, disable it with " \
|
||||
"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION")
|
||||
#elif defined(__GNUC__)
|
||||
#warning "Using deprecated NumPy API, disable it with " \
|
||||
"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
|
||||
#endif
|
||||
/* TODO: How to do this warning message for other compilers? */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This header exists to collect all dangerous/deprecated NumPy API
|
||||
* as of NumPy 1.7.
|
||||
*
|
||||
* This is an attempt to remove bad API, the proliferation of macros,
|
||||
* and namespace pollution currently produced by the NumPy headers.
|
||||
*/
|
||||
|
||||
/* These array flags are deprecated as of NumPy 1.7 */
|
||||
#define NPY_CONTIGUOUS NPY_ARRAY_C_CONTIGUOUS
|
||||
#define NPY_FORTRAN NPY_ARRAY_F_CONTIGUOUS
|
||||
|
||||
/*
|
||||
* The consistent NPY_ARRAY_* names which don't pollute the NPY_*
|
||||
* namespace were added in NumPy 1.7.
|
||||
*
|
||||
* These versions of the carray flags are deprecated, but
|
||||
* probably should only be removed after two releases instead of one.
|
||||
*/
|
||||
#define NPY_C_CONTIGUOUS NPY_ARRAY_C_CONTIGUOUS
|
||||
#define NPY_F_CONTIGUOUS NPY_ARRAY_F_CONTIGUOUS
|
||||
#define NPY_OWNDATA NPY_ARRAY_OWNDATA
|
||||
#define NPY_FORCECAST NPY_ARRAY_FORCECAST
|
||||
#define NPY_ENSURECOPY NPY_ARRAY_ENSURECOPY
|
||||
#define NPY_ENSUREARRAY NPY_ARRAY_ENSUREARRAY
|
||||
#define NPY_ELEMENTSTRIDES NPY_ARRAY_ELEMENTSTRIDES
|
||||
#define NPY_ALIGNED NPY_ARRAY_ALIGNED
|
||||
#define NPY_NOTSWAPPED NPY_ARRAY_NOTSWAPPED
|
||||
#define NPY_WRITEABLE NPY_ARRAY_WRITEABLE
|
||||
#define NPY_UPDATEIFCOPY NPY_ARRAY_UPDATEIFCOPY
|
||||
#define NPY_BEHAVED NPY_ARRAY_BEHAVED
|
||||
#define NPY_BEHAVED_NS NPY_ARRAY_BEHAVED_NS
|
||||
#define NPY_CARRAY NPY_ARRAY_CARRAY
|
||||
#define NPY_CARRAY_RO NPY_ARRAY_CARRAY_RO
|
||||
#define NPY_FARRAY NPY_ARRAY_FARRAY
|
||||
#define NPY_FARRAY_RO NPY_ARRAY_FARRAY_RO
|
||||
#define NPY_DEFAULT NPY_ARRAY_DEFAULT
|
||||
#define NPY_IN_ARRAY NPY_ARRAY_IN_ARRAY
|
||||
#define NPY_OUT_ARRAY NPY_ARRAY_OUT_ARRAY
|
||||
#define NPY_INOUT_ARRAY NPY_ARRAY_INOUT_ARRAY
|
||||
#define NPY_IN_FARRAY NPY_ARRAY_IN_FARRAY
|
||||
#define NPY_OUT_FARRAY NPY_ARRAY_OUT_FARRAY
|
||||
#define NPY_INOUT_FARRAY NPY_ARRAY_INOUT_FARRAY
|
||||
#define NPY_UPDATE_ALL NPY_ARRAY_UPDATE_ALL
|
||||
|
||||
/* This way of accessing the default type is deprecated as of NumPy 1.7 */
|
||||
#define PyArray_DEFAULT NPY_DEFAULT_TYPE
|
||||
|
||||
/* These DATETIME bits aren't used internally */
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
#define PyDataType_GetDatetimeMetaData(descr) \
|
||||
((descr->metadata == NULL) ? NULL : \
|
||||
((PyArray_DatetimeMetaData *)(PyCapsule_GetPointer( \
|
||||
PyDict_GetItemString( \
|
||||
descr->metadata, NPY_METADATA_DTSTR), NULL))))
|
||||
#else
|
||||
#define PyDataType_GetDatetimeMetaData(descr) \
|
||||
((descr->metadata == NULL) ? NULL : \
|
||||
((PyArray_DatetimeMetaData *)(PyCObject_AsVoidPtr( \
|
||||
PyDict_GetItemString(descr->metadata, NPY_METADATA_DTSTR)))))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Deprecated as of NumPy 1.7, this kind of shortcut doesn't
|
||||
* belong in the public API.
|
||||
*/
|
||||
#define NPY_AO PyArrayObject
|
||||
|
||||
/*
|
||||
* Deprecated as of NumPy 1.7, an all-lowercase macro doesn't
|
||||
* belong in the public API.
|
||||
*/
|
||||
#define fortran fortran_
|
||||
|
||||
/*
|
||||
* Deprecated as of NumPy 1.7, as it is a namespace-polluting
|
||||
* macro.
|
||||
*/
|
||||
#define FORTRAN_IF PyArray_FORTRAN_IF
|
||||
|
||||
/* Deprecated as of NumPy 1.7, datetime64 uses c_metadata instead */
|
||||
#define NPY_METADATA_DTSTR "__timeunit__"
|
||||
|
||||
/*
|
||||
* Deprecated as of NumPy 1.7.
|
||||
* The reasoning:
|
||||
* - These are for datetime, but there's no datetime "namespace".
|
||||
* - They just turn NPY_STR_<x> into "<x>", which is just
|
||||
* making something simple be indirected.
|
||||
*/
|
||||
#define NPY_STR_Y "Y"
|
||||
#define NPY_STR_M "M"
|
||||
#define NPY_STR_W "W"
|
||||
#define NPY_STR_D "D"
|
||||
#define NPY_STR_h "h"
|
||||
#define NPY_STR_m "m"
|
||||
#define NPY_STR_s "s"
|
||||
#define NPY_STR_ms "ms"
|
||||
#define NPY_STR_us "us"
|
||||
#define NPY_STR_ns "ns"
|
||||
#define NPY_STR_ps "ps"
|
||||
#define NPY_STR_fs "fs"
|
||||
#define NPY_STR_as "as"
|
||||
|
||||
/*
|
||||
* The macros in old_defines.h are Deprecated as of NumPy 1.7 and will be
|
||||
* removed in the next major release.
|
||||
*/
|
||||
#include "old_defines.h"
|
||||
|
||||
#endif
|
@ -0,0 +1,577 @@
|
||||
/*
|
||||
* This is a convenience header file providing compatibility utilities
|
||||
* for supporting Python 2 and Python 3 in the same code base.
|
||||
*
|
||||
* If you want to use this for your own projects, it's recommended to make a
|
||||
* copy of it. Although the stuff below is unlikely to change, we don't provide
|
||||
* strong backwards compatibility guarantees at the moment.
|
||||
*/
|
||||
|
||||
#ifndef _NPY_3KCOMPAT_H_
|
||||
#define _NPY_3KCOMPAT_H_
|
||||
|
||||
#include <Python.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
#ifndef NPY_PY3K
|
||||
#define NPY_PY3K 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "numpy/npy_common.h"
|
||||
#include "numpy/ndarrayobject.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* PyInt -> PyLong
|
||||
*/
|
||||
|
||||
#if defined(NPY_PY3K)
|
||||
/* Return True only if the long fits in a C long */
|
||||
static NPY_INLINE int PyInt_Check(PyObject *op) {
|
||||
int overflow = 0;
|
||||
if (!PyLong_Check(op)) {
|
||||
return 0;
|
||||
}
|
||||
PyLong_AsLongAndOverflow(op, &overflow);
|
||||
return (overflow == 0);
|
||||
}
|
||||
|
||||
#define PyInt_FromLong PyLong_FromLong
|
||||
#define PyInt_AsLong PyLong_AsLong
|
||||
#define PyInt_AS_LONG PyLong_AsLong
|
||||
#define PyInt_AsSsize_t PyLong_AsSsize_t
|
||||
|
||||
/* NOTE:
|
||||
*
|
||||
* Since the PyLong type is very different from the fixed-range PyInt,
|
||||
* we don't define PyInt_Type -> PyLong_Type.
|
||||
*/
|
||||
#endif /* NPY_PY3K */
|
||||
|
||||
/* Py3 changes PySlice_GetIndicesEx' first argument's type to PyObject* */
|
||||
#ifdef NPY_PY3K
|
||||
# define NpySlice_GetIndicesEx PySlice_GetIndicesEx
|
||||
#else
|
||||
# define NpySlice_GetIndicesEx(op, nop, start, end, step, slicelength) \
|
||||
PySlice_GetIndicesEx((PySliceObject *)op, nop, start, end, step, slicelength)
|
||||
#endif
|
||||
|
||||
/* <2.7.11 and <3.4.4 have the wrong argument type for Py_EnterRecursiveCall */
|
||||
#if (PY_VERSION_HEX < 0x02070B00) || \
|
||||
((0x03000000 <= PY_VERSION_HEX) && (PY_VERSION_HEX < 0x03040400))
|
||||
#define Npy_EnterRecursiveCall(x) Py_EnterRecursiveCall((char *)(x))
|
||||
#else
|
||||
#define Npy_EnterRecursiveCall(x) Py_EnterRecursiveCall(x)
|
||||
#endif
|
||||
|
||||
/* Py_SETREF was added in 3.5.2, and only if Py_LIMITED_API is absent */
|
||||
#if PY_VERSION_HEX < 0x03050200
|
||||
#define Py_SETREF(op, op2) \
|
||||
do { \
|
||||
PyObject *_py_tmp = (PyObject *)(op); \
|
||||
(op) = (op2); \
|
||||
Py_DECREF(_py_tmp); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* PyString -> PyBytes
|
||||
*/
|
||||
|
||||
#if defined(NPY_PY3K)
|
||||
|
||||
#define PyString_Type PyBytes_Type
|
||||
#define PyString_Check PyBytes_Check
|
||||
#define PyStringObject PyBytesObject
|
||||
#define PyString_FromString PyBytes_FromString
|
||||
#define PyString_FromStringAndSize PyBytes_FromStringAndSize
|
||||
#define PyString_AS_STRING PyBytes_AS_STRING
|
||||
#define PyString_AsStringAndSize PyBytes_AsStringAndSize
|
||||
#define PyString_FromFormat PyBytes_FromFormat
|
||||
#define PyString_Concat PyBytes_Concat
|
||||
#define PyString_ConcatAndDel PyBytes_ConcatAndDel
|
||||
#define PyString_AsString PyBytes_AsString
|
||||
#define PyString_GET_SIZE PyBytes_GET_SIZE
|
||||
#define PyString_Size PyBytes_Size
|
||||
|
||||
#define PyUString_Type PyUnicode_Type
|
||||
#define PyUString_Check PyUnicode_Check
|
||||
#define PyUStringObject PyUnicodeObject
|
||||
#define PyUString_FromString PyUnicode_FromString
|
||||
#define PyUString_FromStringAndSize PyUnicode_FromStringAndSize
|
||||
#define PyUString_FromFormat PyUnicode_FromFormat
|
||||
#define PyUString_Concat PyUnicode_Concat2
|
||||
#define PyUString_ConcatAndDel PyUnicode_ConcatAndDel
|
||||
#define PyUString_GET_SIZE PyUnicode_GET_SIZE
|
||||
#define PyUString_Size PyUnicode_Size
|
||||
#define PyUString_InternFromString PyUnicode_InternFromString
|
||||
#define PyUString_Format PyUnicode_Format
|
||||
|
||||
#define PyBaseString_Check(obj) (PyUnicode_Check(obj))
|
||||
|
||||
#else
|
||||
|
||||
#define PyBytes_Type PyString_Type
|
||||
#define PyBytes_Check PyString_Check
|
||||
#define PyBytesObject PyStringObject
|
||||
#define PyBytes_FromString PyString_FromString
|
||||
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
|
||||
#define PyBytes_AS_STRING PyString_AS_STRING
|
||||
#define PyBytes_AsStringAndSize PyString_AsStringAndSize
|
||||
#define PyBytes_FromFormat PyString_FromFormat
|
||||
#define PyBytes_Concat PyString_Concat
|
||||
#define PyBytes_ConcatAndDel PyString_ConcatAndDel
|
||||
#define PyBytes_AsString PyString_AsString
|
||||
#define PyBytes_GET_SIZE PyString_GET_SIZE
|
||||
#define PyBytes_Size PyString_Size
|
||||
|
||||
#define PyUString_Type PyString_Type
|
||||
#define PyUString_Check PyString_Check
|
||||
#define PyUStringObject PyStringObject
|
||||
#define PyUString_FromString PyString_FromString
|
||||
#define PyUString_FromStringAndSize PyString_FromStringAndSize
|
||||
#define PyUString_FromFormat PyString_FromFormat
|
||||
#define PyUString_Concat PyString_Concat
|
||||
#define PyUString_ConcatAndDel PyString_ConcatAndDel
|
||||
#define PyUString_GET_SIZE PyString_GET_SIZE
|
||||
#define PyUString_Size PyString_Size
|
||||
#define PyUString_InternFromString PyString_InternFromString
|
||||
#define PyUString_Format PyString_Format
|
||||
|
||||
#define PyBaseString_Check(obj) (PyBytes_Check(obj) || PyUnicode_Check(obj))
|
||||
|
||||
#endif /* NPY_PY3K */
|
||||
|
||||
|
||||
static NPY_INLINE void
|
||||
PyUnicode_ConcatAndDel(PyObject **left, PyObject *right)
|
||||
{
|
||||
Py_SETREF(*left, PyUnicode_Concat(*left, right));
|
||||
Py_DECREF(right);
|
||||
}
|
||||
|
||||
static NPY_INLINE void
|
||||
PyUnicode_Concat2(PyObject **left, PyObject *right)
|
||||
{
|
||||
Py_SETREF(*left, PyUnicode_Concat(*left, right));
|
||||
}
|
||||
|
||||
/*
|
||||
* PyFile_* compatibility
|
||||
*/
|
||||
|
||||
/*
|
||||
* Get a FILE* handle to the file represented by the Python object
|
||||
*/
|
||||
static NPY_INLINE FILE*
|
||||
npy_PyFile_Dup2(PyObject *file, char *mode, npy_off_t *orig_pos)
|
||||
{
|
||||
int fd, fd2, unbuf;
|
||||
PyObject *ret, *os, *io, *io_raw;
|
||||
npy_off_t pos;
|
||||
FILE *handle;
|
||||
|
||||
/* For Python 2 PyFileObject, use PyFile_AsFile */
|
||||
#if !defined(NPY_PY3K)
|
||||
if (PyFile_Check(file)) {
|
||||
return PyFile_AsFile(file);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Flush first to ensure things end up in the file in the correct order */
|
||||
ret = PyObject_CallMethod(file, "flush", "");
|
||||
if (ret == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
Py_DECREF(ret);
|
||||
fd = PyObject_AsFileDescriptor(file);
|
||||
if (fd == -1) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* The handle needs to be dup'd because we have to call fclose
|
||||
* at the end
|
||||
*/
|
||||
os = PyImport_ImportModule("os");
|
||||
if (os == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
ret = PyObject_CallMethod(os, "dup", "i", fd);
|
||||
Py_DECREF(os);
|
||||
if (ret == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
fd2 = PyNumber_AsSsize_t(ret, NULL);
|
||||
Py_DECREF(ret);
|
||||
|
||||
/* Convert to FILE* handle */
|
||||
#ifdef _WIN32
|
||||
handle = _fdopen(fd2, mode);
|
||||
#else
|
||||
handle = fdopen(fd2, mode);
|
||||
#endif
|
||||
if (handle == NULL) {
|
||||
PyErr_SetString(PyExc_IOError,
|
||||
"Getting a FILE* from a Python file object failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Record the original raw file handle position */
|
||||
*orig_pos = npy_ftell(handle);
|
||||
if (*orig_pos == -1) {
|
||||
/* The io module is needed to determine if buffering is used */
|
||||
io = PyImport_ImportModule("io");
|
||||
if (io == NULL) {
|
||||
fclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
/* File object instances of RawIOBase are unbuffered */
|
||||
io_raw = PyObject_GetAttrString(io, "RawIOBase");
|
||||
Py_DECREF(io);
|
||||
if (io_raw == NULL) {
|
||||
fclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
unbuf = PyObject_IsInstance(file, io_raw);
|
||||
Py_DECREF(io_raw);
|
||||
if (unbuf == 1) {
|
||||
/* Succeed if the IO is unbuffered */
|
||||
return handle;
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_IOError, "obtaining file position failed");
|
||||
fclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Seek raw handle to the Python-side position */
|
||||
ret = PyObject_CallMethod(file, "tell", "");
|
||||
if (ret == NULL) {
|
||||
fclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
pos = PyLong_AsLongLong(ret);
|
||||
Py_DECREF(ret);
|
||||
if (PyErr_Occurred()) {
|
||||
fclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
if (npy_fseek(handle, pos, SEEK_SET) == -1) {
|
||||
PyErr_SetString(PyExc_IOError, "seeking file failed");
|
||||
fclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
return handle;
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the dup-ed file handle, and seek the Python one to the current position
|
||||
*/
|
||||
static NPY_INLINE int
|
||||
npy_PyFile_DupClose2(PyObject *file, FILE* handle, npy_off_t orig_pos)
|
||||
{
|
||||
int fd, unbuf;
|
||||
PyObject *ret, *io, *io_raw;
|
||||
npy_off_t position;
|
||||
|
||||
/* For Python 2 PyFileObject, do nothing */
|
||||
#if !defined(NPY_PY3K)
|
||||
if (PyFile_Check(file)) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
position = npy_ftell(handle);
|
||||
|
||||
/* Close the FILE* handle */
|
||||
fclose(handle);
|
||||
|
||||
/*
|
||||
* Restore original file handle position, in order to not confuse
|
||||
* Python-side data structures
|
||||
*/
|
||||
fd = PyObject_AsFileDescriptor(file);
|
||||
if (fd == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (npy_lseek(fd, orig_pos, SEEK_SET) == -1) {
|
||||
|
||||
/* The io module is needed to determine if buffering is used */
|
||||
io = PyImport_ImportModule("io");
|
||||
if (io == NULL) {
|
||||
return -1;
|
||||
}
|
||||
/* File object instances of RawIOBase are unbuffered */
|
||||
io_raw = PyObject_GetAttrString(io, "RawIOBase");
|
||||
Py_DECREF(io);
|
||||
if (io_raw == NULL) {
|
||||
return -1;
|
||||
}
|
||||
unbuf = PyObject_IsInstance(file, io_raw);
|
||||
Py_DECREF(io_raw);
|
||||
if (unbuf == 1) {
|
||||
/* Succeed if the IO is unbuffered */
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_IOError, "seeking file failed");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (position == -1) {
|
||||
PyErr_SetString(PyExc_IOError, "obtaining file position failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Seek Python-side handle to the FILE* handle position */
|
||||
ret = PyObject_CallMethod(file, "seek", NPY_OFF_T_PYFMT "i", position, 0);
|
||||
if (ret == NULL) {
|
||||
return -1;
|
||||
}
|
||||
Py_DECREF(ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static NPY_INLINE int
|
||||
npy_PyFile_Check(PyObject *file)
|
||||
{
|
||||
int fd;
|
||||
/* For Python 2, check if it is a PyFileObject */
|
||||
#if !defined(NPY_PY3K)
|
||||
if (PyFile_Check(file)) {
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
fd = PyObject_AsFileDescriptor(file);
|
||||
if (fd == -1) {
|
||||
PyErr_Clear();
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static NPY_INLINE PyObject*
|
||||
npy_PyFile_OpenFile(PyObject *filename, const char *mode)
|
||||
{
|
||||
PyObject *open;
|
||||
open = PyDict_GetItemString(PyEval_GetBuiltins(), "open");
|
||||
if (open == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return PyObject_CallFunction(open, "Os", filename, mode);
|
||||
}
|
||||
|
||||
static NPY_INLINE int
|
||||
npy_PyFile_CloseFile(PyObject *file)
|
||||
{
|
||||
PyObject *ret;
|
||||
|
||||
ret = PyObject_CallMethod(file, "close", NULL);
|
||||
if (ret == NULL) {
|
||||
return -1;
|
||||
}
|
||||
Py_DECREF(ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* This is a copy of _PyErr_ChainExceptions
|
||||
*/
|
||||
static NPY_INLINE void
|
||||
npy_PyErr_ChainExceptions(PyObject *exc, PyObject *val, PyObject *tb)
|
||||
{
|
||||
if (exc == NULL)
|
||||
return;
|
||||
|
||||
if (PyErr_Occurred()) {
|
||||
/* only py3 supports this anyway */
|
||||
#ifdef NPY_PY3K
|
||||
PyObject *exc2, *val2, *tb2;
|
||||
PyErr_Fetch(&exc2, &val2, &tb2);
|
||||
PyErr_NormalizeException(&exc, &val, &tb);
|
||||
if (tb != NULL) {
|
||||
PyException_SetTraceback(val, tb);
|
||||
Py_DECREF(tb);
|
||||
}
|
||||
Py_DECREF(exc);
|
||||
PyErr_NormalizeException(&exc2, &val2, &tb2);
|
||||
PyException_SetContext(val2, val);
|
||||
PyErr_Restore(exc2, val2, tb2);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
PyErr_Restore(exc, val, tb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This is a copy of _PyErr_ChainExceptions, with:
|
||||
* - a minimal implementation for python 2
|
||||
* - __cause__ used instead of __context__
|
||||
*/
|
||||
static NPY_INLINE void
|
||||
npy_PyErr_ChainExceptionsCause(PyObject *exc, PyObject *val, PyObject *tb)
|
||||
{
|
||||
if (exc == NULL)
|
||||
return;
|
||||
|
||||
if (PyErr_Occurred()) {
|
||||
/* only py3 supports this anyway */
|
||||
#ifdef NPY_PY3K
|
||||
PyObject *exc2, *val2, *tb2;
|
||||
PyErr_Fetch(&exc2, &val2, &tb2);
|
||||
PyErr_NormalizeException(&exc, &val, &tb);
|
||||
if (tb != NULL) {
|
||||
PyException_SetTraceback(val, tb);
|
||||
Py_DECREF(tb);
|
||||
}
|
||||
Py_DECREF(exc);
|
||||
PyErr_NormalizeException(&exc2, &val2, &tb2);
|
||||
PyException_SetCause(val2, val);
|
||||
PyErr_Restore(exc2, val2, tb2);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
PyErr_Restore(exc, val, tb);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* PyObject_Cmp
|
||||
*/
|
||||
#if defined(NPY_PY3K)
|
||||
static NPY_INLINE int
|
||||
PyObject_Cmp(PyObject *i1, PyObject *i2, int *cmp)
|
||||
{
|
||||
int v;
|
||||
v = PyObject_RichCompareBool(i1, i2, Py_LT);
|
||||
if (v == 1) {
|
||||
*cmp = -1;
|
||||
return 1;
|
||||
}
|
||||
else if (v == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
v = PyObject_RichCompareBool(i1, i2, Py_GT);
|
||||
if (v == 1) {
|
||||
*cmp = 1;
|
||||
return 1;
|
||||
}
|
||||
else if (v == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
v = PyObject_RichCompareBool(i1, i2, Py_EQ);
|
||||
if (v == 1) {
|
||||
*cmp = 0;
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
*cmp = 0;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* PyCObject functions adapted to PyCapsules.
|
||||
*
|
||||
* The main job here is to get rid of the improved error handling
|
||||
* of PyCapsules. It's a shame...
|
||||
*/
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
|
||||
static NPY_INLINE PyObject *
|
||||
NpyCapsule_FromVoidPtr(void *ptr, void (*dtor)(PyObject *))
|
||||
{
|
||||
PyObject *ret = PyCapsule_New(ptr, NULL, dtor);
|
||||
if (ret == NULL) {
|
||||
PyErr_Clear();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static NPY_INLINE PyObject *
|
||||
NpyCapsule_FromVoidPtrAndDesc(void *ptr, void* context, void (*dtor)(PyObject *))
|
||||
{
|
||||
PyObject *ret = NpyCapsule_FromVoidPtr(ptr, dtor);
|
||||
if (ret != NULL && PyCapsule_SetContext(ret, context) != 0) {
|
||||
PyErr_Clear();
|
||||
Py_DECREF(ret);
|
||||
ret = NULL;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static NPY_INLINE void *
|
||||
NpyCapsule_AsVoidPtr(PyObject *obj)
|
||||
{
|
||||
void *ret = PyCapsule_GetPointer(obj, NULL);
|
||||
if (ret == NULL) {
|
||||
PyErr_Clear();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static NPY_INLINE void *
|
||||
NpyCapsule_GetDesc(PyObject *obj)
|
||||
{
|
||||
return PyCapsule_GetContext(obj);
|
||||
}
|
||||
|
||||
static NPY_INLINE int
|
||||
NpyCapsule_Check(PyObject *ptr)
|
||||
{
|
||||
return PyCapsule_CheckExact(ptr);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static NPY_INLINE PyObject *
|
||||
NpyCapsule_FromVoidPtr(void *ptr, void (*dtor)(void *))
|
||||
{
|
||||
return PyCObject_FromVoidPtr(ptr, dtor);
|
||||
}
|
||||
|
||||
static NPY_INLINE PyObject *
|
||||
NpyCapsule_FromVoidPtrAndDesc(void *ptr, void* context,
|
||||
void (*dtor)(void *, void *))
|
||||
{
|
||||
return PyCObject_FromVoidPtrAndDesc(ptr, context, dtor);
|
||||
}
|
||||
|
||||
static NPY_INLINE void *
|
||||
NpyCapsule_AsVoidPtr(PyObject *ptr)
|
||||
{
|
||||
return PyCObject_AsVoidPtr(ptr);
|
||||
}
|
||||
|
||||
static NPY_INLINE void *
|
||||
NpyCapsule_GetDesc(PyObject *obj)
|
||||
{
|
||||
return PyCObject_GetDesc(obj);
|
||||
}
|
||||
|
||||
static NPY_INLINE int
|
||||
NpyCapsule_Check(PyObject *ptr)
|
||||
{
|
||||
return PyCObject_Check(ptr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _NPY_3KCOMPAT_H_ */
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* This set (target) cpu specific macros:
|
||||
* - Possible values:
|
||||
* NPY_CPU_X86
|
||||
* NPY_CPU_AMD64
|
||||
* NPY_CPU_PPC
|
||||
* NPY_CPU_PPC64
|
||||
* NPY_CPU_PPC64LE
|
||||
* NPY_CPU_SPARC
|
||||
* NPY_CPU_S390
|
||||
* NPY_CPU_IA64
|
||||
* NPY_CPU_HPPA
|
||||
* NPY_CPU_ALPHA
|
||||
* NPY_CPU_ARMEL
|
||||
* NPY_CPU_ARMEB
|
||||
* NPY_CPU_SH_LE
|
||||
* NPY_CPU_SH_BE
|
||||
* NPY_CPU_ARCEL
|
||||
* NPY_CPU_ARCEB
|
||||
* NPY_CPU_RISCV64
|
||||
*/
|
||||
#ifndef _NPY_CPUARCH_H_
|
||||
#define _NPY_CPUARCH_H_
|
||||
|
||||
#include "numpyconfig.h"
|
||||
#include <string.h> /* for memcpy */
|
||||
|
||||
#if defined( __i386__ ) || defined(i386) || defined(_M_IX86)
|
||||
/*
|
||||
* __i386__ is defined by gcc and Intel compiler on Linux,
|
||||
* _M_IX86 by VS compiler,
|
||||
* i386 by Sun compilers on opensolaris at least
|
||||
*/
|
||||
#define NPY_CPU_X86
|
||||
#elif defined(__x86_64__) || defined(__amd64__) || defined(__x86_64) || defined(_M_AMD64)
|
||||
/*
|
||||
* both __x86_64__ and __amd64__ are defined by gcc
|
||||
* __x86_64 defined by sun compiler on opensolaris at least
|
||||
* _M_AMD64 defined by MS compiler
|
||||
*/
|
||||
#define NPY_CPU_AMD64
|
||||
#elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)
|
||||
#define NPY_CPU_PPC64LE
|
||||
#elif defined(__powerpc64__) && defined(__BIG_ENDIAN__)
|
||||
#define NPY_CPU_PPC64
|
||||
#elif defined(__ppc__) || defined(__powerpc__) || defined(_ARCH_PPC)
|
||||
/*
|
||||
* __ppc__ is defined by gcc, I remember having seen __powerpc__ once,
|
||||
* but can't find it ATM
|
||||
* _ARCH_PPC is used by at least gcc on AIX
|
||||
* As __powerpc__ and _ARCH_PPC are also defined by PPC64 check
|
||||
* for those specifically first before defaulting to ppc
|
||||
*/
|
||||
#define NPY_CPU_PPC
|
||||
#elif defined(__sparc__) || defined(__sparc)
|
||||
/* __sparc__ is defined by gcc and Forte (e.g. Sun) compilers */
|
||||
#define NPY_CPU_SPARC
|
||||
#elif defined(__s390__)
|
||||
#define NPY_CPU_S390
|
||||
#elif defined(__ia64)
|
||||
#define NPY_CPU_IA64
|
||||
#elif defined(__hppa)
|
||||
#define NPY_CPU_HPPA
|
||||
#elif defined(__alpha__)
|
||||
#define NPY_CPU_ALPHA
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
#if defined(__ARMEB__) || defined(__AARCH64EB__)
|
||||
#if defined(__ARM_32BIT_STATE)
|
||||
#define NPY_CPU_ARMEB_AARCH32
|
||||
#elif defined(__ARM_64BIT_STATE)
|
||||
#define NPY_CPU_ARMEB_AARCH64
|
||||
#else
|
||||
#define NPY_CPU_ARMEB
|
||||
#endif
|
||||
#elif defined(__ARMEL__) || defined(__AARCH64EL__)
|
||||
#if defined(__ARM_32BIT_STATE)
|
||||
#define NPY_CPU_ARMEL_AARCH32
|
||||
#elif defined(__ARM_64BIT_STATE)
|
||||
#define NPY_CPU_ARMEL_AARCH64
|
||||
#else
|
||||
#define NPY_CPU_ARMEL
|
||||
#endif
|
||||
#else
|
||||
# error Unknown ARM CPU, please report this to numpy maintainers with \
|
||||
information about your platform (OS, CPU and compiler)
|
||||
#endif
|
||||
#elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
|
||||
#define NPY_CPU_SH_LE
|
||||
#elif defined(__sh__) && defined(__BIG_ENDIAN__)
|
||||
#define NPY_CPU_SH_BE
|
||||
#elif defined(__MIPSEL__)
|
||||
#define NPY_CPU_MIPSEL
|
||||
#elif defined(__MIPSEB__)
|
||||
#define NPY_CPU_MIPSEB
|
||||
#elif defined(__or1k__)
|
||||
#define NPY_CPU_OR1K
|
||||
#elif defined(__mc68000__)
|
||||
#define NPY_CPU_M68K
|
||||
#elif defined(__arc__) && defined(__LITTLE_ENDIAN__)
|
||||
#define NPY_CPU_ARCEL
|
||||
#elif defined(__arc__) && defined(__BIG_ENDIAN__)
|
||||
#define NPY_CPU_ARCEB
|
||||
#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
|
||||
#define NPY_CPU_RISCV64
|
||||
#else
|
||||
#error Unknown CPU, please report this to numpy maintainers with \
|
||||
information about your platform (OS, CPU and compiler)
|
||||
#endif
|
||||
|
||||
#define NPY_COPY_PYOBJECT_PTR(dst, src) memcpy(dst, src, sizeof(PyObject *))
|
||||
|
||||
#if (defined(NPY_CPU_X86) || defined(NPY_CPU_AMD64))
|
||||
#define NPY_CPU_HAVE_UNALIGNED_ACCESS 1
|
||||
#else
|
||||
#define NPY_CPU_HAVE_UNALIGNED_ACCESS 0
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,72 @@
|
||||
#ifndef _NPY_ENDIAN_H_
|
||||
#define _NPY_ENDIAN_H_
|
||||
|
||||
/*
|
||||
* NPY_BYTE_ORDER is set to the same value as BYTE_ORDER set by glibc in
|
||||
* endian.h
|
||||
*/
|
||||
|
||||
#if defined(NPY_HAVE_ENDIAN_H) || defined(NPY_HAVE_SYS_ENDIAN_H)
|
||||
/* Use endian.h if available */
|
||||
|
||||
#if defined(NPY_HAVE_ENDIAN_H)
|
||||
#include <endian.h>
|
||||
#elif defined(NPY_HAVE_SYS_ENDIAN_H)
|
||||
#include <sys/endian.h>
|
||||
#endif
|
||||
|
||||
#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && defined(LITTLE_ENDIAN)
|
||||
#define NPY_BYTE_ORDER BYTE_ORDER
|
||||
#define NPY_LITTLE_ENDIAN LITTLE_ENDIAN
|
||||
#define NPY_BIG_ENDIAN BIG_ENDIAN
|
||||
#elif defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN)
|
||||
#define NPY_BYTE_ORDER _BYTE_ORDER
|
||||
#define NPY_LITTLE_ENDIAN _LITTLE_ENDIAN
|
||||
#define NPY_BIG_ENDIAN _BIG_ENDIAN
|
||||
#elif defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN)
|
||||
#define NPY_BYTE_ORDER __BYTE_ORDER
|
||||
#define NPY_LITTLE_ENDIAN __LITTLE_ENDIAN
|
||||
#define NPY_BIG_ENDIAN __BIG_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NPY_BYTE_ORDER
|
||||
/* Set endianness info using target CPU */
|
||||
#include "npy_cpu.h"
|
||||
|
||||
#define NPY_LITTLE_ENDIAN 1234
|
||||
#define NPY_BIG_ENDIAN 4321
|
||||
|
||||
#if defined(NPY_CPU_X86) \
|
||||
|| defined(NPY_CPU_AMD64) \
|
||||
|| defined(NPY_CPU_IA64) \
|
||||
|| defined(NPY_CPU_ALPHA) \
|
||||
|| defined(NPY_CPU_ARMEL) \
|
||||
|| defined(NPY_CPU_ARMEL_AARCH32) \
|
||||
|| defined(NPY_CPU_ARMEL_AARCH64) \
|
||||
|| defined(NPY_CPU_SH_LE) \
|
||||
|| defined(NPY_CPU_MIPSEL) \
|
||||
|| defined(NPY_CPU_PPC64LE) \
|
||||
|| defined(NPY_CPU_ARCEL) \
|
||||
|| defined(NPY_CPU_RISCV64)
|
||||
#define NPY_BYTE_ORDER NPY_LITTLE_ENDIAN
|
||||
#elif defined(NPY_CPU_PPC) \
|
||||
|| defined(NPY_CPU_SPARC) \
|
||||
|| defined(NPY_CPU_S390) \
|
||||
|| defined(NPY_CPU_HPPA) \
|
||||
|| defined(NPY_CPU_PPC64) \
|
||||
|| defined(NPY_CPU_ARMEB) \
|
||||
|| defined(NPY_CPU_ARMEB_AARCH32) \
|
||||
|| defined(NPY_CPU_ARMEB_AARCH64) \
|
||||
|| defined(NPY_CPU_SH_BE) \
|
||||
|| defined(NPY_CPU_MIPSEB) \
|
||||
|| defined(NPY_CPU_OR1K) \
|
||||
|| defined(NPY_CPU_M68K) \
|
||||
|| defined(NPY_CPU_ARCEB)
|
||||
#define NPY_BYTE_ORDER NPY_BIG_ENDIAN
|
||||
#else
|
||||
#error Unknown CPU: can not set endianness
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,117 @@
|
||||
|
||||
/* Signal handling:
|
||||
|
||||
This header file defines macros that allow your code to handle
|
||||
interrupts received during processing. Interrupts that
|
||||
could reasonably be handled:
|
||||
|
||||
SIGINT, SIGABRT, SIGALRM, SIGSEGV
|
||||
|
||||
****Warning***************
|
||||
|
||||
Do not allow code that creates temporary memory or increases reference
|
||||
counts of Python objects to be interrupted unless you handle it
|
||||
differently.
|
||||
|
||||
**************************
|
||||
|
||||
The mechanism for handling interrupts is conceptually simple:
|
||||
|
||||
- replace the signal handler with our own home-grown version
|
||||
and store the old one.
|
||||
- run the code to be interrupted -- if an interrupt occurs
|
||||
the handler should basically just cause a return to the
|
||||
calling function for finish work.
|
||||
- restore the old signal handler
|
||||
|
||||
Of course, every code that allows interrupts must account for
|
||||
returning via the interrupt and handle clean-up correctly. But,
|
||||
even still, the simple paradigm is complicated by at least three
|
||||
factors.
|
||||
|
||||
1) platform portability (i.e. Microsoft says not to use longjmp
|
||||
to return from signal handling. They have a __try and __except
|
||||
extension to C instead but what about mingw?).
|
||||
|
||||
2) how to handle threads: apparently whether signals are delivered to
|
||||
every thread of the process or the "invoking" thread is platform
|
||||
dependent. --- we don't handle threads for now.
|
||||
|
||||
3) do we need to worry about re-entrance. For now, assume the
|
||||
code will not call-back into itself.
|
||||
|
||||
Ideas:
|
||||
|
||||
1) Start by implementing an approach that works on platforms that
|
||||
can use setjmp and longjmp functionality and does nothing
|
||||
on other platforms.
|
||||
|
||||
2) Ignore threads --- i.e. do not mix interrupt handling and threads
|
||||
|
||||
3) Add a default signal_handler function to the C-API but have the rest
|
||||
use macros.
|
||||
|
||||
|
||||
Simple Interface:
|
||||
|
||||
|
||||
In your C-extension: around a block of code you want to be interruptible
|
||||
with a SIGINT
|
||||
|
||||
NPY_SIGINT_ON
|
||||
[code]
|
||||
NPY_SIGINT_OFF
|
||||
|
||||
In order for this to work correctly, the
|
||||
[code] block must not allocate any memory or alter the reference count of any
|
||||
Python objects. In other words [code] must be interruptible so that continuation
|
||||
after NPY_SIGINT_OFF will only be "missing some computations"
|
||||
|
||||
Interrupt handling does not work well with threads.
|
||||
|
||||
*/
|
||||
|
||||
/* Add signal handling macros
|
||||
Make the global variable and signal handler part of the C-API
|
||||
*/
|
||||
|
||||
#ifndef NPY_INTERRUPT_H
|
||||
#define NPY_INTERRUPT_H
|
||||
|
||||
#ifndef NPY_NO_SIGNAL
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifndef sigsetjmp
|
||||
|
||||
#define NPY_SIGSETJMP(arg1, arg2) setjmp(arg1)
|
||||
#define NPY_SIGLONGJMP(arg1, arg2) longjmp(arg1, arg2)
|
||||
#define NPY_SIGJMP_BUF jmp_buf
|
||||
|
||||
#else
|
||||
|
||||
#define NPY_SIGSETJMP(arg1, arg2) sigsetjmp(arg1, arg2)
|
||||
#define NPY_SIGLONGJMP(arg1, arg2) siglongjmp(arg1, arg2)
|
||||
#define NPY_SIGJMP_BUF sigjmp_buf
|
||||
|
||||
#endif
|
||||
|
||||
# define NPY_SIGINT_ON { \
|
||||
PyOS_sighandler_t _npy_sig_save; \
|
||||
_npy_sig_save = PyOS_setsig(SIGINT, _PyArray_SigintHandler); \
|
||||
if (NPY_SIGSETJMP(*((NPY_SIGJMP_BUF *)_PyArray_GetSigintBuf()), \
|
||||
1) == 0) { \
|
||||
|
||||
# define NPY_SIGINT_OFF } \
|
||||
PyOS_setsig(SIGINT, _npy_sig_save); \
|
||||
}
|
||||
|
||||
#else /* NPY_NO_SIGNAL */
|
||||
|
||||
#define NPY_SIGINT_ON
|
||||
#define NPY_SIGINT_OFF
|
||||
|
||||
#endif /* HAVE_SIGSETJMP */
|
||||
|
||||
#endif /* NPY_INTERRUPT_H */
|
@ -0,0 +1,600 @@
|
||||
#ifndef __NPY_MATH_C99_H_
|
||||
#define __NPY_MATH_C99_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#ifdef __SUNPRO_CC
|
||||
#include <sunmath.h>
|
||||
#endif
|
||||
#ifdef HAVE_NPY_CONFIG_H
|
||||
#include <npy_config.h>
|
||||
#endif
|
||||
#include <numpy/npy_common.h>
|
||||
|
||||
/* By adding static inline specifiers to npy_math function definitions when
|
||||
appropriate, compiler is given the opportunity to optimize */
|
||||
#if NPY_INLINE_MATH
|
||||
#define NPY_INPLACE NPY_INLINE static
|
||||
#else
|
||||
#define NPY_INPLACE
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* NAN and INFINITY like macros (same behavior as glibc for NAN, same as C99
|
||||
* for INFINITY)
|
||||
*
|
||||
* XXX: I should test whether INFINITY and NAN are available on the platform
|
||||
*/
|
||||
NPY_INLINE static float __npy_inff(void)
|
||||
{
|
||||
const union { npy_uint32 __i; float __f;} __bint = {0x7f800000UL};
|
||||
return __bint.__f;
|
||||
}
|
||||
|
||||
NPY_INLINE static float __npy_nanf(void)
|
||||
{
|
||||
const union { npy_uint32 __i; float __f;} __bint = {0x7fc00000UL};
|
||||
return __bint.__f;
|
||||
}
|
||||
|
||||
NPY_INLINE static float __npy_pzerof(void)
|
||||
{
|
||||
const union { npy_uint32 __i; float __f;} __bint = {0x00000000UL};
|
||||
return __bint.__f;
|
||||
}
|
||||
|
||||
NPY_INLINE static float __npy_nzerof(void)
|
||||
{
|
||||
const union { npy_uint32 __i; float __f;} __bint = {0x80000000UL};
|
||||
return __bint.__f;
|
||||
}
|
||||
|
||||
#define NPY_INFINITYF __npy_inff()
|
||||
#define NPY_NANF __npy_nanf()
|
||||
#define NPY_PZEROF __npy_pzerof()
|
||||
#define NPY_NZEROF __npy_nzerof()
|
||||
|
||||
#define NPY_INFINITY ((npy_double)NPY_INFINITYF)
|
||||
#define NPY_NAN ((npy_double)NPY_NANF)
|
||||
#define NPY_PZERO ((npy_double)NPY_PZEROF)
|
||||
#define NPY_NZERO ((npy_double)NPY_NZEROF)
|
||||
|
||||
#define NPY_INFINITYL ((npy_longdouble)NPY_INFINITYF)
|
||||
#define NPY_NANL ((npy_longdouble)NPY_NANF)
|
||||
#define NPY_PZEROL ((npy_longdouble)NPY_PZEROF)
|
||||
#define NPY_NZEROL ((npy_longdouble)NPY_NZEROF)
|
||||
|
||||
/*
|
||||
* Useful constants
|
||||
*/
|
||||
#define NPY_E 2.718281828459045235360287471352662498 /* e */
|
||||
#define NPY_LOG2E 1.442695040888963407359924681001892137 /* log_2 e */
|
||||
#define NPY_LOG10E 0.434294481903251827651128918916605082 /* log_10 e */
|
||||
#define NPY_LOGE2 0.693147180559945309417232121458176568 /* log_e 2 */
|
||||
#define NPY_LOGE10 2.302585092994045684017991454684364208 /* log_e 10 */
|
||||
#define NPY_PI 3.141592653589793238462643383279502884 /* pi */
|
||||
#define NPY_PI_2 1.570796326794896619231321691639751442 /* pi/2 */
|
||||
#define NPY_PI_4 0.785398163397448309615660845819875721 /* pi/4 */
|
||||
#define NPY_1_PI 0.318309886183790671537767526745028724 /* 1/pi */
|
||||
#define NPY_2_PI 0.636619772367581343075535053490057448 /* 2/pi */
|
||||
#define NPY_EULER 0.577215664901532860606512090082402431 /* Euler constant */
|
||||
#define NPY_SQRT2 1.414213562373095048801688724209698079 /* sqrt(2) */
|
||||
#define NPY_SQRT1_2 0.707106781186547524400844362104849039 /* 1/sqrt(2) */
|
||||
|
||||
#define NPY_Ef 2.718281828459045235360287471352662498F /* e */
|
||||
#define NPY_LOG2Ef 1.442695040888963407359924681001892137F /* log_2 e */
|
||||
#define NPY_LOG10Ef 0.434294481903251827651128918916605082F /* log_10 e */
|
||||
#define NPY_LOGE2f 0.693147180559945309417232121458176568F /* log_e 2 */
|
||||
#define NPY_LOGE10f 2.302585092994045684017991454684364208F /* log_e 10 */
|
||||
#define NPY_PIf 3.141592653589793238462643383279502884F /* pi */
|
||||
#define NPY_PI_2f 1.570796326794896619231321691639751442F /* pi/2 */
|
||||
#define NPY_PI_4f 0.785398163397448309615660845819875721F /* pi/4 */
|
||||
#define NPY_1_PIf 0.318309886183790671537767526745028724F /* 1/pi */
|
||||
#define NPY_2_PIf 0.636619772367581343075535053490057448F /* 2/pi */
|
||||
#define NPY_EULERf 0.577215664901532860606512090082402431F /* Euler constant */
|
||||
#define NPY_SQRT2f 1.414213562373095048801688724209698079F /* sqrt(2) */
|
||||
#define NPY_SQRT1_2f 0.707106781186547524400844362104849039F /* 1/sqrt(2) */
|
||||
|
||||
#define NPY_El 2.718281828459045235360287471352662498L /* e */
|
||||
#define NPY_LOG2El 1.442695040888963407359924681001892137L /* log_2 e */
|
||||
#define NPY_LOG10El 0.434294481903251827651128918916605082L /* log_10 e */
|
||||
#define NPY_LOGE2l 0.693147180559945309417232121458176568L /* log_e 2 */
|
||||
#define NPY_LOGE10l 2.302585092994045684017991454684364208L /* log_e 10 */
|
||||
#define NPY_PIl 3.141592653589793238462643383279502884L /* pi */
|
||||
#define NPY_PI_2l 1.570796326794896619231321691639751442L /* pi/2 */
|
||||
#define NPY_PI_4l 0.785398163397448309615660845819875721L /* pi/4 */
|
||||
#define NPY_1_PIl 0.318309886183790671537767526745028724L /* 1/pi */
|
||||
#define NPY_2_PIl 0.636619772367581343075535053490057448L /* 2/pi */
|
||||
#define NPY_EULERl 0.577215664901532860606512090082402431L /* Euler constant */
|
||||
#define NPY_SQRT2l 1.414213562373095048801688724209698079L /* sqrt(2) */
|
||||
#define NPY_SQRT1_2l 0.707106781186547524400844362104849039L /* 1/sqrt(2) */
|
||||
|
||||
/*
|
||||
* Constants used in vector implementation of exp(x)
|
||||
*/
|
||||
#define NPY_RINT_CVT_MAGICf 0x1.800000p+23f
|
||||
#define NPY_CODY_WAITE_LOGE_2_HIGHf -6.93145752e-1f
|
||||
#define NPY_CODY_WAITE_LOGE_2_LOWf -1.42860677e-6f
|
||||
#define NPY_COEFF_P0_EXPf 9.999999999980870924916e-01f
|
||||
#define NPY_COEFF_P1_EXPf 7.257664613233124478488e-01f
|
||||
#define NPY_COEFF_P2_EXPf 2.473615434895520810817e-01f
|
||||
#define NPY_COEFF_P3_EXPf 5.114512081637298353406e-02f
|
||||
#define NPY_COEFF_P4_EXPf 6.757896990527504603057e-03f
|
||||
#define NPY_COEFF_P5_EXPf 5.082762527590693718096e-04f
|
||||
#define NPY_COEFF_Q0_EXPf 1.000000000000000000000e+00f
|
||||
#define NPY_COEFF_Q1_EXPf -2.742335390411667452936e-01f
|
||||
#define NPY_COEFF_Q2_EXPf 2.159509375685829852307e-02f
|
||||
|
||||
/*
|
||||
* Constants used in vector implementation of log(x)
|
||||
*/
|
||||
#define NPY_COEFF_P0_LOGf 0.000000000000000000000e+00f
|
||||
#define NPY_COEFF_P1_LOGf 9.999999999999998702752e-01f
|
||||
#define NPY_COEFF_P2_LOGf 2.112677543073053063722e+00f
|
||||
#define NPY_COEFF_P3_LOGf 1.480000633576506585156e+00f
|
||||
#define NPY_COEFF_P4_LOGf 3.808837741388407920751e-01f
|
||||
#define NPY_COEFF_P5_LOGf 2.589979117907922693523e-02f
|
||||
#define NPY_COEFF_Q0_LOGf 1.000000000000000000000e+00f
|
||||
#define NPY_COEFF_Q1_LOGf 2.612677543073109236779e+00f
|
||||
#define NPY_COEFF_Q2_LOGf 2.453006071784736363091e+00f
|
||||
#define NPY_COEFF_Q3_LOGf 9.864942958519418960339e-01f
|
||||
#define NPY_COEFF_Q4_LOGf 1.546476374983906719538e-01f
|
||||
#define NPY_COEFF_Q5_LOGf 5.875095403124574342950e-03f
|
||||
|
||||
/*
|
||||
* Integer functions.
|
||||
*/
|
||||
NPY_INPLACE npy_uint npy_gcdu(npy_uint a, npy_uint b);
|
||||
NPY_INPLACE npy_uint npy_lcmu(npy_uint a, npy_uint b);
|
||||
NPY_INPLACE npy_ulong npy_gcdul(npy_ulong a, npy_ulong b);
|
||||
NPY_INPLACE npy_ulong npy_lcmul(npy_ulong a, npy_ulong b);
|
||||
NPY_INPLACE npy_ulonglong npy_gcdull(npy_ulonglong a, npy_ulonglong b);
|
||||
NPY_INPLACE npy_ulonglong npy_lcmull(npy_ulonglong a, npy_ulonglong b);
|
||||
|
||||
NPY_INPLACE npy_int npy_gcd(npy_int a, npy_int b);
|
||||
NPY_INPLACE npy_int npy_lcm(npy_int a, npy_int b);
|
||||
NPY_INPLACE npy_long npy_gcdl(npy_long a, npy_long b);
|
||||
NPY_INPLACE npy_long npy_lcml(npy_long a, npy_long b);
|
||||
NPY_INPLACE npy_longlong npy_gcdll(npy_longlong a, npy_longlong b);
|
||||
NPY_INPLACE npy_longlong npy_lcmll(npy_longlong a, npy_longlong b);
|
||||
|
||||
/*
|
||||
* C99 double math funcs
|
||||
*/
|
||||
NPY_INPLACE double npy_sin(double x);
|
||||
NPY_INPLACE double npy_cos(double x);
|
||||
NPY_INPLACE double npy_tan(double x);
|
||||
NPY_INPLACE double npy_sinh(double x);
|
||||
NPY_INPLACE double npy_cosh(double x);
|
||||
NPY_INPLACE double npy_tanh(double x);
|
||||
|
||||
NPY_INPLACE double npy_asin(double x);
|
||||
NPY_INPLACE double npy_acos(double x);
|
||||
NPY_INPLACE double npy_atan(double x);
|
||||
|
||||
NPY_INPLACE double npy_log(double x);
|
||||
NPY_INPLACE double npy_log10(double x);
|
||||
NPY_INPLACE double npy_exp(double x);
|
||||
NPY_INPLACE double npy_sqrt(double x);
|
||||
NPY_INPLACE double npy_cbrt(double x);
|
||||
|
||||
NPY_INPLACE double npy_fabs(double x);
|
||||
NPY_INPLACE double npy_ceil(double x);
|
||||
NPY_INPLACE double npy_fmod(double x, double y);
|
||||
NPY_INPLACE double npy_floor(double x);
|
||||
|
||||
NPY_INPLACE double npy_expm1(double x);
|
||||
NPY_INPLACE double npy_log1p(double x);
|
||||
NPY_INPLACE double npy_hypot(double x, double y);
|
||||
NPY_INPLACE double npy_acosh(double x);
|
||||
NPY_INPLACE double npy_asinh(double xx);
|
||||
NPY_INPLACE double npy_atanh(double x);
|
||||
NPY_INPLACE double npy_rint(double x);
|
||||
NPY_INPLACE double npy_trunc(double x);
|
||||
NPY_INPLACE double npy_exp2(double x);
|
||||
NPY_INPLACE double npy_log2(double x);
|
||||
|
||||
NPY_INPLACE double npy_atan2(double x, double y);
|
||||
NPY_INPLACE double npy_pow(double x, double y);
|
||||
NPY_INPLACE double npy_modf(double x, double* y);
|
||||
NPY_INPLACE double npy_frexp(double x, int* y);
|
||||
NPY_INPLACE double npy_ldexp(double n, int y);
|
||||
|
||||
NPY_INPLACE double npy_copysign(double x, double y);
|
||||
double npy_nextafter(double x, double y);
|
||||
double npy_spacing(double x);
|
||||
|
||||
/*
|
||||
* IEEE 754 fpu handling. Those are guaranteed to be macros
|
||||
*/
|
||||
|
||||
/* use builtins to avoid function calls in tight loops
|
||||
* only available if npy_config.h is available (= numpys own build) */
|
||||
#if HAVE___BUILTIN_ISNAN
|
||||
#define npy_isnan(x) __builtin_isnan(x)
|
||||
#else
|
||||
#ifndef NPY_HAVE_DECL_ISNAN
|
||||
#define npy_isnan(x) ((x) != (x))
|
||||
#else
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1900)
|
||||
#define npy_isnan(x) _isnan((x))
|
||||
#else
|
||||
#define npy_isnan(x) isnan(x)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* only available if npy_config.h is available (= numpys own build) */
|
||||
#if HAVE___BUILTIN_ISFINITE
|
||||
#define npy_isfinite(x) __builtin_isfinite(x)
|
||||
#else
|
||||
#ifndef NPY_HAVE_DECL_ISFINITE
|
||||
#ifdef _MSC_VER
|
||||
#define npy_isfinite(x) _finite((x))
|
||||
#else
|
||||
#define npy_isfinite(x) !npy_isnan((x) + (-x))
|
||||
#endif
|
||||
#else
|
||||
#define npy_isfinite(x) isfinite((x))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* only available if npy_config.h is available (= numpys own build) */
|
||||
#if HAVE___BUILTIN_ISINF
|
||||
#define npy_isinf(x) __builtin_isinf(x)
|
||||
#else
|
||||
#ifndef NPY_HAVE_DECL_ISINF
|
||||
#define npy_isinf(x) (!npy_isfinite(x) && !npy_isnan(x))
|
||||
#else
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1900)
|
||||
#define npy_isinf(x) (!_finite((x)) && !_isnan((x)))
|
||||
#else
|
||||
#define npy_isinf(x) isinf((x))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NPY_HAVE_DECL_SIGNBIT
|
||||
int _npy_signbit_f(float x);
|
||||
int _npy_signbit_d(double x);
|
||||
int _npy_signbit_ld(long double x);
|
||||
#define npy_signbit(x) \
|
||||
(sizeof (x) == sizeof (long double) ? _npy_signbit_ld (x) \
|
||||
: sizeof (x) == sizeof (double) ? _npy_signbit_d (x) \
|
||||
: _npy_signbit_f (x))
|
||||
#else
|
||||
#define npy_signbit(x) signbit((x))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* float C99 math functions
|
||||
*/
|
||||
NPY_INPLACE float npy_sinf(float x);
|
||||
NPY_INPLACE float npy_cosf(float x);
|
||||
NPY_INPLACE float npy_tanf(float x);
|
||||
NPY_INPLACE float npy_sinhf(float x);
|
||||
NPY_INPLACE float npy_coshf(float x);
|
||||
NPY_INPLACE float npy_tanhf(float x);
|
||||
NPY_INPLACE float npy_fabsf(float x);
|
||||
NPY_INPLACE float npy_floorf(float x);
|
||||
NPY_INPLACE float npy_ceilf(float x);
|
||||
NPY_INPLACE float npy_rintf(float x);
|
||||
NPY_INPLACE float npy_truncf(float x);
|
||||
NPY_INPLACE float npy_sqrtf(float x);
|
||||
NPY_INPLACE float npy_cbrtf(float x);
|
||||
NPY_INPLACE float npy_log10f(float x);
|
||||
NPY_INPLACE float npy_logf(float x);
|
||||
NPY_INPLACE float npy_expf(float x);
|
||||
NPY_INPLACE float npy_expm1f(float x);
|
||||
NPY_INPLACE float npy_asinf(float x);
|
||||
NPY_INPLACE float npy_acosf(float x);
|
||||
NPY_INPLACE float npy_atanf(float x);
|
||||
NPY_INPLACE float npy_asinhf(float x);
|
||||
NPY_INPLACE float npy_acoshf(float x);
|
||||
NPY_INPLACE float npy_atanhf(float x);
|
||||
NPY_INPLACE float npy_log1pf(float x);
|
||||
NPY_INPLACE float npy_exp2f(float x);
|
||||
NPY_INPLACE float npy_log2f(float x);
|
||||
|
||||
NPY_INPLACE float npy_atan2f(float x, float y);
|
||||
NPY_INPLACE float npy_hypotf(float x, float y);
|
||||
NPY_INPLACE float npy_powf(float x, float y);
|
||||
NPY_INPLACE float npy_fmodf(float x, float y);
|
||||
|
||||
NPY_INPLACE float npy_modff(float x, float* y);
|
||||
NPY_INPLACE float npy_frexpf(float x, int* y);
|
||||
NPY_INPLACE float npy_ldexpf(float x, int y);
|
||||
|
||||
NPY_INPLACE float npy_copysignf(float x, float y);
|
||||
float npy_nextafterf(float x, float y);
|
||||
float npy_spacingf(float x);
|
||||
|
||||
/*
|
||||
* long double C99 math functions
|
||||
*/
|
||||
NPY_INPLACE npy_longdouble npy_sinl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_cosl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_tanl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_sinhl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_coshl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_tanhl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_fabsl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_floorl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_ceill(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_rintl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_truncl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_sqrtl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_cbrtl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_log10l(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_logl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_expl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_expm1l(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_asinl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_acosl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_atanl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_asinhl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_acoshl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_atanhl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_log1pl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_exp2l(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_log2l(npy_longdouble x);
|
||||
|
||||
NPY_INPLACE npy_longdouble npy_atan2l(npy_longdouble x, npy_longdouble y);
|
||||
NPY_INPLACE npy_longdouble npy_hypotl(npy_longdouble x, npy_longdouble y);
|
||||
NPY_INPLACE npy_longdouble npy_powl(npy_longdouble x, npy_longdouble y);
|
||||
NPY_INPLACE npy_longdouble npy_fmodl(npy_longdouble x, npy_longdouble y);
|
||||
|
||||
NPY_INPLACE npy_longdouble npy_modfl(npy_longdouble x, npy_longdouble* y);
|
||||
NPY_INPLACE npy_longdouble npy_frexpl(npy_longdouble x, int* y);
|
||||
NPY_INPLACE npy_longdouble npy_ldexpl(npy_longdouble x, int y);
|
||||
|
||||
NPY_INPLACE npy_longdouble npy_copysignl(npy_longdouble x, npy_longdouble y);
|
||||
npy_longdouble npy_nextafterl(npy_longdouble x, npy_longdouble y);
|
||||
npy_longdouble npy_spacingl(npy_longdouble x);
|
||||
|
||||
/*
|
||||
* Non standard functions
|
||||
*/
|
||||
NPY_INPLACE double npy_deg2rad(double x);
|
||||
NPY_INPLACE double npy_rad2deg(double x);
|
||||
NPY_INPLACE double npy_logaddexp(double x, double y);
|
||||
NPY_INPLACE double npy_logaddexp2(double x, double y);
|
||||
NPY_INPLACE double npy_divmod(double x, double y, double *modulus);
|
||||
NPY_INPLACE double npy_heaviside(double x, double h0);
|
||||
|
||||
NPY_INPLACE float npy_deg2radf(float x);
|
||||
NPY_INPLACE float npy_rad2degf(float x);
|
||||
NPY_INPLACE float npy_logaddexpf(float x, float y);
|
||||
NPY_INPLACE float npy_logaddexp2f(float x, float y);
|
||||
NPY_INPLACE float npy_divmodf(float x, float y, float *modulus);
|
||||
NPY_INPLACE float npy_heavisidef(float x, float h0);
|
||||
|
||||
NPY_INPLACE npy_longdouble npy_deg2radl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_rad2degl(npy_longdouble x);
|
||||
NPY_INPLACE npy_longdouble npy_logaddexpl(npy_longdouble x, npy_longdouble y);
|
||||
NPY_INPLACE npy_longdouble npy_logaddexp2l(npy_longdouble x, npy_longdouble y);
|
||||
NPY_INPLACE npy_longdouble npy_divmodl(npy_longdouble x, npy_longdouble y,
|
||||
npy_longdouble *modulus);
|
||||
NPY_INPLACE npy_longdouble npy_heavisidel(npy_longdouble x, npy_longdouble h0);
|
||||
|
||||
#define npy_degrees npy_rad2deg
|
||||
#define npy_degreesf npy_rad2degf
|
||||
#define npy_degreesl npy_rad2degl
|
||||
|
||||
#define npy_radians npy_deg2rad
|
||||
#define npy_radiansf npy_deg2radf
|
||||
#define npy_radiansl npy_deg2radl
|
||||
|
||||
/*
|
||||
* Complex declarations
|
||||
*/
|
||||
|
||||
/*
|
||||
* C99 specifies that complex numbers have the same representation as
|
||||
* an array of two elements, where the first element is the real part
|
||||
* and the second element is the imaginary part.
|
||||
*/
|
||||
#define __NPY_CPACK_IMP(x, y, type, ctype) \
|
||||
union { \
|
||||
ctype z; \
|
||||
type a[2]; \
|
||||
} z1;; \
|
||||
\
|
||||
z1.a[0] = (x); \
|
||||
z1.a[1] = (y); \
|
||||
\
|
||||
return z1.z;
|
||||
|
||||
static NPY_INLINE npy_cdouble npy_cpack(double x, double y)
|
||||
{
|
||||
__NPY_CPACK_IMP(x, y, double, npy_cdouble);
|
||||
}
|
||||
|
||||
static NPY_INLINE npy_cfloat npy_cpackf(float x, float y)
|
||||
{
|
||||
__NPY_CPACK_IMP(x, y, float, npy_cfloat);
|
||||
}
|
||||
|
||||
static NPY_INLINE npy_clongdouble npy_cpackl(npy_longdouble x, npy_longdouble y)
|
||||
{
|
||||
__NPY_CPACK_IMP(x, y, npy_longdouble, npy_clongdouble);
|
||||
}
|
||||
#undef __NPY_CPACK_IMP
|
||||
|
||||
/*
|
||||
* Same remark as above, but in the other direction: extract first/second
|
||||
* member of complex number, assuming a C99-compatible representation
|
||||
*
|
||||
* Those are defineds as static inline, and such as a reasonable compiler would
|
||||
* most likely compile this to one or two instructions (on CISC at least)
|
||||
*/
|
||||
#define __NPY_CEXTRACT_IMP(z, index, type, ctype) \
|
||||
union { \
|
||||
ctype z; \
|
||||
type a[2]; \
|
||||
} __z_repr; \
|
||||
__z_repr.z = z; \
|
||||
\
|
||||
return __z_repr.a[index];
|
||||
|
||||
static NPY_INLINE double npy_creal(npy_cdouble z)
|
||||
{
|
||||
__NPY_CEXTRACT_IMP(z, 0, double, npy_cdouble);
|
||||
}
|
||||
|
||||
static NPY_INLINE double npy_cimag(npy_cdouble z)
|
||||
{
|
||||
__NPY_CEXTRACT_IMP(z, 1, double, npy_cdouble);
|
||||
}
|
||||
|
||||
static NPY_INLINE float npy_crealf(npy_cfloat z)
|
||||
{
|
||||
__NPY_CEXTRACT_IMP(z, 0, float, npy_cfloat);
|
||||
}
|
||||
|
||||
static NPY_INLINE float npy_cimagf(npy_cfloat z)
|
||||
{
|
||||
__NPY_CEXTRACT_IMP(z, 1, float, npy_cfloat);
|
||||
}
|
||||
|
||||
static NPY_INLINE npy_longdouble npy_creall(npy_clongdouble z)
|
||||
{
|
||||
__NPY_CEXTRACT_IMP(z, 0, npy_longdouble, npy_clongdouble);
|
||||
}
|
||||
|
||||
static NPY_INLINE npy_longdouble npy_cimagl(npy_clongdouble z)
|
||||
{
|
||||
__NPY_CEXTRACT_IMP(z, 1, npy_longdouble, npy_clongdouble);
|
||||
}
|
||||
#undef __NPY_CEXTRACT_IMP
|
||||
|
||||
/*
|
||||
* Double precision complex functions
|
||||
*/
|
||||
double npy_cabs(npy_cdouble z);
|
||||
double npy_carg(npy_cdouble z);
|
||||
|
||||
npy_cdouble npy_cexp(npy_cdouble z);
|
||||
npy_cdouble npy_clog(npy_cdouble z);
|
||||
npy_cdouble npy_cpow(npy_cdouble x, npy_cdouble y);
|
||||
|
||||
npy_cdouble npy_csqrt(npy_cdouble z);
|
||||
|
||||
npy_cdouble npy_ccos(npy_cdouble z);
|
||||
npy_cdouble npy_csin(npy_cdouble z);
|
||||
npy_cdouble npy_ctan(npy_cdouble z);
|
||||
|
||||
npy_cdouble npy_ccosh(npy_cdouble z);
|
||||
npy_cdouble npy_csinh(npy_cdouble z);
|
||||
npy_cdouble npy_ctanh(npy_cdouble z);
|
||||
|
||||
npy_cdouble npy_cacos(npy_cdouble z);
|
||||
npy_cdouble npy_casin(npy_cdouble z);
|
||||
npy_cdouble npy_catan(npy_cdouble z);
|
||||
|
||||
npy_cdouble npy_cacosh(npy_cdouble z);
|
||||
npy_cdouble npy_casinh(npy_cdouble z);
|
||||
npy_cdouble npy_catanh(npy_cdouble z);
|
||||
|
||||
/*
|
||||
* Single precision complex functions
|
||||
*/
|
||||
float npy_cabsf(npy_cfloat z);
|
||||
float npy_cargf(npy_cfloat z);
|
||||
|
||||
npy_cfloat npy_cexpf(npy_cfloat z);
|
||||
npy_cfloat npy_clogf(npy_cfloat z);
|
||||
npy_cfloat npy_cpowf(npy_cfloat x, npy_cfloat y);
|
||||
|
||||
npy_cfloat npy_csqrtf(npy_cfloat z);
|
||||
|
||||
npy_cfloat npy_ccosf(npy_cfloat z);
|
||||
npy_cfloat npy_csinf(npy_cfloat z);
|
||||
npy_cfloat npy_ctanf(npy_cfloat z);
|
||||
|
||||
npy_cfloat npy_ccoshf(npy_cfloat z);
|
||||
npy_cfloat npy_csinhf(npy_cfloat z);
|
||||
npy_cfloat npy_ctanhf(npy_cfloat z);
|
||||
|
||||
npy_cfloat npy_cacosf(npy_cfloat z);
|
||||
npy_cfloat npy_casinf(npy_cfloat z);
|
||||
npy_cfloat npy_catanf(npy_cfloat z);
|
||||
|
||||
npy_cfloat npy_cacoshf(npy_cfloat z);
|
||||
npy_cfloat npy_casinhf(npy_cfloat z);
|
||||
npy_cfloat npy_catanhf(npy_cfloat z);
|
||||
|
||||
|
||||
/*
|
||||
* Extended precision complex functions
|
||||
*/
|
||||
npy_longdouble npy_cabsl(npy_clongdouble z);
|
||||
npy_longdouble npy_cargl(npy_clongdouble z);
|
||||
|
||||
npy_clongdouble npy_cexpl(npy_clongdouble z);
|
||||
npy_clongdouble npy_clogl(npy_clongdouble z);
|
||||
npy_clongdouble npy_cpowl(npy_clongdouble x, npy_clongdouble y);
|
||||
|
||||
npy_clongdouble npy_csqrtl(npy_clongdouble z);
|
||||
|
||||
npy_clongdouble npy_ccosl(npy_clongdouble z);
|
||||
npy_clongdouble npy_csinl(npy_clongdouble z);
|
||||
npy_clongdouble npy_ctanl(npy_clongdouble z);
|
||||
|
||||
npy_clongdouble npy_ccoshl(npy_clongdouble z);
|
||||
npy_clongdouble npy_csinhl(npy_clongdouble z);
|
||||
npy_clongdouble npy_ctanhl(npy_clongdouble z);
|
||||
|
||||
npy_clongdouble npy_cacosl(npy_clongdouble z);
|
||||
npy_clongdouble npy_casinl(npy_clongdouble z);
|
||||
npy_clongdouble npy_catanl(npy_clongdouble z);
|
||||
|
||||
npy_clongdouble npy_cacoshl(npy_clongdouble z);
|
||||
npy_clongdouble npy_casinhl(npy_clongdouble z);
|
||||
npy_clongdouble npy_catanhl(npy_clongdouble z);
|
||||
|
||||
|
||||
/*
|
||||
* Functions that set the floating point error
|
||||
* status word.
|
||||
*/
|
||||
|
||||
/*
|
||||
* platform-dependent code translates floating point
|
||||
* status to an integer sum of these values
|
||||
*/
|
||||
#define NPY_FPE_DIVIDEBYZERO 1
|
||||
#define NPY_FPE_OVERFLOW 2
|
||||
#define NPY_FPE_UNDERFLOW 4
|
||||
#define NPY_FPE_INVALID 8
|
||||
|
||||
int npy_clear_floatstatus_barrier(char*);
|
||||
int npy_get_floatstatus_barrier(char*);
|
||||
/*
|
||||
* use caution with these - clang and gcc8.1 are known to reorder calls
|
||||
* to this form of the function which can defeat the check. The _barrier
|
||||
* form of the call is preferable, where the argument is
|
||||
* (char*)&local_variable
|
||||
*/
|
||||
int npy_clear_floatstatus(void);
|
||||
int npy_get_floatstatus(void);
|
||||
|
||||
void npy_set_floatstatus_divbyzero(void);
|
||||
void npy_set_floatstatus_overflow(void);
|
||||
void npy_set_floatstatus_underflow(void);
|
||||
void npy_set_floatstatus_invalid(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NPY_INLINE_MATH
|
||||
#include "npy_math_internal.h"
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* This include file is provided for inclusion in Cython *.pyd files where
|
||||
* one would like to define the NPY_NO_DEPRECATED_API macro. It can be
|
||||
* included by
|
||||
*
|
||||
* cdef extern from "npy_no_deprecated_api.h": pass
|
||||
*
|
||||
*/
|
||||
#ifndef NPY_NO_DEPRECATED_API
|
||||
|
||||
/* put this check here since there may be multiple includes in C extensions. */
|
||||
#if defined(NDARRAYTYPES_H) || defined(_NPY_DEPRECATED_API_H) || \
|
||||
defined(OLD_DEFINES_H)
|
||||
#error "npy_no_deprecated_api.h" must be first among numpy includes.
|
||||
#else
|
||||
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,30 @@
|
||||
#ifndef _NPY_OS_H_
|
||||
#define _NPY_OS_H_
|
||||
|
||||
#if defined(linux) || defined(__linux) || defined(__linux__)
|
||||
#define NPY_OS_LINUX
|
||||
#elif defined(__FreeBSD__) || defined(__NetBSD__) || \
|
||||
defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
#define NPY_OS_BSD
|
||||
#ifdef __FreeBSD__
|
||||
#define NPY_OS_FREEBSD
|
||||
#elif defined(__NetBSD__)
|
||||
#define NPY_OS_NETBSD
|
||||
#elif defined(__OpenBSD__)
|
||||
#define NPY_OS_OPENBSD
|
||||
#elif defined(__DragonFly__)
|
||||
#define NPY_OS_DRAGONFLY
|
||||
#endif
|
||||
#elif defined(sun) || defined(__sun)
|
||||
#define NPY_OS_SOLARIS
|
||||
#elif defined(__CYGWIN__)
|
||||
#define NPY_OS_CYGWIN
|
||||
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
#define NPY_OS_WIN32
|
||||
#elif defined(__APPLE__)
|
||||
#define NPY_OS_DARWIN
|
||||
#else
|
||||
#define NPY_OS_UNKNOWN
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,41 @@
|
||||
#ifndef _NPY_NUMPYCONFIG_H_
|
||||
#define _NPY_NUMPYCONFIG_H_
|
||||
|
||||
#include "_numpyconfig.h"
|
||||
|
||||
/*
|
||||
* On Mac OS X, because there is only one configuration stage for all the archs
|
||||
* in universal builds, any macro which depends on the arch needs to be
|
||||
* hardcoded
|
||||
*/
|
||||
#ifdef __APPLE__
|
||||
#undef NPY_SIZEOF_LONG
|
||||
#undef NPY_SIZEOF_PY_INTPTR_T
|
||||
|
||||
#ifdef __LP64__
|
||||
#define NPY_SIZEOF_LONG 8
|
||||
#define NPY_SIZEOF_PY_INTPTR_T 8
|
||||
#else
|
||||
#define NPY_SIZEOF_LONG 4
|
||||
#define NPY_SIZEOF_PY_INTPTR_T 4
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* To help with the NPY_NO_DEPRECATED_API macro, we include API version
|
||||
* numbers for specific versions of NumPy. To exclude all API that was
|
||||
* deprecated as of 1.7, add the following before #including any NumPy
|
||||
* headers:
|
||||
* #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
|
||||
*/
|
||||
#define NPY_1_7_API_VERSION 0x00000007
|
||||
#define NPY_1_8_API_VERSION 0x00000008
|
||||
#define NPY_1_9_API_VERSION 0x00000008
|
||||
#define NPY_1_10_API_VERSION 0x00000008
|
||||
#define NPY_1_11_API_VERSION 0x00000008
|
||||
#define NPY_1_12_API_VERSION 0x00000008
|
||||
#define NPY_1_13_API_VERSION 0x00000008
|
||||
#define NPY_1_14_API_VERSION 0x00000008
|
||||
#define NPY_1_15_API_VERSION 0x00000008
|
||||
|
||||
#endif
|
@ -0,0 +1,187 @@
|
||||
/* This header is deprecated as of NumPy 1.7 */
|
||||
#ifndef OLD_DEFINES_H
|
||||
#define OLD_DEFINES_H
|
||||
|
||||
#if defined(NPY_NO_DEPRECATED_API) && NPY_NO_DEPRECATED_API >= NPY_1_7_API_VERSION
|
||||
#error The header "old_defines.h" is deprecated as of NumPy 1.7.
|
||||
#endif
|
||||
|
||||
#define NDARRAY_VERSION NPY_VERSION
|
||||
|
||||
#define PyArray_MIN_BUFSIZE NPY_MIN_BUFSIZE
|
||||
#define PyArray_MAX_BUFSIZE NPY_MAX_BUFSIZE
|
||||
#define PyArray_BUFSIZE NPY_BUFSIZE
|
||||
|
||||
#define PyArray_PRIORITY NPY_PRIORITY
|
||||
#define PyArray_SUBTYPE_PRIORITY NPY_PRIORITY
|
||||
#define PyArray_NUM_FLOATTYPE NPY_NUM_FLOATTYPE
|
||||
|
||||
#define NPY_MAX PyArray_MAX
|
||||
#define NPY_MIN PyArray_MIN
|
||||
|
||||
#define PyArray_TYPES NPY_TYPES
|
||||
#define PyArray_BOOL NPY_BOOL
|
||||
#define PyArray_BYTE NPY_BYTE
|
||||
#define PyArray_UBYTE NPY_UBYTE
|
||||
#define PyArray_SHORT NPY_SHORT
|
||||
#define PyArray_USHORT NPY_USHORT
|
||||
#define PyArray_INT NPY_INT
|
||||
#define PyArray_UINT NPY_UINT
|
||||
#define PyArray_LONG NPY_LONG
|
||||
#define PyArray_ULONG NPY_ULONG
|
||||
#define PyArray_LONGLONG NPY_LONGLONG
|
||||
#define PyArray_ULONGLONG NPY_ULONGLONG
|
||||
#define PyArray_HALF NPY_HALF
|
||||
#define PyArray_FLOAT NPY_FLOAT
|
||||
#define PyArray_DOUBLE NPY_DOUBLE
|
||||
#define PyArray_LONGDOUBLE NPY_LONGDOUBLE
|
||||
#define PyArray_CFLOAT NPY_CFLOAT
|
||||
#define PyArray_CDOUBLE NPY_CDOUBLE
|
||||
#define PyArray_CLONGDOUBLE NPY_CLONGDOUBLE
|
||||
#define PyArray_OBJECT NPY_OBJECT
|
||||
#define PyArray_STRING NPY_STRING
|
||||
#define PyArray_UNICODE NPY_UNICODE
|
||||
#define PyArray_VOID NPY_VOID
|
||||
#define PyArray_DATETIME NPY_DATETIME
|
||||
#define PyArray_TIMEDELTA NPY_TIMEDELTA
|
||||
#define PyArray_NTYPES NPY_NTYPES
|
||||
#define PyArray_NOTYPE NPY_NOTYPE
|
||||
#define PyArray_CHAR NPY_CHAR
|
||||
#define PyArray_USERDEF NPY_USERDEF
|
||||
#define PyArray_NUMUSERTYPES NPY_NUMUSERTYPES
|
||||
|
||||
#define PyArray_INTP NPY_INTP
|
||||
#define PyArray_UINTP NPY_UINTP
|
||||
|
||||
#define PyArray_INT8 NPY_INT8
|
||||
#define PyArray_UINT8 NPY_UINT8
|
||||
#define PyArray_INT16 NPY_INT16
|
||||
#define PyArray_UINT16 NPY_UINT16
|
||||
#define PyArray_INT32 NPY_INT32
|
||||
#define PyArray_UINT32 NPY_UINT32
|
||||
|
||||
#ifdef NPY_INT64
|
||||
#define PyArray_INT64 NPY_INT64
|
||||
#define PyArray_UINT64 NPY_UINT64
|
||||
#endif
|
||||
|
||||
#ifdef NPY_INT128
|
||||
#define PyArray_INT128 NPY_INT128
|
||||
#define PyArray_UINT128 NPY_UINT128
|
||||
#endif
|
||||
|
||||
#ifdef NPY_FLOAT16
|
||||
#define PyArray_FLOAT16 NPY_FLOAT16
|
||||
#define PyArray_COMPLEX32 NPY_COMPLEX32
|
||||
#endif
|
||||
|
||||
#ifdef NPY_FLOAT80
|
||||
#define PyArray_FLOAT80 NPY_FLOAT80
|
||||
#define PyArray_COMPLEX160 NPY_COMPLEX160
|
||||
#endif
|
||||
|
||||
#ifdef NPY_FLOAT96
|
||||
#define PyArray_FLOAT96 NPY_FLOAT96
|
||||
#define PyArray_COMPLEX192 NPY_COMPLEX192
|
||||
#endif
|
||||
|
||||
#ifdef NPY_FLOAT128
|
||||
#define PyArray_FLOAT128 NPY_FLOAT128
|
||||
#define PyArray_COMPLEX256 NPY_COMPLEX256
|
||||
#endif
|
||||
|
||||
#define PyArray_FLOAT32 NPY_FLOAT32
|
||||
#define PyArray_COMPLEX64 NPY_COMPLEX64
|
||||
#define PyArray_FLOAT64 NPY_FLOAT64
|
||||
#define PyArray_COMPLEX128 NPY_COMPLEX128
|
||||
|
||||
|
||||
#define PyArray_TYPECHAR NPY_TYPECHAR
|
||||
#define PyArray_BOOLLTR NPY_BOOLLTR
|
||||
#define PyArray_BYTELTR NPY_BYTELTR
|
||||
#define PyArray_UBYTELTR NPY_UBYTELTR
|
||||
#define PyArray_SHORTLTR NPY_SHORTLTR
|
||||
#define PyArray_USHORTLTR NPY_USHORTLTR
|
||||
#define PyArray_INTLTR NPY_INTLTR
|
||||
#define PyArray_UINTLTR NPY_UINTLTR
|
||||
#define PyArray_LONGLTR NPY_LONGLTR
|
||||
#define PyArray_ULONGLTR NPY_ULONGLTR
|
||||
#define PyArray_LONGLONGLTR NPY_LONGLONGLTR
|
||||
#define PyArray_ULONGLONGLTR NPY_ULONGLONGLTR
|
||||
#define PyArray_HALFLTR NPY_HALFLTR
|
||||
#define PyArray_FLOATLTR NPY_FLOATLTR
|
||||
#define PyArray_DOUBLELTR NPY_DOUBLELTR
|
||||
#define PyArray_LONGDOUBLELTR NPY_LONGDOUBLELTR
|
||||
#define PyArray_CFLOATLTR NPY_CFLOATLTR
|
||||
#define PyArray_CDOUBLELTR NPY_CDOUBLELTR
|
||||
#define PyArray_CLONGDOUBLELTR NPY_CLONGDOUBLELTR
|
||||
#define PyArray_OBJECTLTR NPY_OBJECTLTR
|
||||
#define PyArray_STRINGLTR NPY_STRINGLTR
|
||||
#define PyArray_STRINGLTR2 NPY_STRINGLTR2
|
||||
#define PyArray_UNICODELTR NPY_UNICODELTR
|
||||
#define PyArray_VOIDLTR NPY_VOIDLTR
|
||||
#define PyArray_DATETIMELTR NPY_DATETIMELTR
|
||||
#define PyArray_TIMEDELTALTR NPY_TIMEDELTALTR
|
||||
#define PyArray_CHARLTR NPY_CHARLTR
|
||||
#define PyArray_INTPLTR NPY_INTPLTR
|
||||
#define PyArray_UINTPLTR NPY_UINTPLTR
|
||||
#define PyArray_GENBOOLLTR NPY_GENBOOLLTR
|
||||
#define PyArray_SIGNEDLTR NPY_SIGNEDLTR
|
||||
#define PyArray_UNSIGNEDLTR NPY_UNSIGNEDLTR
|
||||
#define PyArray_FLOATINGLTR NPY_FLOATINGLTR
|
||||
#define PyArray_COMPLEXLTR NPY_COMPLEXLTR
|
||||
|
||||
#define PyArray_QUICKSORT NPY_QUICKSORT
|
||||
#define PyArray_HEAPSORT NPY_HEAPSORT
|
||||
#define PyArray_MERGESORT NPY_MERGESORT
|
||||
#define PyArray_SORTKIND NPY_SORTKIND
|
||||
#define PyArray_NSORTS NPY_NSORTS
|
||||
|
||||
#define PyArray_NOSCALAR NPY_NOSCALAR
|
||||
#define PyArray_BOOL_SCALAR NPY_BOOL_SCALAR
|
||||
#define PyArray_INTPOS_SCALAR NPY_INTPOS_SCALAR
|
||||
#define PyArray_INTNEG_SCALAR NPY_INTNEG_SCALAR
|
||||
#define PyArray_FLOAT_SCALAR NPY_FLOAT_SCALAR
|
||||
#define PyArray_COMPLEX_SCALAR NPY_COMPLEX_SCALAR
|
||||
#define PyArray_OBJECT_SCALAR NPY_OBJECT_SCALAR
|
||||
#define PyArray_SCALARKIND NPY_SCALARKIND
|
||||
#define PyArray_NSCALARKINDS NPY_NSCALARKINDS
|
||||
|
||||
#define PyArray_ANYORDER NPY_ANYORDER
|
||||
#define PyArray_CORDER NPY_CORDER
|
||||
#define PyArray_FORTRANORDER NPY_FORTRANORDER
|
||||
#define PyArray_ORDER NPY_ORDER
|
||||
|
||||
#define PyDescr_ISBOOL PyDataType_ISBOOL
|
||||
#define PyDescr_ISUNSIGNED PyDataType_ISUNSIGNED
|
||||
#define PyDescr_ISSIGNED PyDataType_ISSIGNED
|
||||
#define PyDescr_ISINTEGER PyDataType_ISINTEGER
|
||||
#define PyDescr_ISFLOAT PyDataType_ISFLOAT
|
||||
#define PyDescr_ISNUMBER PyDataType_ISNUMBER
|
||||
#define PyDescr_ISSTRING PyDataType_ISSTRING
|
||||
#define PyDescr_ISCOMPLEX PyDataType_ISCOMPLEX
|
||||
#define PyDescr_ISPYTHON PyDataType_ISPYTHON
|
||||
#define PyDescr_ISFLEXIBLE PyDataType_ISFLEXIBLE
|
||||
#define PyDescr_ISUSERDEF PyDataType_ISUSERDEF
|
||||
#define PyDescr_ISEXTENDED PyDataType_ISEXTENDED
|
||||
#define PyDescr_ISOBJECT PyDataType_ISOBJECT
|
||||
#define PyDescr_HASFIELDS PyDataType_HASFIELDS
|
||||
|
||||
#define PyArray_LITTLE NPY_LITTLE
|
||||
#define PyArray_BIG NPY_BIG
|
||||
#define PyArray_NATIVE NPY_NATIVE
|
||||
#define PyArray_SWAP NPY_SWAP
|
||||
#define PyArray_IGNORE NPY_IGNORE
|
||||
|
||||
#define PyArray_NATBYTE NPY_NATBYTE
|
||||
#define PyArray_OPPBYTE NPY_OPPBYTE
|
||||
|
||||
#define PyArray_MAX_ELSIZE NPY_MAX_ELSIZE
|
||||
|
||||
#define PyArray_USE_PYMEM NPY_USE_PYMEM
|
||||
|
||||
#define PyArray_RemoveLargest PyArray_RemoveSmallest
|
||||
|
||||
#define PyArray_UCS4 npy_ucs4
|
||||
|
||||
#endif
|
@ -0,0 +1,25 @@
|
||||
#include "arrayobject.h"
|
||||
|
||||
#ifndef PYPY_VERSION
|
||||
#ifndef REFCOUNT
|
||||
# define REFCOUNT NPY_REFCOUNT
|
||||
# define MAX_ELSIZE 16
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define PyArray_UNSIGNED_TYPES
|
||||
#define PyArray_SBYTE NPY_BYTE
|
||||
#define PyArray_CopyArray PyArray_CopyInto
|
||||
#define _PyArray_multiply_list PyArray_MultiplyIntList
|
||||
#define PyArray_ISSPACESAVER(m) NPY_FALSE
|
||||
#define PyScalarArray_Check PyArray_CheckScalar
|
||||
|
||||
#define CONTIGUOUS NPY_CONTIGUOUS
|
||||
#define OWN_DIMENSIONS 0
|
||||
#define OWN_STRIDES 0
|
||||
#define OWN_DATA NPY_OWNDATA
|
||||
#define SAVESPACE 0
|
||||
#define SAVESPACEBIT 0
|
||||
|
||||
#undef import_array
|
||||
#define import_array() { if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); } }
|
@ -0,0 +1,20 @@
|
||||
#ifndef _RANDOM_BITGEN_H
|
||||
#define _RANDOM_BITGEN_H
|
||||
|
||||
#pragma once
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* Must match the declaration in numpy/random/common.pxd */
|
||||
|
||||
typedef struct bitgen {
|
||||
void *state;
|
||||
uint64_t (*next_uint64)(void *st);
|
||||
uint32_t (*next_uint32)(void *st);
|
||||
double (*next_double)(void *st);
|
||||
uint64_t (*next_raw)(void *st);
|
||||
} bitgen_t;
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,337 @@
|
||||
|
||||
=================
|
||||
NumPy Ufunc C-API
|
||||
=================
|
||||
::
|
||||
|
||||
PyObject *
|
||||
PyUFunc_FromFuncAndData(PyUFuncGenericFunction *func, void
|
||||
**data, char *types, int ntypes, int nin, int
|
||||
nout, int identity, const char *name, const
|
||||
char *doc, int unused)
|
||||
|
||||
|
||||
::
|
||||
|
||||
int
|
||||
PyUFunc_RegisterLoopForType(PyUFuncObject *ufunc, int
|
||||
usertype, PyUFuncGenericFunction
|
||||
function, int *arg_types, void *data)
|
||||
|
||||
|
||||
::
|
||||
|
||||
int
|
||||
PyUFunc_GenericFunction(PyUFuncObject *ufunc, PyObject *args, PyObject
|
||||
*kwds, PyArrayObject **op)
|
||||
|
||||
|
||||
This generic function is called with the ufunc object, the arguments to it,
|
||||
and an array of (pointers to) PyArrayObjects which are NULL.
|
||||
|
||||
'op' is an array of at least NPY_MAXARGS PyArrayObject *.
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_f_f_As_d_d(char **args, npy_intp *dimensions, npy_intp
|
||||
*steps, void *func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_d_d(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_f_f(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_g_g(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_F_F_As_D_D(char **args, npy_intp *dimensions, npy_intp
|
||||
*steps, void *func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_F_F(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_D_D(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_G_G(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_O_O(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_ff_f_As_dd_d(char **args, npy_intp *dimensions, npy_intp
|
||||
*steps, void *func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_ff_f(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_dd_d(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_gg_g(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_FF_F_As_DD_D(char **args, npy_intp *dimensions, npy_intp
|
||||
*steps, void *func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_DD_D(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_FF_F(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_GG_G(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_OO_O(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_O_O_method(char **args, npy_intp *dimensions, npy_intp
|
||||
*steps, void *func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_OO_O_method(char **args, npy_intp *dimensions, npy_intp
|
||||
*steps, void *func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_On_Om(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
int
|
||||
PyUFunc_GetPyValues(char *name, int *bufsize, int *errmask, PyObject
|
||||
**errobj)
|
||||
|
||||
|
||||
On return, if errobj is populated with a non-NULL value, the caller
|
||||
owns a new reference to errobj.
|
||||
|
||||
::
|
||||
|
||||
int
|
||||
PyUFunc_checkfperr(int errmask, PyObject *errobj, int *first)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_clearfperr()
|
||||
|
||||
|
||||
::
|
||||
|
||||
int
|
||||
PyUFunc_getfperr(void )
|
||||
|
||||
|
||||
::
|
||||
|
||||
int
|
||||
PyUFunc_handlefperr(int errmask, PyObject *errobj, int retstatus, int
|
||||
*first)
|
||||
|
||||
|
||||
::
|
||||
|
||||
int
|
||||
PyUFunc_ReplaceLoopBySignature(PyUFuncObject
|
||||
*func, PyUFuncGenericFunction
|
||||
newfunc, int
|
||||
*signature, PyUFuncGenericFunction
|
||||
*oldfunc)
|
||||
|
||||
|
||||
::
|
||||
|
||||
PyObject *
|
||||
PyUFunc_FromFuncAndDataAndSignature(PyUFuncGenericFunction *func, void
|
||||
**data, char *types, int
|
||||
ntypes, int nin, int nout, int
|
||||
identity, const char *name, const
|
||||
char *doc, int unused, const char
|
||||
*signature)
|
||||
|
||||
|
||||
::
|
||||
|
||||
int
|
||||
PyUFunc_SetUsesArraysAsData(void **data, size_t i)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_e_e(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_e_e_As_f_f(char **args, npy_intp *dimensions, npy_intp
|
||||
*steps, void *func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_e_e_As_d_d(char **args, npy_intp *dimensions, npy_intp
|
||||
*steps, void *func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_ee_e(char **args, npy_intp *dimensions, npy_intp *steps, void
|
||||
*func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_ee_e_As_ff_f(char **args, npy_intp *dimensions, npy_intp
|
||||
*steps, void *func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
void
|
||||
PyUFunc_ee_e_As_dd_d(char **args, npy_intp *dimensions, npy_intp
|
||||
*steps, void *func)
|
||||
|
||||
|
||||
::
|
||||
|
||||
int
|
||||
PyUFunc_DefaultTypeResolver(PyUFuncObject *ufunc, NPY_CASTING
|
||||
casting, PyArrayObject
|
||||
**operands, PyObject
|
||||
*type_tup, PyArray_Descr **out_dtypes)
|
||||
|
||||
|
||||
This function applies the default type resolution rules
|
||||
for the provided ufunc.
|
||||
|
||||
Returns 0 on success, -1 on error.
|
||||
|
||||
::
|
||||
|
||||
int
|
||||
PyUFunc_ValidateCasting(PyUFuncObject *ufunc, NPY_CASTING
|
||||
casting, PyArrayObject
|
||||
**operands, PyArray_Descr **dtypes)
|
||||
|
||||
|
||||
Validates that the input operands can be cast to
|
||||
the input types, and the output types can be cast to
|
||||
the output operands where provided.
|
||||
|
||||
Returns 0 on success, -1 (with exception raised) on validation failure.
|
||||
|
||||
::
|
||||
|
||||
int
|
||||
PyUFunc_RegisterLoopForDescr(PyUFuncObject *ufunc, PyArray_Descr
|
||||
*user_dtype, PyUFuncGenericFunction
|
||||
function, PyArray_Descr
|
||||
**arg_dtypes, void *data)
|
||||
|
||||
|
||||
::
|
||||
|
||||
PyObject *
|
||||
PyUFunc_FromFuncAndDataAndSignatureAndIdentity(PyUFuncGenericFunction
|
||||
*func, void
|
||||
**data, char
|
||||
*types, int ntypes, int
|
||||
nin, int nout, int
|
||||
identity, const char
|
||||
*name, const char
|
||||
*doc, int unused, const
|
||||
char
|
||||
*signature, PyObject
|
||||
*identity_value)
|
||||
|
||||
|
@ -0,0 +1,381 @@
|
||||
#ifndef Py_UFUNCOBJECT_H
|
||||
#define Py_UFUNCOBJECT_H
|
||||
|
||||
#include <numpy/npy_math.h>
|
||||
#include <numpy/npy_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The legacy generic inner loop for a standard element-wise or
|
||||
* generalized ufunc.
|
||||
*/
|
||||
typedef void (*PyUFuncGenericFunction)
|
||||
(char **args,
|
||||
npy_intp *dimensions,
|
||||
npy_intp *strides,
|
||||
void *innerloopdata);
|
||||
|
||||
/*
|
||||
* The most generic one-dimensional inner loop for
|
||||
* a masked standard element-wise ufunc. "Masked" here means that it skips
|
||||
* doing calculations on any items for which the maskptr array has a true
|
||||
* value.
|
||||
*/
|
||||
typedef void (PyUFunc_MaskedStridedInnerLoopFunc)(
|
||||
char **dataptrs, npy_intp *strides,
|
||||
char *maskptr, npy_intp mask_stride,
|
||||
npy_intp count,
|
||||
NpyAuxData *innerloopdata);
|
||||
|
||||
/* Forward declaration for the type resolver and loop selector typedefs */
|
||||
struct _tagPyUFuncObject;
|
||||
|
||||
/*
|
||||
* Given the operands for calling a ufunc, should determine the
|
||||
* calculation input and output data types and return an inner loop function.
|
||||
* This function should validate that the casting rule is being followed,
|
||||
* and fail if it is not.
|
||||
*
|
||||
* For backwards compatibility, the regular type resolution function does not
|
||||
* support auxiliary data with object semantics. The type resolution call
|
||||
* which returns a masked generic function returns a standard NpyAuxData
|
||||
* object, for which the NPY_AUXDATA_FREE and NPY_AUXDATA_CLONE macros
|
||||
* work.
|
||||
*
|
||||
* ufunc: The ufunc object.
|
||||
* casting: The 'casting' parameter provided to the ufunc.
|
||||
* operands: An array of length (ufunc->nin + ufunc->nout),
|
||||
* with the output parameters possibly NULL.
|
||||
* type_tup: Either NULL, or the type_tup passed to the ufunc.
|
||||
* out_dtypes: An array which should be populated with new
|
||||
* references to (ufunc->nin + ufunc->nout) new
|
||||
* dtypes, one for each input and output. These
|
||||
* dtypes should all be in native-endian format.
|
||||
*
|
||||
* Should return 0 on success, -1 on failure (with exception set),
|
||||
* or -2 if Py_NotImplemented should be returned.
|
||||
*/
|
||||
typedef int (PyUFunc_TypeResolutionFunc)(
|
||||
struct _tagPyUFuncObject *ufunc,
|
||||
NPY_CASTING casting,
|
||||
PyArrayObject **operands,
|
||||
PyObject *type_tup,
|
||||
PyArray_Descr **out_dtypes);
|
||||
|
||||
/*
|
||||
* Given an array of DTypes as returned by the PyUFunc_TypeResolutionFunc,
|
||||
* and an array of fixed strides (the array will contain NPY_MAX_INTP for
|
||||
* strides which are not necessarily fixed), returns an inner loop
|
||||
* with associated auxiliary data.
|
||||
*
|
||||
* For backwards compatibility, there is a variant of the inner loop
|
||||
* selection which returns an inner loop irrespective of the strides,
|
||||
* and with a void* static auxiliary data instead of an NpyAuxData *
|
||||
* dynamically allocatable auxiliary data.
|
||||
*
|
||||
* ufunc: The ufunc object.
|
||||
* dtypes: An array which has been populated with dtypes,
|
||||
* in most cases by the type resolution function
|
||||
* for the same ufunc.
|
||||
* fixed_strides: For each input/output, either the stride that
|
||||
* will be used every time the function is called
|
||||
* or NPY_MAX_INTP if the stride might change or
|
||||
* is not known ahead of time. The loop selection
|
||||
* function may use this stride to pick inner loops
|
||||
* which are optimized for contiguous or 0-stride
|
||||
* cases.
|
||||
* out_innerloop: Should be populated with the correct ufunc inner
|
||||
* loop for the given type.
|
||||
* out_innerloopdata: Should be populated with the void* data to
|
||||
* be passed into the out_innerloop function.
|
||||
* out_needs_api: If the inner loop needs to use the Python API,
|
||||
* should set the to 1, otherwise should leave
|
||||
* this untouched.
|
||||
*/
|
||||
typedef int (PyUFunc_LegacyInnerLoopSelectionFunc)(
|
||||
struct _tagPyUFuncObject *ufunc,
|
||||
PyArray_Descr **dtypes,
|
||||
PyUFuncGenericFunction *out_innerloop,
|
||||
void **out_innerloopdata,
|
||||
int *out_needs_api);
|
||||
typedef int (PyUFunc_MaskedInnerLoopSelectionFunc)(
|
||||
struct _tagPyUFuncObject *ufunc,
|
||||
PyArray_Descr **dtypes,
|
||||
PyArray_Descr *mask_dtype,
|
||||
npy_intp *fixed_strides,
|
||||
npy_intp fixed_mask_stride,
|
||||
PyUFunc_MaskedStridedInnerLoopFunc **out_innerloop,
|
||||
NpyAuxData **out_innerloopdata,
|
||||
int *out_needs_api);
|
||||
|
||||
typedef struct _tagPyUFuncObject {
|
||||
PyObject_HEAD
|
||||
/*
|
||||
* nin: Number of inputs
|
||||
* nout: Number of outputs
|
||||
* nargs: Always nin + nout (Why is it stored?)
|
||||
*/
|
||||
int nin, nout, nargs;
|
||||
|
||||
/*
|
||||
* Identity for reduction, any of PyUFunc_One, PyUFunc_Zero
|
||||
* PyUFunc_MinusOne, PyUFunc_None, PyUFunc_ReorderableNone,
|
||||
* PyUFunc_IdentityValue.
|
||||
*/
|
||||
int identity;
|
||||
|
||||
/* Array of one-dimensional core loops */
|
||||
PyUFuncGenericFunction *functions;
|
||||
/* Array of funcdata that gets passed into the functions */
|
||||
void **data;
|
||||
/* The number of elements in 'functions' and 'data' */
|
||||
int ntypes;
|
||||
|
||||
/* Used to be unused field 'check_return' */
|
||||
int reserved1;
|
||||
|
||||
/* The name of the ufunc */
|
||||
const char *name;
|
||||
|
||||
/* Array of type numbers, of size ('nargs' * 'ntypes') */
|
||||
char *types;
|
||||
|
||||
/* Documentation string */
|
||||
const char *doc;
|
||||
|
||||
void *ptr;
|
||||
PyObject *obj;
|
||||
PyObject *userloops;
|
||||
|
||||
/* generalized ufunc parameters */
|
||||
|
||||
/* 0 for scalar ufunc; 1 for generalized ufunc */
|
||||
int core_enabled;
|
||||
/* number of distinct dimension names in signature */
|
||||
int core_num_dim_ix;
|
||||
|
||||
/*
|
||||
* dimension indices of input/output argument k are stored in
|
||||
* core_dim_ixs[core_offsets[k]..core_offsets[k]+core_num_dims[k]-1]
|
||||
*/
|
||||
|
||||
/* numbers of core dimensions of each argument */
|
||||
int *core_num_dims;
|
||||
/*
|
||||
* dimension indices in a flatted form; indices
|
||||
* are in the range of [0,core_num_dim_ix)
|
||||
*/
|
||||
int *core_dim_ixs;
|
||||
/*
|
||||
* positions of 1st core dimensions of each
|
||||
* argument in core_dim_ixs, equivalent to cumsum(core_num_dims)
|
||||
*/
|
||||
int *core_offsets;
|
||||
/* signature string for printing purpose */
|
||||
char *core_signature;
|
||||
|
||||
/*
|
||||
* A function which resolves the types and fills an array
|
||||
* with the dtypes for the inputs and outputs.
|
||||
*/
|
||||
PyUFunc_TypeResolutionFunc *type_resolver;
|
||||
/*
|
||||
* A function which returns an inner loop written for
|
||||
* NumPy 1.6 and earlier ufuncs. This is for backwards
|
||||
* compatibility, and may be NULL if inner_loop_selector
|
||||
* is specified.
|
||||
*/
|
||||
PyUFunc_LegacyInnerLoopSelectionFunc *legacy_inner_loop_selector;
|
||||
/*
|
||||
* This was blocked off to be the "new" inner loop selector in 1.7,
|
||||
* but this was never implemented. (This is also why the above
|
||||
* selector is called the "legacy" selector.)
|
||||
*/
|
||||
void *reserved2;
|
||||
/*
|
||||
* A function which returns a masked inner loop for the ufunc.
|
||||
*/
|
||||
PyUFunc_MaskedInnerLoopSelectionFunc *masked_inner_loop_selector;
|
||||
|
||||
/*
|
||||
* List of flags for each operand when ufunc is called by nditer object.
|
||||
* These flags will be used in addition to the default flags for each
|
||||
* operand set by nditer object.
|
||||
*/
|
||||
npy_uint32 *op_flags;
|
||||
|
||||
/*
|
||||
* List of global flags used when ufunc is called by nditer object.
|
||||
* These flags will be used in addition to the default global flags
|
||||
* set by nditer object.
|
||||
*/
|
||||
npy_uint32 iter_flags;
|
||||
|
||||
/* New in NPY_API_VERSION 0x0000000D and above */
|
||||
|
||||
/*
|
||||
* for each core_num_dim_ix distinct dimension names,
|
||||
* the possible "frozen" size (-1 if not frozen).
|
||||
*/
|
||||
npy_intp *core_dim_sizes;
|
||||
|
||||
/*
|
||||
* for each distinct core dimension, a set of UFUNC_CORE_DIM* flags
|
||||
*/
|
||||
npy_uint32 *core_dim_flags;
|
||||
|
||||
/* Identity for reduction, when identity == PyUFunc_IdentityValue */
|
||||
PyObject *identity_value;
|
||||
|
||||
} PyUFuncObject;
|
||||
|
||||
#include "arrayobject.h"
|
||||
/* Generalized ufunc; 0x0001 reserved for possible use as CORE_ENABLED */
|
||||
/* the core dimension's size will be determined by the operands. */
|
||||
#define UFUNC_CORE_DIM_SIZE_INFERRED 0x0002
|
||||
/* the core dimension may be absent */
|
||||
#define UFUNC_CORE_DIM_CAN_IGNORE 0x0004
|
||||
/* flags inferred during execution */
|
||||
#define UFUNC_CORE_DIM_MISSING 0x00040000
|
||||
|
||||
#define UFUNC_ERR_IGNORE 0
|
||||
#define UFUNC_ERR_WARN 1
|
||||
#define UFUNC_ERR_RAISE 2
|
||||
#define UFUNC_ERR_CALL 3
|
||||
#define UFUNC_ERR_PRINT 4
|
||||
#define UFUNC_ERR_LOG 5
|
||||
|
||||
/* Python side integer mask */
|
||||
|
||||
#define UFUNC_MASK_DIVIDEBYZERO 0x07
|
||||
#define UFUNC_MASK_OVERFLOW 0x3f
|
||||
#define UFUNC_MASK_UNDERFLOW 0x1ff
|
||||
#define UFUNC_MASK_INVALID 0xfff
|
||||
|
||||
#define UFUNC_SHIFT_DIVIDEBYZERO 0
|
||||
#define UFUNC_SHIFT_OVERFLOW 3
|
||||
#define UFUNC_SHIFT_UNDERFLOW 6
|
||||
#define UFUNC_SHIFT_INVALID 9
|
||||
|
||||
|
||||
#define UFUNC_OBJ_ISOBJECT 1
|
||||
#define UFUNC_OBJ_NEEDS_API 2
|
||||
|
||||
/* Default user error mode */
|
||||
#define UFUNC_ERR_DEFAULT \
|
||||
(UFUNC_ERR_WARN << UFUNC_SHIFT_DIVIDEBYZERO) + \
|
||||
(UFUNC_ERR_WARN << UFUNC_SHIFT_OVERFLOW) + \
|
||||
(UFUNC_ERR_WARN << UFUNC_SHIFT_INVALID)
|
||||
|
||||
#if NPY_ALLOW_THREADS
|
||||
#define NPY_LOOP_BEGIN_THREADS do {if (!(loop->obj & UFUNC_OBJ_NEEDS_API)) _save = PyEval_SaveThread();} while (0);
|
||||
#define NPY_LOOP_END_THREADS do {if (!(loop->obj & UFUNC_OBJ_NEEDS_API)) PyEval_RestoreThread(_save);} while (0);
|
||||
#else
|
||||
#define NPY_LOOP_BEGIN_THREADS
|
||||
#define NPY_LOOP_END_THREADS
|
||||
#endif
|
||||
|
||||
/*
|
||||
* UFunc has unit of 0, and the order of operations can be reordered
|
||||
* This case allows reduction with multiple axes at once.
|
||||
*/
|
||||
#define PyUFunc_Zero 0
|
||||
/*
|
||||
* UFunc has unit of 1, and the order of operations can be reordered
|
||||
* This case allows reduction with multiple axes at once.
|
||||
*/
|
||||
#define PyUFunc_One 1
|
||||
/*
|
||||
* UFunc has unit of -1, and the order of operations can be reordered
|
||||
* This case allows reduction with multiple axes at once. Intended for
|
||||
* bitwise_and reduction.
|
||||
*/
|
||||
#define PyUFunc_MinusOne 2
|
||||
/*
|
||||
* UFunc has no unit, and the order of operations cannot be reordered.
|
||||
* This case does not allow reduction with multiple axes at once.
|
||||
*/
|
||||
#define PyUFunc_None -1
|
||||
/*
|
||||
* UFunc has no unit, and the order of operations can be reordered
|
||||
* This case allows reduction with multiple axes at once.
|
||||
*/
|
||||
#define PyUFunc_ReorderableNone -2
|
||||
/*
|
||||
* UFunc unit is an identity_value, and the order of operations can be reordered
|
||||
* This case allows reduction with multiple axes at once.
|
||||
*/
|
||||
#define PyUFunc_IdentityValue -3
|
||||
|
||||
|
||||
#define UFUNC_REDUCE 0
|
||||
#define UFUNC_ACCUMULATE 1
|
||||
#define UFUNC_REDUCEAT 2
|
||||
#define UFUNC_OUTER 3
|
||||
|
||||
|
||||
typedef struct {
|
||||
int nin;
|
||||
int nout;
|
||||
PyObject *callable;
|
||||
} PyUFunc_PyFuncData;
|
||||
|
||||
/* A linked-list of function information for
|
||||
user-defined 1-d loops.
|
||||
*/
|
||||
typedef struct _loop1d_info {
|
||||
PyUFuncGenericFunction func;
|
||||
void *data;
|
||||
int *arg_types;
|
||||
struct _loop1d_info *next;
|
||||
int nargs;
|
||||
PyArray_Descr **arg_dtypes;
|
||||
} PyUFunc_Loop1d;
|
||||
|
||||
|
||||
#include "__ufunc_api.h"
|
||||
|
||||
#define UFUNC_PYVALS_NAME "UFUNC_PYVALS"
|
||||
|
||||
#define UFUNC_CHECK_ERROR(arg) \
|
||||
do {if ((((arg)->obj & UFUNC_OBJ_NEEDS_API) && PyErr_Occurred()) || \
|
||||
((arg)->errormask && \
|
||||
PyUFunc_checkfperr((arg)->errormask, \
|
||||
(arg)->errobj, \
|
||||
&(arg)->first))) \
|
||||
goto fail;} while (0)
|
||||
|
||||
/*
|
||||
* THESE MACROS ARE DEPRECATED.
|
||||
* Use npy_set_floatstatus_* in the npymath library.
|
||||
*/
|
||||
#define UFUNC_FPE_DIVIDEBYZERO NPY_FPE_DIVIDEBYZERO
|
||||
#define UFUNC_FPE_OVERFLOW NPY_FPE_OVERFLOW
|
||||
#define UFUNC_FPE_UNDERFLOW NPY_FPE_UNDERFLOW
|
||||
#define UFUNC_FPE_INVALID NPY_FPE_INVALID
|
||||
|
||||
#define UFUNC_CHECK_STATUS(ret) \
|
||||
{ \
|
||||
ret = npy_clear_floatstatus(); \
|
||||
}
|
||||
#define generate_divbyzero_error() npy_set_floatstatus_divbyzero()
|
||||
#define generate_overflow_error() npy_set_floatstatus_overflow()
|
||||
|
||||
/* Make sure it gets defined if it isn't already */
|
||||
#ifndef UFUNC_NOFPE
|
||||
/* Clear the floating point exception default of Borland C++ */
|
||||
#if defined(__BORLANDC__)
|
||||
#define UFUNC_NOFPE _control87(MCW_EM, MCW_EM);
|
||||
#else
|
||||
#define UFUNC_NOFPE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_UFUNCOBJECT_H */
|
@ -0,0 +1,21 @@
|
||||
#ifndef __NUMPY_UTILS_HEADER__
|
||||
#define __NUMPY_UTILS_HEADER__
|
||||
|
||||
#ifndef __COMP_NPY_UNUSED
|
||||
#if defined(__GNUC__)
|
||||
#define __COMP_NPY_UNUSED __attribute__ ((__unused__))
|
||||
# elif defined(__ICC)
|
||||
#define __COMP_NPY_UNUSED __attribute__ ((__unused__))
|
||||
# elif defined(__clang__)
|
||||
#define __COMP_NPY_UNUSED __attribute__ ((unused))
|
||||
#else
|
||||
#define __COMP_NPY_UNUSED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Use this to tag a variable as not used. It will remove unused variable
|
||||
* warning on support platforms (see __COM_NPY_UNUSED) and mangle the variable
|
||||
* to avoid accidental use */
|
||||
#define NPY_UNUSED(x) (__NPY_UNUSED_TAGGED ## x) __COMP_NPY_UNUSED
|
||||
|
||||
#endif
|
@ -0,0 +1,87 @@
|
||||
"""Defines a multi-dimensional array and useful procedures for Numerical computation.
|
||||
|
||||
Functions
|
||||
|
||||
- array - NumPy Array construction
|
||||
- zeros - Return an array of all zeros
|
||||
- empty - Return an uninitialized array
|
||||
- shape - Return shape of sequence or array
|
||||
- rank - Return number of dimensions
|
||||
- size - Return number of elements in entire array or a
|
||||
certain dimension
|
||||
- fromstring - Construct array from (byte) string
|
||||
- take - Select sub-arrays using sequence of indices
|
||||
- put - Set sub-arrays using sequence of 1-D indices
|
||||
- putmask - Set portion of arrays using a mask
|
||||
- reshape - Return array with new shape
|
||||
- repeat - Repeat elements of array
|
||||
- choose - Construct new array from indexed array tuple
|
||||
- correlate - Correlate two 1-d arrays
|
||||
- searchsorted - Search for element in 1-d array
|
||||
- sum - Total sum over a specified dimension
|
||||
- average - Average, possibly weighted, over axis or array.
|
||||
- cumsum - Cumulative sum over a specified dimension
|
||||
- product - Total product over a specified dimension
|
||||
- cumproduct - Cumulative product over a specified dimension
|
||||
- alltrue - Logical and over an entire axis
|
||||
- sometrue - Logical or over an entire axis
|
||||
- allclose - Tests if sequences are essentially equal
|
||||
|
||||
More Functions:
|
||||
|
||||
- arange - Return regularly spaced array
|
||||
- asarray - Guarantee NumPy array
|
||||
- convolve - Convolve two 1-d arrays
|
||||
- swapaxes - Exchange axes
|
||||
- concatenate - Join arrays together
|
||||
- transpose - Permute axes
|
||||
- sort - Sort elements of array
|
||||
- argsort - Indices of sorted array
|
||||
- argmax - Index of largest value
|
||||
- argmin - Index of smallest value
|
||||
- inner - Innerproduct of two arrays
|
||||
- dot - Dot product (matrix multiplication)
|
||||
- outer - Outerproduct of two arrays
|
||||
- resize - Return array with arbitrary new shape
|
||||
- indices - Tuple of indices
|
||||
- fromfunction - Construct array from universal function
|
||||
- diagonal - Return diagonal array
|
||||
- trace - Trace of array
|
||||
- dump - Dump array to file object (pickle)
|
||||
- dumps - Return pickled string representing data
|
||||
- load - Return array stored in file object
|
||||
- loads - Return array from pickled string
|
||||
- ravel - Return array as 1-D
|
||||
- nonzero - Indices of nonzero elements for 1-D array
|
||||
- shape - Shape of array
|
||||
- where - Construct array from binary result
|
||||
- compress - Elements of array where condition is true
|
||||
- clip - Clip array between two values
|
||||
- ones - Array of all ones
|
||||
- identity - 2-D identity array (matrix)
|
||||
|
||||
(Universal) Math Functions
|
||||
|
||||
add logical_or exp
|
||||
subtract logical_xor log
|
||||
multiply logical_not log10
|
||||
divide maximum sin
|
||||
divide_safe minimum sinh
|
||||
conjugate bitwise_and sqrt
|
||||
power bitwise_or tan
|
||||
absolute bitwise_xor tanh
|
||||
negative invert ceil
|
||||
greater left_shift fabs
|
||||
greater_equal right_shift floor
|
||||
less arccos arctan2
|
||||
less_equal arcsin fmod
|
||||
equal arctan hypot
|
||||
not_equal cos around
|
||||
logical_and cosh sign
|
||||
arccosh arcsinh arctanh
|
||||
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
depends = ['testing']
|
||||
global_symbols = ['*']
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue