diff options
98 files changed, 966 insertions, 483 deletions
diff --git a/.gitignore b/.gitignore index fbdd4f784..0a1e1909f 100644 --- a/.gitignore +++ b/.gitignore @@ -99,6 +99,7 @@ Icon? .gdb_history ehthumbs.db Thumbs.db +.directory # pytest generated files # ########################## @@ -123,6 +124,7 @@ numpy/core/include/numpy/config.h numpy/core/include/numpy/multiarray_api.txt numpy/core/include/numpy/ufunc_api.txt numpy/core/lib/ +numpy/core/src/multiarray/_multiarray_tests.c numpy/core/src/multiarray/arraytypes.c numpy/core/src/multiarray/einsum.c numpy/core/src/multiarray/lowlevel_strided_loops.c @@ -141,6 +143,10 @@ numpy/core/src/npysort/sort.c numpy/core/src/private/npy_binsearch.h numpy/core/src/private/npy_partition.h numpy/core/src/private/templ_common.h +numpy/core/src/umath/_operand_flag_tests.c +numpy/core/src/umath/_rational_tests.c +numpy/core/src/umath/_struct_ufunc_tests.c +numpy/core/src/umath/_umath_tests.c numpy/core/src/umath/scalarmath.c numpy/core/src/umath/funcs.inc numpy/core/src/umath/loops.[ch] @@ -153,6 +159,7 @@ numpy/distutils/__config__.py numpy/linalg/umath_linalg.c doc/source/reference/generated benchmarks/results +benchmarks/html benchmarks/env benchmarks/numpy # cythonized files diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e70585d0c..01d9a537e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,12 +16,12 @@ Thanks for your interest in contributing code to numpy! + If this is your first time contributing to a project on GitHub, please read through our -[guide to contributing to numpy](http://docs.scipy.org/doc/numpy/dev/index.html) +[guide to contributing to numpy](https://docs.scipy.org/doc/numpy/dev/index.html) + If you have contributed to other projects on GitHub you can go straight to our -[development workflow](http://docs.scipy.org/doc/numpy/dev/gitwash/development_workflow.html) +[development workflow](https://docs.scipy.org/doc/numpy/dev/gitwash/development_workflow.html) Either way, please be sure to follow our -[convention for commit messages](http://docs.scipy.org/doc/numpy/dev/gitwash/development_workflow.html#writing-the-commit-message). +[convention for commit messages](https://docs.scipy.org/doc/numpy/dev/gitwash/development_workflow.html#writing-the-commit-message). If you are writing new C code, please follow the style described in ``doc/C_STYLE_GUIDE``. diff --git a/INSTALL.rst.txt b/INSTALL.rst.txt index d8ca80d92..a81468d9f 100644 --- a/INSTALL.rst.txt +++ b/INSTALL.rst.txt @@ -4,7 +4,7 @@ Building and installing NumPy **IMPORTANT**: the below notes are about building NumPy, which for most users is *not* the recommended way to install NumPy. Instead, use either a complete scientific Python distribution (recommended) or a binary installer - see -http://scipy.org/install.html. +https://scipy.org/install.html. .. Contents:: @@ -33,20 +33,20 @@ Building NumPy requires the following software installed: This is required for testing numpy, but not for using it. -Python__ http://www.python.org -nose__ http://nose.readthedocs.io +Python__ https://www.python.org +nose__ https://nose.readthedocs.io .. note:: If you want to build NumPy in order to work on NumPy itself, use ``runtests.py``. For more details, see - http://docs.scipy.org/doc/numpy/dev/development_environment.html + https://docs.scipy.org/doc/numpy/dev/development_environment.html .. note:: More extensive information on building NumPy (and Scipy) is maintained at - http://scipy.org/scipylib/building/index.html + https://scipy.github.io/devdocs/building/ Basic Installation @@ -100,7 +100,7 @@ The older MinGW32 compiler set used to produce older .exe installers for NumPy itself is still available at https://github.com/numpy/numpy-vendor, but not recommended for use anymore. -MingwPy__ http://mingwpy.github.io +MingwPy__ https://mingwpy.github.io Building with optimized BLAS support @@ -117,7 +117,7 @@ Windows The Intel compilers work with Intel MKL, see the application note linked above. MingwPy__ works with OpenBLAS. For an overview of the state of BLAS/LAPACK libraries on Windows, see -`here <http://mingwpy.github.io/blas_lapack.html>`_. +`here <https://mingwpy.github.io/blas_lapack.html>`_. OS X ---- @@ -155,6 +155,6 @@ Build issues ============ If you run into build issues and need help, the NumPy -`mailing list <http://scipy.org/scipylib/mailing-lists.html>`_ is the best +`mailing list <https://scipy.org/scipylib/mailing-lists.html>`_ is the best place to ask. If the issue is clearly a bug in NumPy, please file an issue (or even better, a pull request) at https://github.com/numpy/numpy. @@ -5,7 +5,7 @@ NumPy is the fundamental package needed for scientific computing with Python. -- **Website (including documentation):** http://www.numpy.org +- **Website (including documentation):** https://www.numpy.org - **Mailing list:** https://mail.python.org/mailman/listinfo/numpy-discussion - **Source:** https://github.com/numpy/numpy - **Bug reports:** https://github.com/numpy/numpy/issues diff --git a/benchmarks/asv.conf.json b/benchmarks/asv.conf.json index d837b0d67..653b48a08 100644 --- a/benchmarks/asv.conf.json +++ b/benchmarks/asv.conf.json @@ -7,7 +7,7 @@ "project": "numpy", // The project's homepage - "project_url": "http://numpy.org/", + "project_url": "https://www.numpy.org/", // The URL or local path of the source code repository for the // project being benchmarked diff --git a/doc/CAPI.rst.txt b/doc/CAPI.rst.txt index f38815e2a..ccee0fdb6 100644 --- a/doc/CAPI.rst.txt +++ b/doc/CAPI.rst.txt @@ -6,7 +6,7 @@ C-API for NumPy :Discussions to: `numpy-discussion@python.org`__ :Created: October 2005 -__ http://scipy.org/scipylib/mailing-lists.html +__ https://scipy.org/scipylib/mailing-lists.html The C API of NumPy is (mostly) backward compatible with Numeric. diff --git a/doc/HOWTO_RELEASE.rst.txt b/doc/HOWTO_RELEASE.rst.txt index 3ed15e99c..f849effa1 100644 --- a/doc/HOWTO_RELEASE.rst.txt +++ b/doc/HOWTO_RELEASE.rst.txt @@ -18,16 +18,16 @@ Source tree NumPy Docs ---------- * https://github.com/numpy/numpy/blob/master/doc/HOWTO_RELEASE.rst.txt -* http://projects.scipy.org/numpy/wiki/MicrosoftToolchainSupport +* http://projects.scipy.org/numpy/wiki/MicrosoftToolchainSupport (dead link) SciPy.org wiki -------------- -* http://www.scipy.org/Installing_SciPy and links on that page. -* http://new.scipy.org/building/windows.html +* https://www.scipy.org/Installing_SciPy and links on that page. +* http://new.scipy.org/building/windows.html (dead link) Doc wiki -------- -* http://docs.scipy.org/numpy/docs/numpy-docs/user/install.rst/ +* http://docs.scipy.org/numpy/docs/numpy-docs/user/install.rst/ (dead link) Release Scripts --------------- @@ -56,7 +56,7 @@ Windows We build 32- and 64-bit wheels for Python 2.7, 3.4, 3.5 on Windows. Windows XP, Vista, 7, 8 and 10 are supported. We build numpy using the MSVC compilers on Appveyor, but we are hoping to update to a `mingw-w64 toolchain -<http://mingwpy.github.io>`_. The Windows wheels use ATLAS for BLAS / LAPACK. +<https://mingwpy.github.io>`_. The Windows wheels use ATLAS for BLAS / LAPACK. Linux ----- @@ -101,7 +101,7 @@ Building source archives and wheels You will need write permission for numpy-wheels in order to trigger wheel builds. -* Python(s) from `python.org <http://python.org>`_ or linux distro. +* Python(s) from `python.org <https://python.org>`_ or linux distro. * cython * virtualenv (pip) * Paver (pip) @@ -131,7 +131,7 @@ Generating author/pr lists -------------------------- You will need an personal access token -`<https://help.github.com/articles/creating-an-access-token-for-command-line-use/>`_ +`<https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/>`_ so that scripts can access the github numpy repository * gitpython (pip) @@ -206,7 +206,7 @@ Do:: to check that the documentation is in a buildable state. See doc/HOWTO_BUILD_DOCS.rst.txt for more details and for how to update -http://docs.scipy.org. +https://docs.scipy.org. Check deprecations ------------------ @@ -322,7 +322,7 @@ message). Unfortunately the name of a tag can be changed without breaking the signature, the contents of the message cannot. See : https://github.com/scipy/scipy/issues/4919 for a discussion of signing -release tags, and http://keyring.debian.org/creating-key.html for instructions +release tags, and https://keyring.debian.org/creating-key.html for instructions on creating a GPG key if you do not have one. To make your key more readily identifiable as you, consider sending your key @@ -387,7 +387,7 @@ The tar-files and binary releases for distribution should be uploaded to SourceF together with the Release Notes and the Changelog. Uploading can be done through a web interface or, more efficiently, through scp/sftp/rsync as described in the SourceForge -`upload guide <https://sourceforge.net/apps/trac/sourceforge/wiki/Release%20files%20for%20download>`_. +`upload guide <https://sourceforge.net/apps/trac/sourceforge/wiki/Release%20files%20for%20download>`_ (dead link). For example:: scp <filename> <username>,numpy@frs.sourceforge.net:/home/frs/project/n/nu/numpy/NumPy/<releasedir>/ @@ -472,7 +472,7 @@ repository. Update docs.scipy.org --------------------- -All documentation for a release can be updated on http://docs.scipy.org/ with: +All documentation for a release can be updated on https://docs.scipy.org/ with: make dist make upload USERNAME=<yourname> RELEASE=1.11.0 diff --git a/doc/Py3K.rst.txt b/doc/Py3K.rst.txt index 44111eeb5..f78b9e5db 100644 --- a/doc/Py3K.rst.txt +++ b/doc/Py3K.rst.txt @@ -22,8 +22,8 @@ Resources Information on porting to 3K: -- http://wiki.python.org/moin/cporting -- http://wiki.python.org/moin/PortingExtensionModulesToPy3k +- https://wiki.python.org/moin/cporting +- https://wiki.python.org/moin/PortingExtensionModulesToPy3k Prerequisites diff --git a/doc/TESTS.rst.txt b/doc/TESTS.rst.txt index 68b0eace4..170519110 100644 --- a/doc/TESTS.rst.txt +++ b/doc/TESTS.rst.txt @@ -9,17 +9,17 @@ Introduction '''''''''''' SciPy uses the `Nose testing system -<http://nose.readthedocs.io>`__, with some +<https://nose.readthedocs.io>`__, with some minor convenience features added. Nose is an extension of the unit testing framework offered by `unittest.py -<http://docs.python.org/lib/module-unittest.html>`__. Our goal is that +<https://docs.python.org/library/unittest.html>`__. Our goal is that every module and package in SciPy should have a thorough set of unit tests. These tests should exercise the full functionality of a given routine as well as its robustness to erroneous or unexpected input arguments. Long experience has shown that by far the best time to write the tests is before you write or change the code - this is `test-driven development -<http://en.wikipedia.org/wiki/Test-driven_development>`__. The +<https://en.wikipedia.org/wiki/Test-driven_development>`__. The arguments for this can sound rather abstract, but we can assure you that you will find that writing the tests first leads to more robust and better designed code. Well-designed tests with good coverage make @@ -306,7 +306,7 @@ minor variations, it can be helpful to create a base class containing all the common tests, and then create a subclass for each variation. Several examples of this technique exist in NumPy; below are excerpts from one in `numpy/linalg/tests/test_linalg.py -<http://github.com/numpy/numpy/blob/master/numpy/linalg/tests/test_linalg.py>`__:: +<https://github.com/numpy/numpy/blob/master/numpy/linalg/tests/test_linalg.py>`__:: class LinalgTestCase: def test_single(self): diff --git a/doc/cdoc/Doxyfile b/doc/cdoc/Doxyfile index d80e98558..886a3440e 100644 --- a/doc/cdoc/Doxyfile +++ b/doc/cdoc/Doxyfile @@ -18,7 +18,7 @@ # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. +# https://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 @@ -596,7 +596,7 @@ INPUT = ../../numpy/core/src \ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# into libc) for the transcoding. See https://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 @@ -739,7 +739,7 @@ REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You +# tagging system (see https://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO @@ -843,7 +843,8 @@ HTML_DYNAMIC_SECTIONS = NO # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html (dead link) +# for more information. GENERATE_DOCSET = NO @@ -920,30 +921,30 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace +# https://doc.qt.io/qt-5/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders +# https://doc.qt.io/qt-5/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters +# https://doc.qt.io/qt-5/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see -# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>. +# <a href="https://doc.qt.io/qt-5/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. -# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>. +# <a href="https://doc.qt.io/qt-5/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>. QHP_SECT_FILTER_ATTRS = diff --git a/doc/changelog/1.14.5-changelog.rst b/doc/changelog/1.14.5-changelog.rst new file mode 100644 index 000000000..1769a8fc3 --- /dev/null +++ b/doc/changelog/1.14.5-changelog.rst @@ -0,0 +1,16 @@ + +Contributors +============ + +A total of 1 person contributed to this release. People with a "+" by their +names contributed a patch for the first time. + +* Charles Harris + +Pull requests merged +==================== + +A total of 2 pull requests were merged for this release. + +* `#11274 <https://github.com/numpy/numpy/pull/11274>`__: BUG: Correct use of NPY_UNUSED. +* `#11294 <https://github.com/numpy/numpy/pull/11294>`__: BUG: Remove extra trailing parentheses. diff --git a/doc/neps/conf.py b/doc/neps/conf.py index aa11d37b3..8cfb2b570 100644 --- a/doc/neps/conf.py +++ b/doc/neps/conf.py @@ -100,7 +100,7 @@ todo_include_todos = False ## to template names. ## ## This is required for the alabaster theme -## refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars +## refs: https://alabaster.readthedocs.io/en/latest/installation.html#sidebars #html_sidebars = { # '**': [ # 'relations.html', # needs 'show_related': True theme option to display @@ -127,8 +127,8 @@ if True: "edit_link": True, "sidebar": "right", "scipy_org_logo": True, - "rootlinks": [("http://scipy.org/", "Scipy.org"), - ("http://docs.scipy.org/", "Docs")] + "rootlinks": [("https://scipy.org/", "Scipy.org"), + ("https://docs.scipy.org/", "Docs")] } else: # Default build diff --git a/doc/neps/nep-0000.rst b/doc/neps/nep-0000.rst index 9c6646db2..0824a5635 100644 --- a/doc/neps/nep-0000.rst +++ b/doc/neps/nep-0000.rst @@ -203,7 +203,7 @@ References and Footnotes `GitHub <https://github.com/numpy/numpy/tree/master/doc/neps>`_. .. [2] The URL for viewing NEPs on the web is - http://numpy.github.io/neps/. + https://www.numpy.org/neps/. .. _repo: https://github.com/numpy/numpy @@ -220,7 +220,7 @@ References and Footnotes .. _reStructuredTextPrimer: http://www.sphinx-doc.org/en/stable/rest.html -.. _Sphinx: www.sphinx-doc.org/en/stable +.. _Sphinx: http://www.sphinx-doc.org/en/stable/ Copyright diff --git a/doc/neps/nep-0001-npy-format.rst b/doc/neps/nep-0001-npy-format.rst index 2057aed83..74512128d 100644 --- a/doc/neps/nep-0001-npy-format.rst +++ b/doc/neps/nep-0001-npy-format.rst @@ -290,15 +290,15 @@ included in the 1.9.0 release of numpy. Specifically, the file format.py in this directory implements the format as described here. - http://github.com/numpy/numpy/blob/master/numpy/lib/format.py + https://github.com/numpy/numpy/blob/master/numpy/lib/format.py References ---------- -[1] http://docs.python.org/lib/module-pickle.html +[1] https://docs.python.org/library/pickle.html -[2] http://hdf.ncsa.uiuc.edu/products/hdf5/index.html +[2] https://support.hdfgroup.org/HDF5/ Copyright diff --git a/doc/neps/nep-0004-datetime-proposal3.rst b/doc/neps/nep-0004-datetime-proposal3.rst index 46d8e314b..afeb00d73 100644 --- a/doc/neps/nep-0004-datetime-proposal3.rst +++ b/doc/neps/nep-0004-datetime-proposal3.rst @@ -562,9 +562,9 @@ examples of other derived units, and we find this a bit too overwhelming for this proposal purposes. -.. [1] http://docs.python.org/lib/module-datetime.html -.. [2] http://www.egenix.com/products/python/mxBase/mxDateTime -.. [3] http://en.wikipedia.org/wiki/Unix_time +.. [1] https://docs.python.org/library/datetime.html +.. [2] https://www.egenix.com/products/python/mxBase/mxDateTime +.. [3] https://en.wikipedia.org/wiki/Unix_time .. Local Variables: diff --git a/doc/neps/nep-0007-datetime-proposal.rst b/doc/neps/nep-0007-datetime-proposal.rst index 72d48d244..90894da49 100644 --- a/doc/neps/nep-0007-datetime-proposal.rst +++ b/doc/neps/nep-0007-datetime-proposal.rst @@ -662,9 +662,9 @@ operations mixing business days with other time units will not be allowed. -.. [1] http://docs.python.org/lib/module-datetime.html -.. [2] http://www.egenix.com/products/python/mxBase/mxDateTime -.. [3] http://en.wikipedia.org/wiki/Unix_time +.. [1] https://docs.python.org/library/datetime.html +.. [2] https://www.egenix.com/products/python/mxBase/mxDateTime +.. [3] https://en.wikipedia.org/wiki/Unix_time .. Local Variables: diff --git a/doc/neps/nep-0012-missing-data.rst b/doc/neps/nep-0012-missing-data.rst index 1553339f4..57c45b4b6 100644 --- a/doc/neps/nep-0012-missing-data.rst +++ b/doc/neps/nep-0012-missing-data.rst @@ -4,7 +4,7 @@ Missing Data Functionality in NumPy :Author: Mark Wiebe <mwwiebe@gmail.com> :Copyright: Copyright 2011 by Enthought, Inc -:License: CC By-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/) +:License: CC By-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0/) :Date: 2011-06-23 :Status: Deferred @@ -224,7 +224,7 @@ but with semantics reflecting its status as a missing value. In particular, trying to treat it as a boolean will raise an exception, and comparisons with it will produce numpy.NA instead of True or False. These basics are adopted from the behavior of the NA value in the R project. To dig -deeper into the ideas, http://en.wikipedia.org/wiki/Ternary_logic#Kleene_logic +deeper into the ideas, https://en.wikipedia.org/wiki/Ternary_logic#Kleene_logic provides a starting point. For example,:: @@ -857,7 +857,7 @@ Shared Masks One feature of numpy.ma is called 'shared masks'. -http://docs.scipy.org/doc/numpy/reference/maskedarray.baseclass.html#numpy.ma.MaskedArray.sharedmask +https://docs.scipy.org/doc/numpy/reference/maskedarray.baseclass.html#numpy.ma.MaskedArray.sharedmask This feature cannot be supported by a masked implementation of missing values without directly violating the missing value abstraction. @@ -888,7 +888,7 @@ found from doing google searches of numpy C API array access. NumPy Documentation - How to extend NumPy ----------------------------------------- -http://docs.scipy.org/doc/numpy/user/c-info.how-to-extend.html#dealing-with-array-objects +https://docs.scipy.org/doc/numpy/user/c-info.how-to-extend.html#dealing-with-array-objects This page has a section "Dealing with array objects" which has some advice for how to access numpy arrays from C. When accepting arrays, the first step it suggests is @@ -898,7 +898,7 @@ advice will properly fail when given an NA-masked array it doesn't know how to h The way this is handled is that PyArray_FromAny requires a special flag, NPY_ARRAY_ALLOWNA, before it will allow NA-masked arrays to flow through. -http://docs.scipy.org/doc/numpy/reference/c-api.array.html#NPY_ARRAY_ALLOWNA +https://docs.scipy.org/doc/numpy/reference/c-api.array.html#NPY_ARRAY_ALLOWNA Code which does not follow this advice, and instead just calls PyArray_Check() to verify its an ndarray and checks some flags, will silently produce incorrect results. This style diff --git a/doc/neps/nep-0013-ufunc-overrides.rst b/doc/neps/nep-0013-ufunc-overrides.rst index c97b69023..61e2ceea9 100644 --- a/doc/neps/nep-0013-ufunc-overrides.rst +++ b/doc/neps/nep-0013-ufunc-overrides.rst @@ -53,7 +53,7 @@ changes in 3rd party code. .. [1] http://docs.python.org/doc/numpy/user/basics.subclassing.html .. [2] https://github.com/scipy/scipy/issues/2123 .. [3] https://github.com/scipy/scipy/issues/1569 -.. [4] http://technicaldiscovery.blogspot.com/2013/07/thoughts-after-scipy-2013-and-specific.html +.. [4] https://technicaldiscovery.blogspot.com/2013/07/thoughts-after-scipy-2013-and-specific.html Motivation @@ -134,7 +134,7 @@ which have multiplication semantics incompatible with numpy arrays. However, the aim is to enable writing other custom array types that have strictly ndarray compatible semantics. -.. [5] http://mail.python.org/pipermail/numpy-discussion/2011-June/056945.html +.. [5] https://mail.python.org/pipermail/numpy-discussion/2011-June/056945.html .. [6] https://github.com/numpy/numpy/issues/5844 @@ -635,7 +635,7 @@ simplify the dispatch logic for binary operations with NumPy arrays as much as possible, by making it possible to use Python's dispatch rules or NumPy's dispatch rules, but not some mixture of both at the same time. -.. [9] http://bugs.python.org/issue30140 +.. [9] https://bugs.python.org/issue30140 .. _neps.ufunc-overrides.list-of-operators: diff --git a/doc/neps/nep-0014-dropping-python2.7-proposal.rst b/doc/neps/nep-0014-dropping-python2.7-proposal.rst index 6cfd4707f..158b89e1c 100644 --- a/doc/neps/nep-0014-dropping-python2.7-proposal.rst +++ b/doc/neps/nep-0014-dropping-python2.7-proposal.rst @@ -50,6 +50,6 @@ to Python3 only, see the python3-statement_. For more information on porting your code to run on Python 3, see the python3-howto_. -.. _python3-statement: http://www.python3statement.org/ +.. _python3-statement: https://python3statement.org/ .. _python3-howto: https://docs.python.org/3/howto/pyporting.html diff --git a/doc/neps/nep-0018-array-function-protocol.rst b/doc/neps/nep-0018-array-function-protocol.rst index 943ca4cbf..3e2f5f57f 100644 --- a/doc/neps/nep-0018-array-function-protocol.rst +++ b/doc/neps/nep-0018-array-function-protocol.rst @@ -1,6 +1,6 @@ -================================================== -NEP: Dispatch Mechanism for NumPy's high level API -================================================== +============================================= +Dispatch Mechanism for NumPy's high level API +============================================= :Author: Stephan Hoyer <shoyer@google.com> :Author: Matthew Rocklin <mrocklin@gmail.com> @@ -11,25 +11,27 @@ NEP: Dispatch Mechanism for NumPy's high level API Abstact ------- -We propose a protocol to allow arguments of numpy functions to define -how that function operates on them. This allows other libraries that -implement NumPy's high level API to reuse Numpy functions. This allows -libraries that extend NumPy's high level API to apply to more NumPy-like -libraries. +We propose the ``__array_function__`` protocol, to allow arguments of numpy +functions to define how that function operates on them. This will allow +using NumPy as a high level API for efficient multi-dimensional array +operations, even with array implementations that differ greatly from +``numpy.ndarray``. Detailed description -------------------- -Numpy's high level ndarray API has been implemented several times +NumPy's high level ndarray API has been implemented several times outside of NumPy itself for different architectures, such as for GPU arrays (CuPy), Sparse arrays (scipy.sparse, pydata/sparse) and parallel -arrays (Dask array) as well as various Numpy-like implementations in the +arrays (Dask array) as well as various NumPy-like implementations in the deep learning frameworks, like TensorFlow and PyTorch. -Similarly there are several projects that build on top of the Numpy API +Similarly there are many projects that build on top of the NumPy API for labeled and indexed arrays (XArray), automatic differentation -(Autograd, Tangent), higher order array factorizations (TensorLy), etc. -that add additional functionality on top of the Numpy API. +(Autograd, Tangent), masked arrays (numpy.ma), physical units (astropy.units, +pint, unyt), etc. that add additional functionality on top of the NumPy API. +Most of these project also implement a close variation of NumPy's level high +API. We would like to be able to use these libraries together, for example we would like to be able to place a CuPy array within XArray, or perform @@ -38,7 +40,7 @@ accomplish if code written for NumPy ndarrays could also be used by other NumPy-like projects. For example, we would like for the following code example to work -equally well with any Numpy-like array object: +equally well with any NumPy-like array object: .. code:: python @@ -47,7 +49,7 @@ equally well with any Numpy-like array object: return np.mean(np.exp(y)) Some of this is possible today with various protocol mechanisms within -Numpy. +NumPy. - The ``np.exp`` function checks the ``__array_ufunc__`` protocol - The ``.T`` method works using Python's method dispatch @@ -55,10 +57,10 @@ Numpy. the argument However other functions, like ``np.tensordot`` do not dispatch, and -instead are likely to coerce to a Numpy array (using the ``__array__``) +instead are likely to coerce to a NumPy array (using the ``__array__``) protocol, or err outright. To achieve enough coverage of the NumPy API to support downstream projects like XArray and autograd we want to -support *almost all* functions within Numpy, which calls for a more +support *almost all* functions within NumPy, which calls for a more reaching protocol than just ``__array_ufunc__``. We would like a protocol that allows arguments of a NumPy function to take control and divert execution to another function (for example a GPU or parallel @@ -71,10 +73,13 @@ We propose adding support for a new protocol in NumPy, ``__array_function__``. This protocol is intended to be a catch-all for NumPy functionality that -is not covered by existing protocols, like reductions (like ``np.sum``) -or universal functions (like ``np.exp``). The semantics are very similar -to ``__array_ufunc__``, except the operation is specified by an -arbitrary callable object rather than a ufunc instance and method. +is not covered by the ``__array_ufunc__`` protocol for universal functions +(like ``np.exp``). The semantics are very similar to ``__array_ufunc__``, except +the operation is specified by an arbitrary callable object rather than a ufunc +instance and method. + +A prototype implementation with microbenchmark results can be found in +`this notebook <https://nbviewer.jupyter.org/gist/shoyer/1f0a308a06cd96df20879a1ddb8f0006>`_. The interface ~~~~~~~~~~~~~ @@ -88,23 +93,24 @@ We propose the following signature for implementations of - ``func`` is an arbitrary callable exposed by NumPy's public API, which was called in the form ``func(*args, **kwargs)``. -- ``types`` is a list of types for all arguments to the original NumPy - function call that will be checked for an ``__array_function__`` - implementation. -- The tuple ``args`` and dict ``**kwargs`` are directly passed on from the +- ``types`` is a list of argument types from the original NumPy + function call that implement ``__array_function__``, in the order in which + they will be called. +- The tuple ``args`` and dict ``kwargs`` are directly passed on from the original call. Unlike ``__array_ufunc__``, there are no high-level guarantees about the type of ``func``, or about which of ``args`` and ``kwargs`` may contain objects implementing the array API. As a convenience for ``__array_function__`` -implementors of the NumPy API, the ``types`` keyword contains a list of all -types that implement the ``__array_function__`` protocol. This allows -downstream implementations to quickly determine if they are likely able to -support the operation. +implementors, ``types`` contains a list of argument types with an +``'__array_function__'`` attribute. This allows downstream implementations to +quickly determine if they are likely able to support the operation. Still be determined: what guarantees can we offer for ``types``? Should we promise that types are unique, and appear in the order in which they -are checked? +are checked? Should we pass in arguments directly instead, either the full +list of arguments in ``relevant_arguments`` (see below) or a single argument +for each unique type? Example for a project implementing the NumPy API ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -137,26 +143,28 @@ that the function is not implemented by these types. ... } -Necessary changes within the Numpy codebase itself +Necessary changes within the NumPy codebase itself ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -This will require two changes within the Numpy codebase: +This will require two changes within the NumPy codebase: 1. A function to inspect available inputs, look for the ``__array_function__`` attribute on those inputs, and call those methods appropriately until one succeeds. This needs to be fast in the - common all-NumPy case. + common all-NumPy case, and have acceptable performance (no worse than + linear time) even if the number of overloaded inputs is large (e.g., + as might be the case for `np.concatenate`). This is one additional function of moderate complexity. -2. Calling this function within all relevant Numpy functions. +2. Calling this function within all relevant NumPy functions. - This affects many parts of the Numpy codebase, although with very low + This affects many parts of the NumPy codebase, although with very low complexity. Finding and calling the right ``__array_function__`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Given a Numpy function, ``*args`` and ``**kwargs`` inputs, we need to +Given a NumPy function, ``*args`` and ``**kwargs`` inputs, we need to search through ``*args`` and ``**kwargs`` for all appropriate inputs that might have the ``__array_function__`` attribute. Then we need to select among those possible methods and execute the right one. @@ -187,15 +195,15 @@ of these may decide that, given the available inputs, they are unable to determine the correct result. How do we call the right one? If several are valid then which has precedence? -The rules for dispatch with ``__array_function__`` match those for -``__array_ufunc__`` (see -`NEP-13 <http://www.numpy.org/neps/nep-0013-ufunc-overrides.html>`_). +For the most part, the rules for dispatch with ``__array_function__`` +match those for ``__array_ufunc__`` (see +`NEP-13 <https://www.numpy.org/neps/nep-0013-ufunc-overrides.html>`_). In particular: - NumPy will gather implementations of ``__array_function__`` from all specified inputs and call them in order: subclasses before - superclasses, and otherwise left to right. Note that in some edge cases, - this differs slightly from the + superclasses, and otherwise left to right. Note that in some edge cases + involving subclasses, this differs slightly from the `current behavior <https://bugs.python.org/issue30140>`_ of Python. - Implementations of ``__array_function__`` indicate that they can handle the operation by returning any value other than @@ -203,12 +211,53 @@ In particular: - If all ``__array_function__`` methods return ``NotImplemented``, NumPy will raise ``TypeError``. -Changes within Numpy functions +One deviation from the current behavior of ``__array_ufunc__`` is that NumPy +will only call ``__array_function__`` on the *first* argument of each unique +type. This matches Python's +`rule for calling reflected methods <https://docs.python.org/3/reference/datamodel.html#object.__ror__>`_, +and this ensures that checking overloads has acceptable performance even when +there are a large number of overloaded arguments. To avoid long-term divergence +between these two dispatch protocols, we should +`also update <https://github.com/numpy/numpy/issues/11306>`_ +``__array_ufunc__`` to match this behavior. + +Special handling of ``numpy.ndarray`` +''''''''''''''''''''''''''''''''''''' + +The use cases for subclasses with ``__array_function__`` are the same as those +with ``__array_ufunc__``, so ``numpy.ndarray`` should also define a +``__array_function__`` method mirroring ``ndarray.__array_ufunc__``: + +.. code:: python + + def __array_function__(self, func, types, args, kwargs): + # Cannot handle items that have __array_function__ other than our own. + for t in types: + if (hasattr(t, '__array_function__') and + t.__array_function__ is not ndarray.__array_function__): + return NotImplemented + + # Arguments contain no overrides, so we can safely call the + # overloaded function again. + return func(*args, **kwargs) + +To avoid infinite recursion, the dispatch rules for ``__array_function__`` need +also the same special case they have for ``__array_ufunc__``: any arguments with +an ``__array_function__`` method that is identical to +``numpy.ndarray.__array_function__`` are not be called as +``__array_function__`` implementations. + +Changes within NumPy functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Given a function defined above, for now call it -``do_array_function_dance``, we now need to call that function from -within every relevant Numpy function. This is a pervasive change, but of +.. warning:: + + This section is outdated. We intend to rewrite it to propose + an explicit `decorator based solution <https://github.com/numpy/numpy/pull/11303#issuecomment-396695348>`_ instead. + +Given a function defining the above behavior, for now call it +``try_array_function_override``, we now need to call that function from +within every relevant NumPy function. This is a pervasive change, but of fairly simple and innocuous code that should complete quickly and without effect if no arguments implement the ``__array_function__`` protocol. Let us consider a few examples of NumPy functions and how they @@ -216,8 +265,10 @@ might be affected by this change: .. code:: python + import itertools + def broadcast_to(array, shape, subok=False): - success, value = do_array_function_dance( + success, value = try_array_function_override( func=broadcast_to, relevant_arguments=[array], args=(array,), @@ -225,41 +276,61 @@ might be affected by this change: if success: return value - ... # continue with the definition of broadcast_to + ... # continue with the definition of broadcast_to def concatenate(arrays, axis=0, out=None) - success, value = do_array_function_dance( + success, value = try_array_function_override( func=concatenate, - relevant_arguments=[arrays, out], + relevant_arguments=itertools.chain(arrays, [out]), args=(arrays,), kwargs=dict(axis=axis, out=out)) if success: return value - ... # continue with the definition of concatenate + ... # continue with the definition of concatenate The list of objects passed to ``relevant_arguments`` are those that should be inspected for ``__array_function__`` implementations. -Alternatively, we could write these overloads with a decorator, e.g., +Our microbenchmark results show that a pure Python implementation of +``try_array_function_override`` adds approximately 2-4 microseconds of +overhead to each function call without any overloaded arguments. +This is acceptable for functions implemented in Python but probably too +slow for functions written in C. Fortunately, we expect significantly less +overhead with a C implementation of ``try_array_function_override``. -.. code:: python +A more succinct alternative would be to write these overloads with a decorator +that builds overloaded functions automatically. Hypothetically, this might even +directly parse Python 3 type annotations, e.g., perhaps - @overload_for_array_function(['array']) - def broadcast_to(array, shape, subok=False): - ... # continue with the definition of broadcast_to +.. code:: python - @overload_for_array_function(['arrays', 'out']) - def concatenate(arrays, axis=0, out=None): - ... # continue with the definition of concatenate + @overload_for_array_function + def broadcast_to(array: ArrayLike + shape: Tuple[int, ...], + subok: bool = False): + ... # continue with the definition of broadcast_to The decorator ``overload_for_array_function`` would be written in terms -of ``do_array_function_dance``. - -The downside of this approach would be a loss of introspection capability -for NumPy functions on Python 2, since this requires the use of -``inspect.Signature`` (only available on Python 3). However, NumPy won't -be supporting Python 2 for `very much longer <http://www.numpy.org/neps/nep-0014-dropping-python2.7-proposal.html>`_. +of ``try_array_function_override``, but would also need some level of magic +for (1) access to the wrapper function (``np.broadcast_to``) for passing into +``__array_function__`` implementations and (2) dynamic code generation +resembling the `decorator library <https://github.com/micheles/decorator>`_ +to automatically write an overloaded function like the manually written +implemenations above with the exact same signature as the original. +Unfortunately, using the ``inspect`` module instead of code generation would +probably be too slow: our prototype implementation adds ~15 microseconds of +overhead. + +We like the idea of writing overloads with minimal syntax, but dynamic +code generation also has potential downsides, such as slower import times, less +transparent code and added difficulty for static analysis tools. It's not clear +that tradeoffs would be worth it, especially because functions with complex +signatures like ``np.einsum`` would assuredly still need to invoke +``try_array_function_override`` directly. + +So we don't propose adding such a decorator yet, but it's something worth +considering for the future. Use outside of NumPy ~~~~~~~~~~~~~~~~~~~~ @@ -276,8 +347,8 @@ to be explicitly recognized. Libraries like Dask, CuPy, and Autograd already wrap a limited subset of SciPy functionality (e.g., ``scipy.linalg``) similarly to how they wrap NumPy. -If we want to do this, we should consider exposing the helper function -``do_array_function_dance()`` above as a public API. +If we want to do this, we should expose the helper function +``try_array_function_override()`` as a public API. Non-goals --------- @@ -332,7 +403,7 @@ Specialized protocols ~~~~~~~~~~~~~~~~~~~~~ We could (and should) continue to develop protocols like -``__array_ufunc__`` for cohesive subsets of Numpy functionality. +``__array_ufunc__`` for cohesive subsets of NumPy functionality. As mentioned above, if this means that some functions that we overload with ``__array_function__`` should switch to a new protocol instead, @@ -358,6 +429,11 @@ functions from ``numpy`` itself are already overloaded (but inadequately), so confusion about high vs. low level APIs in NumPy would still persist. +Alternatively, a separate namespace, e.g., ``numpy.array_only``, could be +created for a non-overloaded version of NumPy's high level API, for cases +where performance with NumPy arrays is a critical concern. This has most +of the same downsides as the separate namespace. + Multiple dispatch ~~~~~~~~~~~~~~~~~ @@ -385,30 +461,33 @@ Implementations in terms of a limited core API ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The internal implemenations of some NumPy functions is extremely simple. -For example: - ``np.stack()`` is implemented in only a few lines of code -by combining indexing with ``np.newaxis``, ``np.concatenate`` and the -``shape`` attribute. - ``np.mean()`` is implemented internally in terms -of ``np.sum()``, ``np.divide()``, ``.astype()`` and ``.shape``. +For example: + +- ``np.stack()`` is implemented in only a few lines of code by combining + indexing with ``np.newaxis``, ``np.concatenate`` and the ``shape`` attribute. +- ``np.mean()`` is implemented internally in terms of ``np.sum()``, + ``np.divide()``, ``.astype()`` and ``.shape``. This suggests the possibility of defining a minimal "core" ndarray interface, and relying upon it internally in NumPy to implement the full API. This is an attractive option, because it could significantly reduce the work required for new array implementations. -However, this also comes with several downsides: 1. The details of how -NumPy implements a high-level function in terms of overloaded functions -now becomes an implicit part of NumPy's public API. For example, -refactoring ``stack`` to use ``np.block()`` instead of -``np.concatenate()`` internally would now become a breaking change. 2. -Array libraries may prefer to implement high level functions differently -than NumPy. For example, a library might prefer to implement a -fundamental operations like ``mean()`` directly rather than relying on -``sum()`` followed by division. More generally, it's not clear yet what -exactly qualifies as core functionality, and figuring this out could be -a large project. 3. We don't yet have an overloading system for -attributes and methods on array objects, e.g., for accessing ``.dtype`` -and ``.shape``. This should be the subject of a future NEP, but until -then we should be reluctant to rely on these properties. +However, this also comes with several downsides: + +1. The details of how NumPy implements a high-level function in terms of + overloaded functions now becomes an implicit part of NumPy's public API. For + example, refactoring ``stack`` to use ``np.block()`` instead of + ``np.concatenate()`` internally would now become a breaking change. +2. Array libraries may prefer to implement high level functions differently than + NumPy. For example, a library might prefer to implement a fundamental + operations like ``mean()`` directly rather than relying on ``sum()`` followed + by division. More generally, it's not clear yet what exactly qualifies as + core functionality, and figuring this out could be a large project. +3. We don't yet have an overloading system for attributes and methods on array + objects, e.g., for accessing ``.dtype`` and ``.shape``. This should be the + subject of a future NEP, but until then we should be reluctant to rely on + these properties. Given these concerns, we encourage relying on this approach only in limited cases. @@ -438,29 +517,37 @@ make it impossible to implement this generic fallback behavior for ``__array_function__``. We could resolve this issue by change the handling of return values in -``__array_function__`` in either of two possible ways: 1. Change the -meaning of all arguments returning ``NotImplemented`` to indicate that -all arguments should be coerced to NumPy arrays instead. However, many -array libraries (e.g., scipy.sparse) really don't want implicit -conversions to NumPy arrays, and often avoid implementing ``__array__`` -for exactly this reason. Implicit conversions can result in silent bugs -and performance degradation. 2. Use another sentinel value of some sort -to indicate that a class implementing part of the higher level array API -is coercible as a fallback, e.g., a return value of -``np.NotImplementedButCoercible`` from ``__array_function__``. - -If we take this second approach, we would need to define additional -rules for how coercible array arguments are coerced, e.g., - Would we -try for ``__array_function__`` overloads again after coercing coercible -arguments? - If so, would we coerce coercible arguments one-at-a-time, -or all-at-once? - -These are slightly tricky design questions, so for now we propose to -defer this issue. We can always implement -``np.NotImplementedButCoercible`` at some later time if it proves -critical to the numpy community in the future. Importantly, we don't -think this will stop critical libraries that desire to implement most of -the high level NumPy API from adopting this proposal. +``__array_function__`` in either of two possible ways: + +1. Change the meaning of all arguments returning ``NotImplemented`` to indicate + that all arguments should be coerced to NumPy arrays and the operation + should be retried. However, many array libraries (e.g., scipy.sparse) really + don't want implicit conversions to NumPy arrays, and often avoid implementing + ``__array__`` for exactly this reason. Implicit conversions can result in + silent bugs and performance degradation. + + Potentially, we could enable this behavior only for types that implement + ``__array__``, which would resolve the most problematic cases like + scipy.sparse. But in practice, a large fraction of classes that present a + high level API like NumPy arrays already implement ``__array__``. This would + preclude reliable use of NumPy's high level API on these objects. +2. Use another sentinel value of some sort, e.g., + ``np.NotImplementedButCoercible``, to indicate that a class implementing part + of NumPy's higher level array API is coercible as a fallback. This is a more + appealing option. + +With either approach, we would need to define additional rules for *how* +coercible array arguments are coerced. The only sane rule would be to treat +these return values as equivalent to not defining an +``__array_function__`` method at all, which means that NumPy functions would +fall-back to their current behavior of coercing all array-like arguments. + +It is not yet clear to us yet if we need an optional like +``NotImplementedButCoercible``, so for now we propose to defer this issue. +We can always implement ``np.NotImplementedButCoercible`` at some later time if +it proves critical to the numpy community in the future. Importantly, we don't +think this will stop critical libraries that desire to implement most of the +high level NumPy API from adopting this proposal. NOTE: If you are reading this NEP in its draft state and disagree, please speak up on the mailing list! @@ -512,32 +599,21 @@ Customizing the detailed behavior of array libraries will require using library specific functions, which could be limiting in the case of libraries that consume the NumPy API such as xarray. - Discussion ---------- Various alternatives to this proposal were discussed in a few Github issues: -1. `pydata/sparse #1 <https://github.com/pydata/sparse/issues/1>`_ -2. `numpy/numpy #11129 <https://github.com/numpy/numpy/issues/11129>`_ +1. `pydata/sparse #1 <https://github.com/pydata/sparse/issues/1>`_ +2. `numpy/numpy #11129 <https://github.com/numpy/numpy/issues/11129>`_ Additionally it was the subject of `a blogpost -<http://matthewrocklin.com/blog/work/2018/05/27/beyond-numpy>`_ Following this +<http://matthewrocklin.com/blog/work/2018/05/27/beyond-numpy>`_. Following this it was discussed at a `NumPy developer sprint <https://scisprints.github.io/#may-numpy-developer-sprint>`_ at the `UC Berkeley Institute for Data Science (BIDS) <https://bids.berkeley.edu/>`_. - -References and Footnotes ------------------------- - -.. [1] Each NEP must either be explicitly labeled as placed in the public domain (see - this NEP as an example) or licensed under the `Open Publication License`_. - -.. _Open Publication License: http://www.opencontent.org/openpub/ - - Copyright --------- -This document has been placed in the public domain. [1]_ +This document has been placed in the public domain. diff --git a/doc/neps/nep-0020-gufunc-signature-enhancement.rst b/doc/neps/nep-0020-gufunc-signature-enhancement.rst new file mode 100644 index 000000000..903ee60cb --- /dev/null +++ b/doc/neps/nep-0020-gufunc-signature-enhancement.rst @@ -0,0 +1,252 @@ +====================================================== +Expansion of Generalized Universal Function Signatures +====================================================== + +:Author: Marten van Kerkwijk <mhvk@astro.utoronto.ca> +:Status: Draft +:Type: Standards Track +:Created: 2018-06-10 + +Abstract +-------- + +Generalized universal functions are, as their name indicates, generalization +of universal functions: they operate on non-scalar elements. Their signature +describes the structure of the elements they operate on, with names linking +dimensions of the operands that should be the same. Here, it is proposed to +extend the signature to allow the signature to indicate that a dimension (i) +has fixed size; (ii) can be absent; and (iii) can be broadcast. + +Detailed description +-------------------- + +Each part of the proposal is driven by specific needs [1]_. + +1. Fixed-size dimensions. Code working with spatial vectors often explicitly + is for 2 or 3-dimensional space (e.g., the code from the `Standards Of + Fundamental Astronomy <http://www.iausofa.org/>`_, which the author hopes + to wrap using gufuncs for astropy [2]_). The signature should be able to + indicate that. E.g., the signature of a function that converts a polar + angle to a two-dimensional cartesian unit vector would currently have to be + ``()->(n)``, with there being no way to indicate that ``n`` has to equal 2. + Indeed, this signature is particularly annoying since without putting in an + output argument, the current gufunc wrapper code fails because it cannot + determine ``n``. Similarly, the signature for an cross product of two + 3-dimensional vectors has to be ``(n),(n)->(n)``, with again no way to + indicate that ``n`` has to equal 3. Hence, the proposal here to allow one + to give numerical values in addition to variable names. Thus, angle to + two-dimensional unit vector would be ``()->(2)``; two angles to + three-dimensional unit vector ``(),()->(3)``; and that for the cross + product of two three-dimensional vectors would be ``(3),(3)->(3)``. + +2. Possibly missing dimensions. This part is almost entirely driven by the + wish to wrap ``matmul`` in a gufunc. ``matmul`` stands for matrix + multiplication, and if it did only that, it could be covered with the + signature ``(m,n),(n,p)->(m,p)``. However, it has special cases for when a + dimension is missing, allowing either argument to be treated as a single + vector, with the function thus becoming, effectively, vector-matrix, + matrix-vector, or vector-vector multiplication (but with no + broadcasting). To support this, it is suggested to allow postfixing a + dimension name with a question mark to indicate that the dimension does not + necessarily have to be present. + + With this addition, the signature for ``matmul`` can be expressed as + ``(m?,n),(n,p?)->(m?,p?)``. This indicates that if, e.g., the second + operand has only one dimension, for the purposes of the elementary function + it will be treated as if that input has core shape ``(n, 1)``, and the + output has the corresponding core shape of ``(m, 1)``. The actual output + array, however, has the flexible dimension removed, i.e., it will have + shape ``(..., m)``. Similarly, if both arguments have only a single + dimension, the inputs will be presented as having shapes ``(1, n)`` and + ``(n, 1)`` to the elementary function, and the output as ``(1, 1)``, while + the actual output array returned will have shape ``()``. In this way, the + signature allows one to use a single elementary function for four related + but different signatures, ``(m,n),(n,p)->(m,p)``, ``(n),(n,p)->(p)``, + ``(m,n),(n)->(m)`` and ``(n),(n)->()``. + +3. Dimensions that can be broadcast. For some applications, broadcasting + between operands makes sense. For instance, an ``all_equal`` function that + compares vectors in arrays could have a signature ``(n),(n)->()``, but this + forces both operands to be arrays, while it would be useful also to check + that, e.g., all parts of a vector are constant (maybe zero). The proposal + is to allow the implementer of a gufunc to indicate that a dimension can be + broadcast by post-fixing the dimension name with ``|1``. Hence, the + signature for ``all_equal`` would become ``(n|1),(n|1)->()``. The + signature seems handy more generally for "chained ufuncs"; e.g., another + application might be in a putative ufunc implementing ``sumproduct``. + + Another example that arose in the discussion, is of a weighted mean, which + might look like ``weighted_mean(y, sigma[, axis, ...])``, returning the + mean and its uncertainty. With a signature of ``(n),(n)->(),()``, one + would be forced to always give as many sigmas as there are data points, + while broadcasting would allow one to give a single sigma for all points + (which is still useful to calculate the uncertainty on the mean). + +Implementation +-------------- + +The proposed changes have all been implemented [3]_, [4]_, [5]_. These PRs +extend the ufunc structure with two new fields, each of size equal to the +number of distinct dimensions, with ``core_dim_sizes`` holding possibly fixed +sizes, and ``core_dim_flags`` holding flags indicating whether a dimension can +be missing or broadcast. To ensure we can distinguish between this new +version and previous versions, an unused entry ``reserved1`` is repurposed as +a version number. + +In the implementation, care is taken that to the elementary function flagged +dimensions are not treated any differently than non-flagged ones: for +instance, sizes of fixed-size dimensions are still passed on to the elementary +function (but the loop can now count on that size being equal to the fixed one +given in the signature). + +An implementation detail to be decided upon is whether it might be handy to +have a summary of all flags. This could possibly be stored in ``core_enabled`` +(which currently is a bool), with non-zero continuing to indicate a gufunc, +but specific flags indicating whether or not a gufunc uses fixed, flexible, or +broadcastable dimensions. + +With the above, the formal defition of the syntax would become [4]_:: + + <Signature> ::= <Input arguments> "->" <Output arguments> + <Input arguments> ::= <Argument list> + <Output arguments> ::= <Argument list> + <Argument list> ::= nil | <Argument> | <Argument> "," <Argument list> + <Argument> ::= "(" <Core dimension list> ")" + <Core dimension list> ::= nil | <Core dimension> | + <Core dimension> "," <Core dimension list> + <Core dimension> ::= <Dimension name> <Dimension modifier> + <Dimension name> ::= valid Python variable name | valid integer + <Dimension modifier> ::= nil | "|1" | "?" + +#. All quotes are for clarity. +#. Unmodified core dimensions that share the same name must have the same size. + Each dimension name typically corresponds to one level of looping in the + elementary function's implementation. +#. White spaces are ignored. +#. An integer as a dimension name freezes that dimension to the value. +#. If a name if suffixed with the ``|1`` modifier, it is allowed to broadcast + against other dimensions with the same name. All input dimensions + must share this modifier, while no output dimensions should have it. +#. If the name is suffixed with the ``?`` modifier, the dimension is a core + dimension only if it exists on all inputs and outputs that share it; + otherwise it is ignored (and replaced by a dimension of size 1 for the + elementary function). + +Examples of signatures [4]_: + ++----------------------------+-----------------------------------+ +| Signature | Possible use | ++----------------------------+-----------------------------------+ +| ``(),()->()`` | Addition | ++----------------------------+-----------------------------------+ +| ``(i)->()`` | Sum over last axis | ++----------------------------+-----------------------------------+ +| ``(i|1),(i|1)->()`` | Test for equality along axis, | +| | allowing comparison with a scalar | ++----------------------------+-----------------------------------+ +| ``(i),(i)->()`` | inner vector product | ++----------------------------+-----------------------------------+ +| ``(m,n),(n,p)->(m,p)`` | matrix multiplication | ++----------------------------+-----------------------------------+ +| ``(n),(n,p)->(p)`` | vector-matrix multiplication | ++----------------------------+-----------------------------------+ +| ``(m,n),(n)->(m)`` | matrix-vector multiplication | ++----------------------------+-----------------------------------+ +| ``(m?,n),(n,p?)->(m?,p?)`` | all four of the above at once, | +| | except vectors cannot have loop | +| | dimensions (ie, like ``matmul``) | ++----------------------------+-----------------------------------+ +| ``(3),(3)->(3)`` | cross product for 3-vectors | ++----------------------------+-----------------------------------+ +| ``(i,t),(j,t)->(i,j)`` | inner over the last dimension, | +| | outer over the second to last, | +| | and loop/broadcast over the rest. | ++----------------------------+-----------------------------------+ + +Backward compatibility +---------------------- + +One possible worry is the change in ufunc structure. For most applications, +which call ``PyUFunc_FromDataAndSignature``, this is entirely transparent. +Furthermore, by repurposing ``reserved1`` as a version number, code compiled +against older versions of numpy will continue to work (though one will get a +warning upon import of that code with a newer version of numpy), except if +code explicitly changes the ``reserved1`` entry. + +Alternatives +------------ + +It was suggested instead of extending the signature, to have multiple +dispatch, so that, e.g., ``matmul`` would simply have the multiple signatures +it supports, i.e., instead of ``(m?,n),(n,p?)->(m?,p?)`` one would have +``(m,n),(n,p)->(m,p) | (n),(n,p)->(p) | (m,n),(n)->(m) | (n),(n)->()``. A +disadvantage of this is that the developer now has to make sure that the +elementary function can deal with these different signatures. Furthermore, +the expansion quickly becomes cumbersome. For instance, for the ``all_equal`` +signature of ``(n|1),(n|1)->()``, one would have to have five entries: +``(n),(n)->() | (n),(1)->() | (1),(n)->() | (n),()->() | (),(n)->()``. For +signatures like ``(m|1,n|1,o|1),(m|1,n|1,o|1)->()`` (from the ``cube_equal`` +test case in [4]_), it is not even worth writing out the expansion. + +For broadcasting, the alternative suffix of ``^`` was suggested (as +broadcasting can be thought of as increasing the size of the array). This +seems less clear. Furthermore, it was wondered whether it should not just be +an all-or-nothing flag. This could be the case, though given the postfix +for flexible dimensions, arguably another postfix is clearer (as is the +implementation). + +Discussion +---------- + +The proposals here were discussed at fair length on the mailing list [6]_, +[7]_. The main points of contention were whether the use cases were +sufficiently strong. In particular, for frozen dimensions, it was argued that +checks on the right number could be put in loop selection code. This seems +much less clear for no benefit. + +For broadcasting, the lack of examples of elementary functions that might need +it was noted, with it being questioned whether something like ``all_equal`` +was best done with a gufunc rather than as a special method on ``np.equal``. +One counter-argument to this would be that there is an actual PR for +``all_equal`` [8]_. Another that even if one were to use a method, it would +be good to be able to express their signature (just as is possible at least +for ``reduce`` and ``accumulate``). + +A final argument was that we were making the gufuncs too complex. This +arguably holds for the dimensions that can be omitted, but that also has the +strongest use case. The frozen dimensions has a very simple implementation and +its meaning is obvious. The ability to broadcast is simple too, once the +flexible dimensions are supported. + +References and Footnotes +------------------------ + +.. [1] Identified needs and suggestions for the implementation are not all by + the author. In particular, the suggestion for fixed dimensions and + initial implementation was by Jaime Frio (`gh-5015 + <https://github.com/numpy/numpy/pull/5015>`_), the suggestion of ``?`` + to indicate dimensions can be omitted was by Nathaniel Smith, and the + initial implementation of that by Matti Picus (`gh-11132 + <https://github.com/numpy/numpy/pull/11132>`_). +.. [2] `wrap ERFA functions in gufuncs + <https://github.com/astropy/astropy/pull/7502>`_ (`ERFA + <https://github.com/liberfa/erfa>`_) is the less stringently licensed + version of `Standards Of Fundamental Astronomy + <http://www.iausofa.org/>`_ +.. [3] `fixed-size and flexible dimensions + <https://github.com/numpy/numpy/pull/11175>`_ +.. [4] `broadcastable dimensions + <https://github.com/numpy/numpy/pull/11179>`_ +.. [5] `use in matmul <https://github.com/numpy/numpy/pull/11133>`_ +.. [6] Discusses implementations for ``matmul``: + https://mail.python.org/pipermail/numpy-discussion/2018-May/077972.html, + https://mail.python.org/pipermail/numpy-discussion/2018-May/078021.html +.. [7] Broadcasting: + https://mail.python.org/pipermail/numpy-discussion/2018-May/078078.html +.. [8] `Logical gufuncs <https://github.com/numpy/numpy/pull/8528>`_ (includes + ``all_equal``) + +Copyright +--------- + +This document has been placed in the public domain. diff --git a/doc/neps/nep-template.rst b/doc/neps/nep-template.rst index 26515127d..e869ebae3 100644 --- a/doc/neps/nep-template.rst +++ b/doc/neps/nep-template.rst @@ -64,7 +64,7 @@ References and Footnotes .. [1] Each NEP must either be explicitly labeled as placed in the public domain (see this NEP as an example) or licensed under the `Open Publication License`_. -.. _Open Publication License: http://www.opencontent.org/openpub/ +.. _Open Publication License: https://www.opencontent.org/openpub/ Copyright diff --git a/doc/release/1.14.5-notes.rst b/doc/release/1.14.5-notes.rst new file mode 100644 index 000000000..9a97cc033 --- /dev/null +++ b/doc/release/1.14.5-notes.rst @@ -0,0 +1,30 @@ +========================== +NumPy 1.14.5 Release Notes +========================== + +This is a bugfix release for bugs reported following the 1.14.4 release. The +most significant fixes are: + +* fixes for compilation errors on alpine and NetBSD + +The Python versions supported in this release are 2.7 and 3.4 - 3.6. The Python +3.6 wheels available from PIP are built with Python 3.6.2 and should be +compatible with all previous versions of Python 3.6. The source releases were +cythonized with Cython 0.28.2 and should work for the upcoming Python 3.7. + +Contributors +============ + +A total of 1 person contributed to this release. People with a "+" by their +names contributed a patch for the first time. + +* Charles Harris + +Pull requests merged +==================== + +A total of 2 pull requests were merged for this release. + +* `#11274 <https://github.com/numpy/numpy/pull/11274>`__: BUG: Correct use of NPY_UNUSED. +* `#11294 <https://github.com/numpy/numpy/pull/11294>`__: BUG: Remove extra trailing parentheses. + diff --git a/doc/release/1.16.0-notes.rst b/doc/release/1.16.0-notes.rst new file mode 100644 index 000000000..701ef1f6e --- /dev/null +++ b/doc/release/1.16.0-notes.rst @@ -0,0 +1,39 @@ +========================== +NumPy 1.16.0 Release Notes +========================== + + +Highlights +========== + + +New functions +============= + + +Deprecations +============ + + +Future Changes +============== + + +Compatibility notes +=================== + + +C API changes +============= + + +New Features +============ + + +Improvements +============ + + +Changes +======= diff --git a/doc/release/1.3.0-notes.rst b/doc/release/1.3.0-notes.rst index 3ec93e0b0..239714246 100644 --- a/doc/release/1.3.0-notes.rst +++ b/doc/release/1.3.0-notes.rst @@ -14,7 +14,7 @@ Python 2.6 support Python 2.6 is now supported on all previously supported platforms, including windows. -http://www.python.org/dev/peps/pep-0361/ +https://www.python.org/dev/peps/pep-0361/ Generalized ufuncs ------------------ @@ -235,7 +235,7 @@ This should make the porting to new platforms easier, and more robust. In particular, the configuration stage does not need to execute any code on the target platform, which is a first step toward cross-compilation. -http://numpy.github.io/neps/math_config_clean.html +https://www.numpy.org/neps/nep-0003-math_config_clean.html umath refactor -------------- @@ -247,7 +247,7 @@ Improvements to build warnings Numpy can now build with -W -Wall without warnings -http://numpy.github.io/neps/warnfix.html +https://www.numpy.org/neps/nep-0002-warnfix.html Separate core math library -------------------------- diff --git a/doc/release/1.7.0-notes.rst b/doc/release/1.7.0-notes.rst index 72aab4d4f..09e6924e6 100644 --- a/doc/release/1.7.0-notes.rst +++ b/doc/release/1.7.0-notes.rst @@ -101,7 +101,7 @@ to NumPy 1.6: The notes in `doc/source/reference/arrays.datetime.rst <https://github.com/numpy/numpy/blob/maintenance/1.7.x/doc/source/reference/arrays.datetime.rst>`_ (also available in the online docs at `arrays.datetime.html -<http://docs.scipy.org/doc/numpy/reference/arrays.datetime.html>`_) should be +<https://docs.scipy.org/doc/numpy/reference/arrays.datetime.html>`_) should be consulted for more details. Custom formatter for printing arrays diff --git a/doc/release/template.rst b/doc/release/template.rst new file mode 100644 index 000000000..fdfec2be9 --- /dev/null +++ b/doc/release/template.rst @@ -0,0 +1,43 @@ +========================== +NumPy 1.xx.x Release Notes +========================== + + +Highlights +========== + + +New functions +============= + + +Deprecations +============ + + +Future Changes +============== + + +Expired deprecations +==================== + + +Compatibility notes +=================== + + +C API changes +============= + + +New Features +============ + + +Improvements +============ + + +Changes +======= diff --git a/doc/release/time_based_proposal.rst b/doc/release/time_based_proposal.rst index 555be6863..2eb13562d 100644 --- a/doc/release/time_based_proposal.rst +++ b/doc/release/time_based_proposal.rst @@ -123,7 +123,7 @@ References * Proposed schedule for Gnome from Havoc Pennington (one of the core GTK and Gnome manager): - http://mail.gnome.org/archives/gnome-hackers/2002-June/msg00041.html + https://mail.gnome.org/archives/gnome-hackers/2002-June/msg00041.html The proposed schedule is heavily based on this email - * http://live.gnome.org/ReleasePlanning/Freezes + * https://wiki.gnome.org/ReleasePlanning/Freezes diff --git a/doc/source/_templates/indexcontent.html b/doc/source/_templates/indexcontent.html index fbd8930ae..008eaaa7c 100644 --- a/doc/source/_templates/indexcontent.html +++ b/doc/source/_templates/indexcontent.html @@ -36,7 +36,7 @@ <td width="50%"> <p class="biglink"><a class="biglink" href="{{ pathto("bugs") }}">Reporting bugs</a></p> <p class="biglink"><a class="biglink" href="{{ pathto("about") }}">About NumPy</a></p> - <p class="biglink"><a class="biglink" href="http://www.numpy.org/neps/index.html"> + <p class="biglink"><a class="biglink" href="https://www.numpy.org/neps/index.html"> NumPy Enhancement Proposals</a><br/> </td><td width="50%"> <p class="biglink"><a class="biglink" href="{{ pathto("release") }}">Release Notes</a></p> diff --git a/doc/source/_templates/indexsidebar.html b/doc/source/_templates/indexsidebar.html index 9edb003af..51e7c4308 100644 --- a/doc/source/_templates/indexsidebar.html +++ b/doc/source/_templates/indexsidebar.html @@ -1,4 +1,4 @@ <h3>Resources</h3> <ul> - <li><a href="http://scipy.org/">Scipy.org website</a></li> + <li><a href="https://scipy.org/">Scipy.org website</a></li> </ul> diff --git a/doc/source/about.rst b/doc/source/about.rst index 776488ea4..cc3dd46b9 100644 --- a/doc/source/about.rst +++ b/doc/source/about.rst @@ -32,13 +32,13 @@ even better, contact us and participate in fixing the problem. Our main means of communication are: -- `scipy.org website <http://scipy.org/>`__ +- `scipy.org website <https://scipy.org/>`__ -- `Mailing lists <http://scipy.org/Mailing_Lists>`__ +- `Mailing lists <https://scipy.org/scipylib/mailing-lists.html>`__ - `NumPy Issues <https://github.com/numpy/numpy/issues>`__ (bug reports go here) -- `Old NumPy Trac <http://projects.scipy.org/numpy>`__ (no longer used) +- `Old NumPy Trac <http://projects.scipy.org/numpy>`__ (dead link) More information about the development of NumPy can be found at our `Developer Zone <https://scipy.scipy.org/scipylib/dev-zone.html>`__. diff --git a/doc/source/bugs.rst b/doc/source/bugs.rst index 950934b14..304a4136a 100644 --- a/doc/source/bugs.rst +++ b/doc/source/bugs.rst @@ -5,7 +5,7 @@ Reporting bugs File bug reports or feature requests, and make contributions (e.g. code patches), by opening a "new issue" on GitHub: -- NumPy Issues: http://github.com/numpy/numpy/issues +- NumPy Issues: https://github.com/numpy/numpy/issues Please give as much information as you can in the ticket. It is extremely useful if you can supply a small self-contained code snippet that reproduces @@ -15,5 +15,5 @@ the milestone. Report bugs to the appropriate GitHub project (there is one for NumPy and a different one for SciPy). -More information can be found on the http://scipy.org/Developer_Zone -website. +More information can be found on the +https://www.scipy.org/scipylib/dev-zone.html website. diff --git a/doc/source/conf.py b/doc/source/conf.py index 1472f5155..93a5ea01e 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -104,8 +104,8 @@ if 'scipyorg' in tags: "edit_link": True, "sidebar": "right", "scipy_org_logo": True, - "rootlinks": [("http://scipy.org/", "Scipy.org"), - ("http://docs.scipy.org/", "Docs")] + "rootlinks": [("https://scipy.org/", "Scipy.org"), + ("https://docs.scipy.org/", "Docs")] } else: # Default build @@ -341,8 +341,8 @@ def linkcode_resolve(domain, info): fn = relpath(fn, start=dirname(numpy.__file__)) if 'dev' in numpy.__version__: - return "http://github.com/numpy/numpy/blob/master/numpy/%s%s" % ( + return "https://github.com/numpy/numpy/blob/master/numpy/%s%s" % ( fn, linespec) else: - return "http://github.com/numpy/numpy/blob/v%s/numpy/%s%s" % ( + return "https://github.com/numpy/numpy/blob/v%s/numpy/%s%s" % ( numpy.__version__, fn, linespec) diff --git a/doc/source/dev/gitwash/development_workflow.rst b/doc/source/dev/gitwash/development_workflow.rst index c6884a7cf..9561e25f7 100644 --- a/doc/source/dev/gitwash/development_workflow.rst +++ b/doc/source/dev/gitwash/development_workflow.rst @@ -374,7 +374,7 @@ Deleting a branch on github_ git push origin :my-unwanted-branch (Note the colon ``:`` before ``test-branch``. See also: -http://github.com/guides/remove-a-remote-branch +https://github.com/guides/remove-a-remote-branch Several people sharing a single repository @@ -387,7 +387,7 @@ share it via github_. First fork NumPy into your account, as from :ref:`forking`. Then, go to your forked repository github page, say -``http://github.com/your-user-name/numpy`` +``https://github.com/your-user-name/numpy`` Click on the 'Admin' button, and add anyone else to the repo as a collaborator: diff --git a/doc/source/dev/gitwash/git_links.inc b/doc/source/dev/gitwash/git_links.inc index 30532da99..cebbb3a67 100644 --- a/doc/source/dev/gitwash/git_links.inc +++ b/doc/source/dev/gitwash/git_links.inc @@ -9,57 +9,57 @@ nipy, NIPY, Nipy, etc... .. git stuff -.. _git: http://git-scm.com/ -.. _github: http://github.com -.. _github help: http://help.github.com -.. _msysgit: http://code.google.com/p/msysgit/downloads/list -.. _git-osx-installer: http://code.google.com/p/git-osx-installer/downloads/list +.. _git: https://git-scm.com/ +.. _github: https://github.com +.. _github help: https://help.github.com +.. _msysgit: https://code.google.com/p/msysgit/downloads/list +.. _git-osx-installer: https://code.google.com/p/git-osx-installer/downloads/list .. _subversion: http://subversion.tigris.org/ -.. _git cheat sheet: http://github.com/guides/git-cheat-sheet -.. _pro git book: http://progit.org/ -.. _git svn crash course: http://git-scm.com/course/svn.html -.. _learn.github: http://learn.github.com/ -.. _network graph visualizer: http://github.com/blog/39-say-hello-to-the-network-graph-visualizer -.. _git user manual: http://www.kernel.org/pub/software/scm/git/docs/user-manual.html -.. _git tutorial: http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html -.. _git community book: http://book.git-scm.com/ +.. _git cheat sheet: http://cheat.errtheblog.com/s/git +.. _pro git book: https://git-scm.com/book/ +.. _git svn crash course: https://git-scm.com/course/svn.html +.. _learn.github: https://learn.github.com/ +.. _network graph visualizer: https://github.com/blog/39-say-hello-to-the-network-graph-visualizer +.. _git user manual: https://www.kernel.org/pub/software/scm/git/docs/user-manual.html +.. _git tutorial: https://www.kernel.org/pub/software/scm/git/docs/gittutorial.html +.. _git community book: https://book.git-scm.com/ .. _git ready: http://www.gitready.com/ .. _git casts: http://www.gitcasts.com/ .. _Fernando's git page: http://www.fperez.org/py4science/git.html .. _git magic: http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html .. _git concepts: http://www.eecs.harvard.edu/~cduan/technical/git/ -.. _git clone: http://www.kernel.org/pub/software/scm/git/docs/git-clone.html -.. _git checkout: http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html -.. _git commit: http://www.kernel.org/pub/software/scm/git/docs/git-commit.html -.. _git push: http://www.kernel.org/pub/software/scm/git/docs/git-push.html -.. _git pull: http://www.kernel.org/pub/software/scm/git/docs/git-pull.html -.. _git add: http://www.kernel.org/pub/software/scm/git/docs/git-add.html -.. _git status: http://www.kernel.org/pub/software/scm/git/docs/git-status.html -.. _git diff: http://www.kernel.org/pub/software/scm/git/docs/git-diff.html -.. _git log: http://www.kernel.org/pub/software/scm/git/docs/git-log.html -.. _git branch: http://www.kernel.org/pub/software/scm/git/docs/git-branch.html -.. _git remote: http://www.kernel.org/pub/software/scm/git/docs/git-remote.html -.. _git config: http://www.kernel.org/pub/software/scm/git/docs/git-config.html +.. _git clone: https://www.kernel.org/pub/software/scm/git/docs/git-clone.html +.. _git checkout: https://www.kernel.org/pub/software/scm/git/docs/git-checkout.html +.. _git commit: https://www.kernel.org/pub/software/scm/git/docs/git-commit.html +.. _git push: https://www.kernel.org/pub/software/scm/git/docs/git-push.html +.. _git pull: https://www.kernel.org/pub/software/scm/git/docs/git-pull.html +.. _git add: https://www.kernel.org/pub/software/scm/git/docs/git-add.html +.. _git status: https://www.kernel.org/pub/software/scm/git/docs/git-status.html +.. _git diff: https://www.kernel.org/pub/software/scm/git/docs/git-diff.html +.. _git log: https://www.kernel.org/pub/software/scm/git/docs/git-log.html +.. _git branch: https://www.kernel.org/pub/software/scm/git/docs/git-branch.html +.. _git remote: https://www.kernel.org/pub/software/scm/git/docs/git-remote.html +.. _git config: https://www.kernel.org/pub/software/scm/git/docs/git-config.html .. _why the -a flag?: http://www.gitready.com/beginner/2009/01/18/the-staging-area.html .. _git staging area: http://www.gitready.com/beginner/2009/01/18/the-staging-area.html -.. _tangled working copy problem: http://tomayko.com/writings/the-thing-about-git +.. _tangled working copy problem: https://tomayko.com/writings/the-thing-about-git .. _git management: http://kerneltrap.org/Linux/Git_Management -.. _linux git workflow: http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39091.html +.. _linux git workflow: https://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39091.html .. _ipython git workflow: http://mail.python.org/pipermail/ipython-dev/2010-October/006746.html .. _git parable: http://tom.preston-werner.com/2009/05/19/the-git-parable.html .. _git foundation: http://matthew-brett.github.com/pydagogue/foundation.html .. _numpy/master: https://github.com/numpy/numpy .. _git cherry-pick: https://www.kernel.org/pub/software/scm/git/docs/git-cherry-pick.html .. _git blame: https://www.kernel.org/pub/software/scm/git/docs/git-blame.html -.. _this blog post: http://github.com/blog/612-introducing-github-compare-view -.. _this article on merging conflicts: http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging#Basic-Merge-Conflicts +.. _this blog post: https://github.com/blog/612-introducing-github-compare-view +.. _this article on merging conflicts: https://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging#Basic-Merge-Conflicts .. _learn git: https://www.atlassian.com/git/tutorials/ .. _filing pull requests: https://help.github.com/articles/using-pull-requests/#initiating-the-pull-request .. _pull request review: https://help.github.com/articles/using-pull-requests/#reviewing-the-pull-request .. other stuff -.. _python: http://www.python.org -.. _NumPy: http://www.numpy.org -.. _`NumPy github`: http://github.com/numpy/numpy -.. _`NumPy mailing list`: http://scipy.org/Mailing_Lists +.. _python: https://www.python.org +.. _NumPy: https://www.numpy.org +.. _`NumPy github`: https://github.com/numpy/numpy +.. _`NumPy mailing list`: https://scipy.org/scipylib/mailing-lists.html diff --git a/doc/source/dev/gitwash_links.txt b/doc/source/dev/gitwash_links.txt index f9536828c..36ca0b65f 100644 --- a/doc/source/dev/gitwash_links.txt +++ b/doc/source/dev/gitwash_links.txt @@ -1,3 +1,3 @@ -.. _NumPy: http://www.numpy.org -.. _`NumPy github`: http://github.com/numpy/numpy -.. _`NumPy mailing list`: http://scipy.org/Mailing_Lists +.. _NumPy: https://www.numpy.org +.. _`NumPy github`: https://github.com/numpy/numpy +.. _`NumPy mailing list`: https://scipy.org/scipylib/mailing-lists.html diff --git a/doc/source/docs/howto_build_docs.rst b/doc/source/docs/howto_build_docs.rst index 383bed96d..cdf490c37 100644 --- a/doc/source/docs/howto_build_docs.rst +++ b/doc/source/docs/howto_build_docs.rst @@ -10,11 +10,11 @@ documentation for NumPy. You will need Sphinx 1.0.1 or newer. If you only want to get the documentation, note that pre-built versions can be found at - http://docs.scipy.org/ + https://docs.scipy.org/ in several different formats. -.. _Sphinx: http://sphinx.pocoo.org +.. _Sphinx: http://www.sphinx-doc.org/ Instructions @@ -66,11 +66,11 @@ which will rebuild NumPy, install it to a temporary location, and build the documentation in all formats. This will most likely again only work on Unix platforms. -The documentation for NumPy distributed at http://docs.scipy.org in html and +The documentation for NumPy distributed at https://docs.scipy.org in html and pdf format is also built with ``make dist``. See `HOWTO RELEASE`_ for details on -how to update http://docs.scipy.org. +how to update https://docs.scipy.org. -.. _Matplotlib: http://matplotlib.org/ +.. _Matplotlib: https://matplotlib.org/ .. _HOWTO RELEASE: https://github.com/numpy/numpy/blob/master/doc/HOWTO_RELEASE.rst.txt Sphinx extensions @@ -83,5 +83,5 @@ above), and are automatically enabled when building NumPy's documentation. If you want to make use of these extensions in third-party projects, they are available on PyPi_ as the numpydoc_ package. -.. _PyPi: http://python.org/pypi -.. _numpydoc: http://python.org/pypi/numpydoc +.. _PyPi: https://pypi.org/ +.. _numpydoc: https://python.org/pypi/numpydoc diff --git a/doc/source/docs/howto_document.rst b/doc/source/docs/howto_document.rst index de7d06cf8..2a97a100d 100644 --- a/doc/source/docs/howto_document.rst +++ b/doc/source/docs/howto_document.rst @@ -4,7 +4,7 @@ A Guide to NumPy/SciPy Documentation ==================================== -When using `Sphinx <http://sphinx.pocoo.org/>`__ in combination with the +When using `Sphinx <http://www.sphinx-doc.org/>`__ in combination with the numpy conventions, you should use the ``numpydoc`` extension so that your docstrings will be handled correctly. For example, Sphinx will extract the ``Parameters`` section from your docstring and convert it into a field @@ -19,7 +19,7 @@ Some features described in this document require a recent version of It is available from: -* `numpydoc on PyPI <http://pypi.python.org/pypi/numpydoc>`_ +* `numpydoc on PyPI <https://pypi.python.org/pypi/numpydoc>`_ * `numpydoc on GitHub <https://github.com/numpy/numpydoc/>`_ Note that for documentation within numpy, it is not necessary to do diff --git a/doc/source/f2py/index.rst b/doc/source/f2py/index.rst index 8b7d1453a..d6773a76f 100644 --- a/doc/source/f2py/index.rst +++ b/doc/source/f2py/index.rst @@ -26,6 +26,5 @@ from Python. distutils advanced -.. _Python: http://www.python.org/ -.. _NumPy: http://www.numpy.org/ -.. _SciPy: http://www.numpy.org/ +.. _Python: https://www.python.org/ +.. _NumPy: https://www.numpy.org/ diff --git a/doc/source/f2py/signature-file.rst b/doc/source/f2py/signature-file.rst index bd926f33c..8e5a9710c 100644 --- a/doc/source/f2py/signature-file.rst +++ b/doc/source/f2py/signature-file.rst @@ -303,7 +303,7 @@ Other statements: ``pymethoddef`` statement can be used only inside ``python module`` block. - __ http://www.python.org/doc/current/ext/ext.html + __ https://docs.python.org/extending/index.html Attributes ------------ diff --git a/doc/source/reference/arrays.interface.rst b/doc/source/reference/arrays.interface.rst index 4a5fe62bf..f361ccb06 100644 --- a/doc/source/reference/arrays.interface.rst +++ b/doc/source/reference/arrays.interface.rst @@ -22,7 +22,7 @@ The Array Interface described here. __ http://cython.org/ -__ http://wiki.cython.org/tutorials/numpy +__ https://github.com/cython/cython/wiki/tutorials-numpy :version: 3 diff --git a/doc/source/reference/c-api.coremath.rst b/doc/source/reference/c-api.coremath.rst index ad92235da..82d248539 100644 --- a/doc/source/reference/c-api.coremath.rst +++ b/doc/source/reference/c-api.coremath.rst @@ -297,10 +297,10 @@ External Links: * `OpenGL Half Float Pixel Support`__ * `The OpenEXR image format`__. -__ http://ieeexplore.ieee.org/servlet/opac?punumber=4610933 -__ http://en.wikipedia.org/wiki/Half_precision_floating-point_format -__ http://www.opengl.org/registry/specs/ARB/half_float_pixel.txt -__ http://www.openexr.com/about.html +__ https://ieeexplore.ieee.org/document/4610935/ +__ https://en.wikipedia.org/wiki/Half-precision_floating-point_format +__ https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_half_float_pixel.txt +__ https://www.openexr.com/about.html .. c:var:: NPY_HALF_ZERO diff --git a/doc/source/reference/routines.io.rst b/doc/source/reference/routines.io.rst index 55489951f..8bb29b793 100644 --- a/doc/source/reference/routines.io.rst +++ b/doc/source/reference/routines.io.rst @@ -63,6 +63,7 @@ Text formatting options set_printoptions get_printoptions set_string_function + printoptions Base-n representations ---------------------- diff --git a/doc/source/reference/routines.ma.rst b/doc/source/reference/routines.ma.rst index 2408899b3..15f2ba0a4 100644 --- a/doc/source/reference/routines.ma.rst +++ b/doc/source/reference/routines.ma.rst @@ -126,6 +126,7 @@ Changing the number of dimensions ma.MaskedArray.squeeze + ma.stack ma.column_stack ma.concatenate ma.dstack @@ -141,6 +142,7 @@ Joining arrays .. autosummary:: :toctree: generated/ + ma.stack ma.column_stack ma.concatenate ma.append diff --git a/doc/source/reference/routines.statistics.rst b/doc/source/reference/routines.statistics.rst index e287fe9c8..c675b6090 100644 --- a/doc/source/reference/routines.statistics.rst +++ b/doc/source/reference/routines.statistics.rst @@ -56,4 +56,5 @@ Histograms histogram2d histogramdd bincount + histogram_bin_edges digitize diff --git a/doc/source/release.rst b/doc/source/release.rst index 913db1fab..e7166a454 100644 --- a/doc/source/release.rst +++ b/doc/source/release.rst @@ -2,7 +2,9 @@ Release Notes ************* +.. include:: ../release/1.16.0-notes.rst .. include:: ../release/1.15.0-notes.rst +.. include:: ../release/1.14.5-notes.rst .. include:: ../release/1.14.4-notes.rst .. include:: ../release/1.14.3-notes.rst .. include:: ../release/1.14.2-notes.rst diff --git a/doc/source/user/building.rst b/doc/source/user/building.rst index 76eb48487..d224951dd 100644 --- a/doc/source/user/building.rst +++ b/doc/source/user/building.rst @@ -16,7 +16,7 @@ Building NumPy requires the following software installed: On Debian and derivatives (Ubuntu): python, python-dev (or python3-dev) On Windows: the official python installer at - `www.python.org <http://www.python.org>`_ is enough + `www.python.org <https://www.python.org>`_ is enough Make sure that the Python package distutils is installed before continuing. For example, in Debian GNU/Linux, installing python-dev diff --git a/doc/source/user/c-info.beyond-basics.rst b/doc/source/user/c-info.beyond-basics.rst index 5c321088d..aee68f6e7 100644 --- a/doc/source/user/c-info.beyond-basics.rst +++ b/doc/source/user/c-info.beyond-basics.rst @@ -481,7 +481,7 @@ type(s). In particular, to create a sub-type in C follow these steps: module dictionary so it can be accessed from Python. More information on creating sub-types in C can be learned by reading -PEP 253 (available at http://www.python.org/dev/peps/pep-0253). +PEP 253 (available at https://www.python.org/dev/peps/pep-0253). Specific features of ndarray sub-typing diff --git a/doc/source/user/c-info.how-to-extend.rst b/doc/source/user/c-info.how-to-extend.rst index 22c3b6e90..9738168d2 100644 --- a/doc/source/user/c-info.how-to-extend.rst +++ b/doc/source/user/c-info.how-to-extend.rst @@ -36,7 +36,7 @@ into Python as if it were a standard python file. It will contain objects and methods that have been defined and compiled in C code. The basic steps for doing this in Python are well-documented and you can find more information in the documentation for Python itself available -online at `www.python.org <http://www.python.org>`_ . +online at `www.python.org <https://www.python.org>`_ . In addition to the Python C-API, there is a full and rich C-API for NumPy allowing sophisticated manipulations on a C-level. However, for diff --git a/doc/source/user/c-info.python-as-glue.rst b/doc/source/user/c-info.python-as-glue.rst index 0152ac549..750fdddf0 100644 --- a/doc/source/user/c-info.python-as-glue.rst +++ b/doc/source/user/c-info.python-as-glue.rst @@ -405,8 +405,8 @@ interface between Python and Fortran. There is decent documentation for f2py found in the numpy/f2py/docs directory where-ever NumPy is installed on your system (usually under site-packages). There is also more information on using f2py (including how to use it to wrap C -codes) at http://www.scipy.org/Cookbook under the "Using NumPy with -Other Languages" heading. +codes) at https://scipy-cookbook.readthedocs.io under the "Interfacing +With Other Languages" heading. The f2py method of linking compiled code is currently the most sophisticated and integrated approach. It allows clean separation of diff --git a/doc/source/user/c-info.ufunc-tutorial.rst b/doc/source/user/c-info.ufunc-tutorial.rst index 5818ff182..788a3429f 100644 --- a/doc/source/user/c-info.ufunc-tutorial.rst +++ b/doc/source/user/c-info.ufunc-tutorial.rst @@ -17,7 +17,7 @@ Creating a new universal function Before reading this, it may help to familiarize yourself with the basics of C extensions for Python by reading/skimming the tutorials in Section 1 of `Extending and Embedding the Python Interpreter -<http://docs.python.org/extending/index.html>`_ and in :doc:`How to extend +<https://docs.python.org/extending/index.html>`_ and in :doc:`How to extend NumPy <c-info.how-to-extend>` The umath module is a computer-generated C-module that creates many diff --git a/doc/source/user/install.rst b/doc/source/user/install.rst index dd7543645..52586f3d7 100644 --- a/doc/source/user/install.rst +++ b/doc/source/user/install.rst @@ -4,7 +4,7 @@ Installing NumPy In most use cases the best way to install NumPy on your system is by using a pre-built package for your operating system. Please see -http://scipy.org/install.html for links to available options. +https://scipy.org/install.html for links to available options. For instructions on building for source package, see :doc:`building`. This information is useful mainly for advanced users. diff --git a/doc/source/user/numpy-for-matlab-users.rst b/doc/source/user/numpy-for-matlab-users.rst index 475c68c04..399237c21 100644 --- a/doc/source/user/numpy-for-matlab-users.rst +++ b/doc/source/user/numpy-for-matlab-users.rst @@ -618,9 +618,9 @@ initial element of a sequence has index 0. Confusion and flamewars arise because each has advantages and disadvantages. One based indexing is consistent with common human language usage, where the "first" element of a sequence has index 1. Zero based indexing `simplifies -indexing <http://groups.google.com/group/comp.lang.python/msg/1bf4d925dfbf368?q=g:thl3498076713d&hl=en>`__. +indexing <https://groups.google.com/group/comp.lang.python/msg/1bf4d925dfbf368?q=g:thl3498076713d&hl=en>`__. See also `a text by prof.dr. Edsger W. -Dijkstra <http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html>`__. +Dijkstra <https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html>`__. \ **RANGES**: In MATLAB®, ``0:5`` can be used as both a range literal and a 'slice' index (inside parentheses); however, in Python, constructs @@ -715,6 +715,6 @@ See http://mathesaurus.sf.net/ for another MATLAB®/NumPy cross-reference. An extensive list of tools for scientific work with python can be -found in the `topical software page <http://scipy.org/topical-software.html>`__. +found in the `topical software page <https://scipy.org/topical-software.html>`__. MATLAB® and SimuLink® are registered trademarks of The MathWorks. diff --git a/doc/source/user/quickstart.rst b/doc/source/user/quickstart.rst index 57a7004cc..5ef8b145f 100644 --- a/doc/source/user/quickstart.rst +++ b/doc/source/user/quickstart.rst @@ -14,11 +14,11 @@ Prerequisites Before reading this tutorial you should know a bit of Python. If you would like to refresh your memory, take a look at the `Python -tutorial <http://docs.python.org/tut/>`__. +tutorial <https://docs.python.org/tutorial/>`__. If you wish to work the examples in this tutorial, you must also have some software installed on your computer. Please see -http://scipy.org/install.html for instructions. +https://scipy.org/install.html for instructions. The Basics ========== @@ -569,7 +569,7 @@ first axis:: However, if one wants to perform an operation on each element in the array, one can use the ``flat`` attribute which is an -`iterator <https://docs.python.org/2/tutorial/classes.html#iterators>`__ +`iterator <https://docs.python.org/tutorial/classes.html#iterators>`__ over all the elements of the array:: >>> for element in b.flat: @@ -1191,7 +1191,7 @@ This property can be very useful in assignments:: You can look at the following example to see how to use boolean indexing to generate an image of the `Mandelbrot -set <http://en.wikipedia.org/wiki/Mandelbrot_set>`__: +set <https://en.wikipedia.org/wiki/Mandelbrot_set>`__: .. plot:: @@ -1462,8 +1462,8 @@ that ``pylab.hist`` plots the histogram automatically, while Further reading =============== -- The `Python tutorial <http://docs.python.org/tutorial/>`__ +- The `Python tutorial <https://docs.python.org/tutorial/>`__ - :ref:`reference` - `SciPy Tutorial <https://docs.scipy.org/doc/scipy/reference/tutorial/index.html>`__ -- `SciPy Lecture Notes <http://www.scipy-lectures.org>`__ +- `SciPy Lecture Notes <https://www.scipy-lectures.org>`__ - A `matlab, R, IDL, NumPy/SciPy dictionary <http://mathesaurus.sf.net/>`__ diff --git a/numpy/__init__.py b/numpy/__init__.py index d250ed5ac..77b1d924d 100644 --- a/numpy/__init__.py +++ b/numpy/__init__.py @@ -11,10 +11,10 @@ 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 <http://www.scipy.org>`_. +`the NumPy homepage <https://www.scipy.org>`_. We recommend exploring the docstrings using -`IPython <http://ipython.scipy.org>`_, an advanced Python shell with +`IPython <https://ipython.org>`_, an advanced Python shell with TAB-completion and introspection capabilities. See below for further instructions. diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py index 9372b3431..d87c964c2 100644 --- a/numpy/add_newdocs.py +++ b/numpy/add_newdocs.py @@ -1452,7 +1452,7 @@ add_newdoc('numpy.core.multiarray', 'arange', Values are generated within the half-open interval ``[start, stop)`` (in other words, the interval including `start` but excluding `stop`). For integer arguments the function is equivalent to the Python built-in - `range <http://docs.python.org/lib/built-in-funcs.html>`_ function, + `range <https://docs.python.org/library/functions.html#func-range>`_ function, but returns an ndarray rather than a list. When using a non-integer step, such as 0.1, the results will often not diff --git a/numpy/core/code_generators/ufunc_docstrings.py b/numpy/core/code_generators/ufunc_docstrings.py index f7d58a26f..73da9d12c 100644 --- a/numpy/core/code_generators/ufunc_docstrings.py +++ b/numpy/core/code_generators/ufunc_docstrings.py @@ -233,7 +233,7 @@ add_newdoc('numpy.core.umath', 'arccosh', .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", 10th printing, 1964, pp. 86. http://www.math.sfu.ca/~cbm/aands/ .. [2] Wikipedia, "Inverse hyperbolic function", - http://en.wikipedia.org/wiki/Arccosh + https://en.wikipedia.org/wiki/Arccosh Examples -------- @@ -335,7 +335,7 @@ add_newdoc('numpy.core.umath', 'arcsinh', .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", 10th printing, 1964, pp. 86. http://www.math.sfu.ca/~cbm/aands/ .. [2] Wikipedia, "Inverse hyperbolic function", - http://en.wikipedia.org/wiki/Arcsinh + https://en.wikipedia.org/wiki/Arcsinh Examples -------- @@ -535,7 +535,7 @@ add_newdoc('numpy.core.umath', 'arctanh', .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", 10th printing, 1964, pp. 86. http://www.math.sfu.ca/~cbm/aands/ .. [2] Wikipedia, "Inverse hyperbolic function", - http://en.wikipedia.org/wiki/Arctanh + https://en.wikipedia.org/wiki/Arctanh Examples -------- @@ -1136,7 +1136,7 @@ add_newdoc('numpy.core.umath', 'exp', References ---------- .. [1] Wikipedia, "Exponential function", - http://en.wikipedia.org/wiki/Exponential_function + https://en.wikipedia.org/wiki/Exponential_function .. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69, http://www.math.sfu.ca/~cbm/aands/page_69.htm @@ -1551,7 +1551,7 @@ add_newdoc('numpy.core.umath', 'invert', References ---------- .. [1] Wikipedia, "Two's complement", - http://en.wikipedia.org/wiki/Two's_complement + https://en.wikipedia.org/wiki/Two's_complement Examples -------- @@ -1912,7 +1912,7 @@ add_newdoc('numpy.core.umath', 'log', ---------- .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", 10th printing, 1964, pp. 67. http://www.math.sfu.ca/~cbm/aands/ - .. [2] Wikipedia, "Logarithm". http://en.wikipedia.org/wiki/Logarithm + .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm Examples -------- @@ -1961,7 +1961,7 @@ add_newdoc('numpy.core.umath', 'log10', ---------- .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", 10th printing, 1964, pp. 67. http://www.math.sfu.ca/~cbm/aands/ - .. [2] Wikipedia, "Logarithm". http://en.wikipedia.org/wiki/Logarithm + .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm Examples -------- @@ -2147,7 +2147,7 @@ add_newdoc('numpy.core.umath', 'log1p', ---------- .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions", 10th printing, 1964, pp. 67. http://www.math.sfu.ca/~cbm/aands/ - .. [2] Wikipedia, "Logarithm". http://en.wikipedia.org/wiki/Logarithm + .. [2] Wikipedia, "Logarithm". https://en.wikipedia.org/wiki/Logarithm Examples -------- @@ -3578,7 +3578,7 @@ add_newdoc('numpy.core.umath', 'tanh', http://www.math.sfu.ca/~cbm/aands/ .. [2] Wikipedia, "Hyperbolic function", - http://en.wikipedia.org/wiki/Hyperbolic_function + https://en.wikipedia.org/wiki/Hyperbolic_function Examples -------- diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index d1aae0aa0..5b67a0dc5 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -2777,11 +2777,11 @@ def around(a, decimals=0, out=None): References ---------- - .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, - http://www.cs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF + .. [1] "Lecture Notes on the Status of IEEE 754", William Kahan, + https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF .. [2] "How Futile are Mindless Assessments of Roundoff in Floating-Point Computation?", William Kahan, - http://www.cs.berkeley.edu/~wkahan/Mindless.pdf + https://people.eecs.berkeley.edu/~wkahan/Mindless.pdf Examples -------- diff --git a/numpy/core/include/numpy/ndarraytypes.h b/numpy/core/include/numpy/ndarraytypes.h index cf73cecea..ec2893b21 100644 --- a/numpy/core/include/numpy/ndarraytypes.h +++ b/numpy/core/include/numpy/ndarraytypes.h @@ -1759,7 +1759,7 @@ typedef struct { /************************************************************ * This is the form of the struct that's returned pointed by the * PyCObject attribute of an array __array_struct__. See - * http://docs.scipy.org/doc/numpy/reference/arrays.interface.html for the full + * https://docs.scipy.org/doc/numpy/reference/arrays.interface.html for the full * documentation. ************************************************************/ typedef struct { diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 7ade3d224..106f0ccfe 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1010,7 +1010,8 @@ def convolve(a, v, mode='full'): References ---------- - .. [1] Wikipedia, "Convolution", http://en.wikipedia.org/wiki/Convolution. + .. [1] Wikipedia, "Convolution", + https://en.wikipedia.org/wiki/Convolution Examples -------- @@ -2015,7 +2016,7 @@ def binary_repr(num, width=None): References ---------- .. [1] Wikipedia, "Two's complement", - http://en.wikipedia.org/wiki/Two's_complement + https://en.wikipedia.org/wiki/Two's_complement Examples -------- @@ -2538,7 +2539,7 @@ def seterr(all=None, divide=None, over=None, under=None, invalid=None): - Invalid operation: result is not an expressible number, typically indicates that a NaN was produced. - .. [1] http://en.wikipedia.org/wiki/IEEE_754 + .. [1] https://en.wikipedia.org/wiki/IEEE_754 Examples -------- @@ -2914,15 +2915,13 @@ True_ = bool_(True) def extend_all(module): - adict = {} - for a in __all__: - adict[a] = 1 + existing = set(__all__) try: mall = getattr(module, '__all__') except AttributeError: mall = [k for k in module.__dict__.keys() if not k.startswith('_')] for a in mall: - if a not in adict: + if a not in existing: __all__.append(a) diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py index f7f25dd95..7cd80f432 100644 --- a/numpy/core/numerictypes.py +++ b/numpy/core/numerictypes.py @@ -213,6 +213,19 @@ sctypeDict = {} # Contains all leaf-node scalar types with aliases sctypeNA = {} # Contails all leaf-node types -> numarray type equivalences allTypes = {} # Collect the types we will add to the module here + +# separate the actual type info from the abtract 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 + + def _evalname(name): k = 0 for ch in name: @@ -236,7 +249,7 @@ def bitname(obj): newname = name[:-1] else: newname = name - info = typeinfo[english_upper(newname)] + info = _concrete_typeinfo[english_lower(newname)] assert(info.type == obj) # sanity check bits = info.bits @@ -283,29 +296,33 @@ def bitname(obj): def _add_types(): - for type_name, info in typeinfo.items(): - name = english_lower(type_name) - if not isinstance(info, type): - # 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 - - else: # generic class - allTypes[name] = info + 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 type_name, info in typeinfo.items(): - if isinstance(info, type): + 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 - name = english_lower(type_name) # insert bit-width version for this class (if relevant) base, bit, char = bitname(info.type) - if base[-3:] == 'int' or char[0] in 'ui': - continue if base != '': myname = "%s%d" % (base, bit) if (name not in ('longdouble', 'clongdouble') or @@ -333,21 +350,19 @@ def _add_aliases(): sctypeNA[char] = na_name _add_aliases() -# Integers are handled so that the int32 and int64 types should agree -# exactly with NPY_INT32, NPY_INT64. We need to enforce the same checking -# as is done in arrayobject.h where the order of getting a bit-width match -# is long, longlong, int, short, char. def _add_integer_aliases(): - _ctypes = ['LONG', 'LONGLONG', 'INT', 'SHORT', 'BYTE'] - for ctype in _ctypes: - i_info = typeinfo[ctype] - u_info = typeinfo['U'+ctype] + 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 intname not in allTypes.keys(): + 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 @@ -356,6 +371,9 @@ def _add_integer_aliases(): sctypeNA[charname] = info.type sctypeNA[info.type] = Intname sctypeNA[info.char] = Intname + + seen_bits.add(bits) + _add_integer_aliases() # We use these later @@ -383,16 +401,14 @@ def _set_up_aliases(): ('clongfloat', 'clongdouble'), ('longcomplex', 'clongdouble'), ('bool_', 'bool'), + ('bytes_', 'string'), + ('string_', 'string'), ('unicode_', 'unicode'), ('object_', 'object')] if sys.version_info[0] >= 3: - type_pairs.extend([('bytes_', 'string'), - ('str_', 'unicode'), - ('string_', 'string')]) + type_pairs.extend([('str_', 'unicode')]) else: - type_pairs.extend([('str_', 'string'), - ('string_', 'string'), - ('bytes_', 'string')]) + type_pairs.extend([('str_', 'string')]) for alias, t in type_pairs: allTypes[alias] = allTypes[t] sctypeDict[alias] = sctypeDict[t] @@ -416,10 +432,9 @@ _set_up_aliases() # Now, construct dictionary to lookup character codes from types _sctype2char_dict = {} def _construct_char_code_lookup(): - for name, info in typeinfo.items(): - if not isinstance(info, type): - if info.char not in ['p', 'P']: - _sctype2char_dict[info.type] = info.char + for name, info in _concrete_typeinfo.items(): + if info.char not in ['p', 'P']: + _sctype2char_dict[info.type] = info.char _construct_char_code_lookup() @@ -764,9 +779,7 @@ _alignment = _typedict() _maxvals = _typedict() _minvals = _typedict() def _construct_lookups(): - for name, info in typeinfo.items(): - if isinstance(info, type): - continue + for name, info in _concrete_typeinfo.items(): obj = info.type nbytes[obj] = info.bits // 8 _alignment[obj] = info.alignment diff --git a/numpy/core/src/multiarray/datetime_strings.c b/numpy/core/src/multiarray/datetime_strings.c index 4f9d8fa41..95b7bb3dc 100644 --- a/numpy/core/src/multiarray/datetime_strings.c +++ b/numpy/core/src/multiarray/datetime_strings.c @@ -69,7 +69,7 @@ * multiplatform code, get_localtime() should never be used outside of this * range. * - * [1] http://en.wikipedia.org/wiki/Year_2038_problem + * [1] https://en.wikipedia.org/wiki/Year_2038_problem */ static int get_localtime(NPY_TIME_T *ts, struct tm *tms) diff --git a/numpy/core/src/private/ufunc_override.c b/numpy/core/src/private/ufunc_override.c index e405155cf..116da3267 100644 --- a/numpy/core/src/private/ufunc_override.c +++ b/numpy/core/src/private/ufunc_override.c @@ -140,6 +140,9 @@ PyUFunc_WithOverride(PyObject *args, PyObject *kwds, if (methods != NULL) { methods[num_override_args] = method; } + else { + Py_DECREF(method); + } ++num_override_args; } } @@ -148,7 +151,12 @@ PyUFunc_WithOverride(PyObject *args, PyObject *kwds, fail: if (methods != NULL) { for (i = 0; i < num_override_args; i++) { - Py_XDECREF(methods[i]); + Py_DECREF(methods[i]); + } + } + if (with_override != NULL) { + for (i = 0; i < num_override_args; i++) { + Py_DECREF(with_override[i]); } } return -1; diff --git a/numpy/core/src/umath/override.c b/numpy/core/src/umath/override.c index c0bc47b7b..4a381ba12 100644 --- a/numpy/core/src/umath/override.c +++ b/numpy/core/src/umath/override.c @@ -347,8 +347,6 @@ PyUFunc_CheckOverride(PyUFuncObject *ufunc, char *method, PyObject *with_override[NPY_MAXARGS]; PyObject *array_ufunc_methods[NPY_MAXARGS]; - PyObject *obj; - PyObject *other_obj; PyObject *out; PyObject *method_name = NULL; @@ -511,21 +509,18 @@ PyUFunc_CheckOverride(PyUFuncObject *ufunc, char *method, /* Choose an overriding argument */ for (i = 0; i < num_override_args; i++) { - obj = with_override[i]; - if (obj == NULL) { + override_obj = with_override[i]; + if (override_obj == NULL) { continue; } - /* Get the first instance of an overriding arg.*/ - override_obj = obj; - /* Check for sub-types to the right of obj. */ for (j = i + 1; j < num_override_args; j++) { - other_obj = with_override[j]; + PyObject *other_obj = with_override[j]; if (other_obj != NULL && - PyObject_Type(other_obj) != PyObject_Type(obj) && + Py_TYPE(other_obj) != Py_TYPE(override_obj) && PyObject_IsInstance(other_obj, - PyObject_Type(override_obj))) { + (PyObject *)Py_TYPE(override_obj))) { override_obj = NULL; break; } diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py index 60a7c72f7..285b2de3c 100644 --- a/numpy/core/tests/test_deprecations.py +++ b/numpy/core/tests/test_deprecations.py @@ -36,7 +36,7 @@ class _DeprecationTestCase(object): # Do *not* ignore other DeprecationWarnings. Ignoring warnings # can give very confusing results because of - # http://bugs.python.org/issue4180 and it is probably simplest to + # https://bugs.python.org/issue4180 and it is probably simplest to # try to keep the tests cleanly giving only the right warning type. # (While checking them set to "error" those are ignored anyway) # We still have them show up, because otherwise they would be raised @@ -414,7 +414,7 @@ class TestClassicIntDivision(_DeprecationTestCase): """ See #7949. Deprecate the numeric-style dtypes with -3 flag in python 2 if used for division - List of data types: http://docs.scipy.org/doc/numpy/user/basics.types.html + List of data types: https://docs.scipy.org/doc/numpy/user/basics.types.html """ def test_int_dtypes(self): #scramble types and do some mix and match testing diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index 37d73e42c..e85a73154 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -44,7 +44,7 @@ from datetime import timedelta, datetime if sys.version_info[:2] > (3, 2): # In Python 3.3 the representation of empty shape, strides and sub-offsets # is an empty tuple instead of None. - # http://docs.python.org/dev/whatsnew/3.3.html#api-changes + # https://docs.python.org/dev/whatsnew/3.3.html#api-changes EMPTY = () else: EMPTY = None diff --git a/numpy/core/tests/test_scalarmath.py b/numpy/core/tests/test_scalarmath.py index ab2ef5ce6..a55f06b69 100644 --- a/numpy/core/tests/test_scalarmath.py +++ b/numpy/core/tests/test_scalarmath.py @@ -136,7 +136,7 @@ class TestPower(object): # 1 ** -1 possible special case base = [np.array(1, dt)[()] for dt in 'bhilqBHILQ'] for i1, i2 in itertools.product(base, exp): - if i1.dtype.name != 'uint64': + if i1.dtype != np.uint64: assert_raises(ValueError, operator.pow, i1, i2) else: res = operator.pow(i1, i2) @@ -146,7 +146,7 @@ class TestPower(object): # -1 ** -1 possible special case base = [np.array(-1, dt)[()] for dt in 'bhilq'] for i1, i2 in itertools.product(base, exp): - if i1.dtype.name != 'uint64': + if i1.dtype != np.uint64: assert_raises(ValueError, operator.pow, i1, i2) else: res = operator.pow(i1, i2) @@ -156,7 +156,7 @@ class TestPower(object): # 2 ** -1 perhaps generic base = [np.array(2, dt)[()] for dt in 'bhilqBHILQ'] for i1, i2 in itertools.product(base, exp): - if i1.dtype.name != 'uint64': + if i1.dtype != np.uint64: assert_raises(ValueError, operator.pow, i1, i2) else: res = operator.pow(i1, i2) @@ -519,7 +519,7 @@ class TestRepr(object): storage_bytes = np.dtype(t).itemsize*8 # could add some more types to the list below for which in ['small denorm', 'small norm']: - # Values from http://en.wikipedia.org/wiki/IEEE_754 + # Values from https://en.wikipedia.org/wiki/IEEE_754 constr = np.array([0x00]*storage_bytes, dtype=np.uint8) if which == 'small denorm': byte = last_fraction_bit_idx // 8 diff --git a/numpy/ctypeslib.py b/numpy/ctypeslib.py index 9d71adbdb..329c7a280 100644 --- a/numpy/ctypeslib.py +++ b/numpy/ctypeslib.py @@ -12,7 +12,7 @@ as_array : Create an ndarray from a ctypes array. References ---------- -.. [1] "SciPy Cookbook: ctypes", http://www.scipy.org/Cookbook/Ctypes +.. [1] "SciPy Cookbook: ctypes", https://scipy-cookbook.readthedocs.io/items/Ctypes.html Examples -------- diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py index 41f0b1f61..186ed949d 100644 --- a/numpy/distutils/misc_util.py +++ b/numpy/distutils/misc_util.py @@ -257,7 +257,7 @@ def minrelpath(path): return os.sep.join(l) def sorted_glob(fileglob): - """sorts output of python glob for http://bugs.python.org/issue30461 + """sorts output of python glob for https://bugs.python.org/issue30461 to allow extensions to have reproducible build results""" return sorted(glob.glob(fileglob)) @@ -317,7 +317,7 @@ def make_temp_file(suffix='', prefix='', text=True): return fo, name # Hooks for colored terminal output. -# See also http://www.livinglogic.de/Python/ansistyle +# See also https://web.archive.org/web/20100314204946/http://www.livinglogic.de/Python/ansistyle def terminal_has_colors(): if sys.platform=='cygwin' and 'USE_COLOR' not in os.environ: # Avoid importing curses that causes illegal operation diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py index 65d7de316..a5693bdd5 100644 --- a/numpy/distutils/system_info.py +++ b/numpy/distutils/system_info.py @@ -487,7 +487,7 @@ class FFTWNotFoundError(NotFoundError): class DJBFFTNotFoundError(NotFoundError): """ - DJBFFT (http://cr.yp.to/djbfft.html) libraries not found. + DJBFFT (https://cr.yp.to/djbfft.html) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [djbfft]) or by setting the DJBFFT environment variable.""" @@ -495,7 +495,7 @@ class DJBFFTNotFoundError(NotFoundError): class NumericNotFoundError(NotFoundError): """ - Numeric (http://www.numpy.org/) module not found. + Numeric (https://www.numpy.org/) module not found. Get it from above location, install it, and retry setup.py.""" @@ -505,7 +505,7 @@ class X11NotFoundError(NotFoundError): class UmfpackNotFoundError(NotFoundError): """ - UMFPACK sparse solver (http://www.cise.ufl.edu/research/sparse/umfpack/) + UMFPACK sparse solver (https://www.cise.ufl.edu/research/sparse/umfpack/) not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [umfpack]) or by setting the UMFPACK environment variable.""" diff --git a/numpy/doc/broadcasting.py b/numpy/doc/broadcasting.py index 717914cda..1dc4f60bf 100644 --- a/numpy/doc/broadcasting.py +++ b/numpy/doc/broadcasting.py @@ -171,7 +171,7 @@ Here the ``newaxis`` index operator inserts a new axis into ``a``, making it a two-dimensional ``4x1`` array. Combining the ``4x1`` array with ``b``, which has shape ``(3,)``, yields a ``4x3`` array. -See `this article <http://wiki.scipy.org/EricsBroadcastingDoc>`_ +See `this article <https://scipy.github.io/old-wiki/pages/EricsBroadcastingDoc>`_ for illustrations of broadcasting concepts. """ diff --git a/numpy/doc/glossary.py b/numpy/doc/glossary.py index 0e1df495b..a3b9423a8 100644 --- a/numpy/doc/glossary.py +++ b/numpy/doc/glossary.py @@ -69,7 +69,7 @@ Glossary micro-processors and used for transmission of data over network protocols. BLAS - `Basic Linear Algebra Subprograms <http://en.wikipedia.org/wiki/BLAS>`_ + `Basic Linear Algebra Subprograms <https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms>`_ broadcast NumPy can do operations on arrays whose shapes are mismatched:: @@ -155,7 +155,7 @@ Glossary be used as keys. For more information on dictionaries, read the - `Python tutorial <http://docs.python.org/tut>`_. + `Python tutorial <https://docs.python.org/tutorial/>`_. field In a :term:`structured data type`, each sub-type is called a `field`. @@ -238,7 +238,7 @@ Glossary [3, 4]]) For more information, read the section on lists in the `Python - tutorial <http://docs.python.org/tut>`_. For a mapping + tutorial <https://docs.python.org/tutorial/>`_. For a mapping type (key-value), see *dictionary*. little-endian diff --git a/numpy/doc/misc.py b/numpy/doc/misc.py index 24369871c..a76abe164 100644 --- a/numpy/doc/misc.py +++ b/numpy/doc/misc.py @@ -209,7 +209,7 @@ Only a survey of the choices. Little detail on how each works. Interfacing to Fortran: ----------------------- The clear choice to wrap Fortran code is -`f2py <http://docs.scipy.org/doc/numpy/f2py/>`_. +`f2py <https://docs.scipy.org/doc/numpy/f2py/>`_. Pyfort is an older alternative, but not supported any longer. Fwrap is a newer project that looked promising but isn't being developed any diff --git a/numpy/doc/subclassing.py b/numpy/doc/subclassing.py index 3be3d94b3..4b983893a 100644 --- a/numpy/doc/subclassing.py +++ b/numpy/doc/subclassing.py @@ -108,7 +108,7 @@ A brief Python primer on ``__new__`` and ``__init__`` ``__new__`` is a standard Python method, and, if present, is called before ``__init__`` when we create a class instance. See the `python __new__ documentation -<http://docs.python.org/reference/datamodel.html#object.__new__>`_ for more detail. +<https://docs.python.org/reference/datamodel.html#object.__new__>`_ for more detail. For example, consider the following Python code: diff --git a/numpy/dual.py b/numpy/dual.py index 8b91da262..3a16a8ec5 100644 --- a/numpy/dual.py +++ b/numpy/dual.py @@ -7,7 +7,7 @@ developers to transparently support these accelerated functions when scipy is available but still support users who have only installed NumPy. -.. _Scipy : http://www.scipy.org +.. _Scipy : https://www.scipy.org """ from __future__ import division, absolute_import, print_function diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py index 36e2222ea..23d36b2c2 100644 --- a/numpy/f2py/rules.py +++ b/numpy/f2py/rules.py @@ -1452,7 +1452,7 @@ def buildapi(rout): ['\\begin{description}'] + rd[k][1:] +\ ['\\end{description}'] - # Workaround for Python 2.6, 2.6.1 bug: http://bugs.python.org/issue4720 + # Workaround for Python 2.6, 2.6.1 bug: https://bugs.python.org/issue4720 if rd['keyformat'] or rd['xaformat']: argformat = rd['argformat'] if isinstance(argformat, list): diff --git a/numpy/lib/format.py b/numpy/lib/format.py index 23eac7e7d..ef5ec57e3 100644 --- a/numpy/lib/format.py +++ b/numpy/lib/format.py @@ -150,7 +150,7 @@ Notes ----- The ``.npy`` format, including motivation for creating it and a comparison of alternatives, is described in the `"npy-format" NEP -<http://www.numpy.org/neps/nep-0001-npy-format.html>`_, however details have +<https://www.numpy.org/neps/nep-0001-npy-format.html>`_, however details have evolved with time and this document is more current. """ diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 95edb95fa..128da22c6 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -1649,7 +1649,7 @@ def disp(mesg, device=None, linefeed=True): return -# See http://docs.scipy.org/doc/numpy/reference/c-api.generalized-ufuncs.html +# See https://docs.scipy.org/doc/numpy/reference/c-api.generalized-ufuncs.html _DIMENSION_NAME = r'\w+' _CORE_DIMENSION_LIST = '(?:{0:}(?:,{0:})*)?'.format(_DIMENSION_NAME) _ARGUMENT = r'\({}\)'.format(_CORE_DIMENSION_LIST) @@ -1906,7 +1906,7 @@ class vectorize(object): References ---------- .. [1] NumPy Reference, section `Generalized Universal Function API - <http://docs.scipy.org/doc/numpy/reference/c-api.generalized-ufuncs.html>`_. + <https://docs.scipy.org/doc/numpy/reference/c-api.generalized-ufuncs.html>`_. """ def __init__(self, pyfunc, otypes=None, doc=None, excluded=None, @@ -2561,7 +2561,7 @@ def bartlett(M): .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal Processing", Prentice-Hall, 1999, pp. 468-471. .. [4] Wikipedia, "Window function", - http://en.wikipedia.org/wiki/Window_function + https://en.wikipedia.org/wiki/Window_function .. [5] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, "Numerical Recipes", Cambridge University Press, 1986, page 429. @@ -2661,7 +2661,7 @@ def hanning(M): .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The University of Alberta Press, 1975, pp. 106-108. .. [3] Wikipedia, "Window function", - http://en.wikipedia.org/wiki/Window_function + https://en.wikipedia.org/wiki/Window_function .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, "Numerical Recipes", Cambridge University Press, 1986, page 425. @@ -2759,7 +2759,7 @@ def hamming(M): .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The University of Alberta Press, 1975, pp. 109-110. .. [3] Wikipedia, "Window function", - http://en.wikipedia.org/wiki/Window_function + https://en.wikipedia.org/wiki/Window_function .. [4] W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, "Numerical Recipes", Cambridge University Press, 1986, page 425. @@ -3036,7 +3036,7 @@ def kaiser(M, beta): .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The University of Alberta Press, 1975, pp. 177-178. .. [3] Wikipedia, "Window function", - http://en.wikipedia.org/wiki/Window_function + https://en.wikipedia.org/wiki/Window_function Examples -------- @@ -3124,7 +3124,7 @@ def sinc(x): .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/SincFunction.html .. [2] Wikipedia, "Sinc function", - http://en.wikipedia.org/wiki/Sinc_function + https://en.wikipedia.org/wiki/Sinc_function Examples -------- @@ -3840,10 +3840,10 @@ def trapz(y, x=None, dx=1.0, axis=-1): References ---------- - .. [1] Wikipedia page: http://en.wikipedia.org/wiki/Trapezoidal_rule + .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule .. [2] Illustration image: - http://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png + https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png Examples -------- diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index 390927601..7788ac319 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -1259,8 +1259,8 @@ def savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='', References ---------- .. [1] `Format Specification Mini-Language - <http://docs.python.org/library/string.html# - format-specification-mini-language>`_, Python Documentation. + <https://docs.python.org/library/string.html#format-specification-mini-language>`_, + Python Documentation. Examples -------- @@ -1624,7 +1624,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, References ---------- .. [1] NumPy User Guide, section `I/O with NumPy - <http://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html>`_. + <https://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html>`_. Examples --------- diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py index 078608bbb..0e691f56e 100644 --- a/numpy/lib/polynomial.py +++ b/numpy/lib/polynomial.py @@ -494,9 +494,9 @@ def polyfit(x, y, deg, rcond=None, full=False, w=None, cov=False): References ---------- .. [1] Wikipedia, "Curve fitting", - http://en.wikipedia.org/wiki/Curve_fitting + https://en.wikipedia.org/wiki/Curve_fitting .. [2] Wikipedia, "Polynomial interpolation", - http://en.wikipedia.org/wiki/Polynomial_interpolation + https://en.wikipedia.org/wiki/Polynomial_interpolation Examples -------- diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index 1ecd334af..9678bab76 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -982,12 +982,12 @@ def _getmembers(item): #----------------------------------------------------------------------------- # The following SafeEval class and company are adapted from Michael Spencer's -# ASPN Python Cookbook recipe: -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469 +# ASPN Python Cookbook recipe: https://code.activestate.com/recipes/364469/ +# # Accordingly it is mostly Copyright 2006 by Michael Spencer. # The recipe, like most of the other ASPN Python Cookbook recipes was made # available under the Python license. -# http://www.python.org/license +# https://en.wikipedia.org/wiki/Python_License # It has been modified to: # * handle unary -/+ diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 98af0733b..90dc2e657 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -780,7 +780,7 @@ def qr(a, mode='reduced'): dorgqr, and zungqr. For more information on the qr factorization, see for example: - http://en.wikipedia.org/wiki/QR_factorization + https://en.wikipedia.org/wiki/QR_factorization Subclasses of `ndarray` are preserved except for the 'raw' mode. So if `a` is of type `matrix`, all the return values will be matrices too. @@ -1750,7 +1750,7 @@ def matrix_rank(M, tol=None, hermitian=False): References ---------- .. [1] MATLAB reference documention, "Rank" - http://www.mathworks.com/help/techdoc/ref/rank.html + https://www.mathworks.com/help/techdoc/ref/rank.html .. [2] W. H. Press, S. A. Teukolsky, W. T. Vetterling and B. P. Flannery, "Numerical Recipes (3rd edition)", Cambridge University Press, 2007, page 795. @@ -2468,7 +2468,7 @@ def multi_dot(arrays): ---------- .. [1] Cormen, "Introduction to Algorithms", Chapter 15.2, p. 370-378 - .. [2] http://en.wikipedia.org/wiki/Matrix_chain_multiplication + .. [2] https://en.wikipedia.org/wiki/Matrix_chain_multiplication Examples -------- diff --git a/numpy/ma/README.txt b/numpy/ma/README.txt index ef9635e57..47f20d645 100644 --- a/numpy/ma/README.txt +++ b/numpy/ma/README.txt @@ -4,7 +4,7 @@ A Guide to Masked Arrays in NumPy .. Contents:: -See http://www.scipy.org/scipy/numpy/wiki/MaskedArray +See http://www.scipy.org/scipy/numpy/wiki/MaskedArray (dead link) for updates of this document. @@ -18,7 +18,7 @@ that could store some additional information along with numerical values, while keeping the possibility for missing data (picture storing a series of dates along with measurements, what would later become the `TimeSeries Scikit <http://projects.scipy.org/scipy/scikits/wiki/TimeSeries>`__ -. +(dead link). I started to implement such a class, but then quickly realized that any additional information disappeared when processing these subarrays diff --git a/numpy/polynomial/chebyshev.py b/numpy/polynomial/chebyshev.py index 8add0acbc..946e0499c 100644 --- a/numpy/polynomial/chebyshev.py +++ b/numpy/polynomial/chebyshev.py @@ -83,7 +83,7 @@ References ---------- .. [1] A. T. Benjamin, et al., "Combinatorial Trigonometry with Chebyshev Polynomials," *Journal of Statistical Planning and Inference 14*, 2008 - (preprint: http://www.math.hmc.edu/~benjamin/papers/CombTrig.pdf, pg. 4) + (preprint: https://www.math.hmc.edu/~benjamin/papers/CombTrig.pdf, pg. 4) """ from __future__ import division, absolute_import, print_function @@ -1708,7 +1708,7 @@ def chebfit(x, y, deg, rcond=None, full=False, w=None): References ---------- .. [1] Wikipedia, "Curve fitting", - http://en.wikipedia.org/wiki/Curve_fitting + https://en.wikipedia.org/wiki/Curve_fitting Examples -------- diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py index 58e9e180f..75c7e6832 100644 --- a/numpy/polynomial/hermite.py +++ b/numpy/polynomial/hermite.py @@ -1476,7 +1476,7 @@ def hermfit(x, y, deg, rcond=None, full=False, w=None): References ---------- .. [1] Wikipedia, "Curve fitting", - http://en.wikipedia.org/wiki/Curve_fitting + https://en.wikipedia.org/wiki/Curve_fitting Examples -------- diff --git a/numpy/polynomial/hermite_e.py b/numpy/polynomial/hermite_e.py index 47b2a9fb4..125364a11 100644 --- a/numpy/polynomial/hermite_e.py +++ b/numpy/polynomial/hermite_e.py @@ -1473,7 +1473,7 @@ def hermefit(x, y, deg, rcond=None, full=False, w=None): References ---------- .. [1] Wikipedia, "Curve fitting", - http://en.wikipedia.org/wiki/Curve_fitting + https://en.wikipedia.org/wiki/Curve_fitting Examples -------- diff --git a/numpy/polynomial/laguerre.py b/numpy/polynomial/laguerre.py index 5a9a5111a..2b9757ab8 100644 --- a/numpy/polynomial/laguerre.py +++ b/numpy/polynomial/laguerre.py @@ -1475,7 +1475,7 @@ def lagfit(x, y, deg, rcond=None, full=False, w=None): References ---------- .. [1] Wikipedia, "Curve fitting", - http://en.wikipedia.org/wiki/Curve_fitting + https://en.wikipedia.org/wiki/Curve_fitting Examples -------- diff --git a/numpy/polynomial/legendre.py b/numpy/polynomial/legendre.py index 0d4a49afc..a83c5735f 100644 --- a/numpy/polynomial/legendre.py +++ b/numpy/polynomial/legendre.py @@ -1509,7 +1509,7 @@ def legfit(x, y, deg, rcond=None, full=False, w=None): References ---------- .. [1] Wikipedia, "Curve fitting", - http://en.wikipedia.org/wiki/Curve_fitting + https://en.wikipedia.org/wiki/Curve_fitting Examples -------- diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx index b45b3146f..16c58cfce 100644 --- a/numpy/random/mtrand/mtrand.pyx +++ b/numpy/random/mtrand/mtrand.pyx @@ -573,21 +573,21 @@ def _shape_from_size(size, d): shape = tuple(size) + (d,) return shape -# Look up table for randint functions keyed by type name. The stored data -# is a tuple (lbnd, ubnd, func), where lbnd is the smallest value for the -# type, ubnd is one greater than the largest value, and func is the +# Look up table for randint functions keyed by dtype. +# The stored data is a tuple (lbnd, ubnd, func), where lbnd is the smallest +# value for the type, ubnd is one greater than the largest value, and func is the # function to call. _randint_type = { - 'bool': (0, 2, _rand_bool), - 'int8': (-2**7, 2**7, _rand_int8), - 'int16': (-2**15, 2**15, _rand_int16), - 'int32': (-2**31, 2**31, _rand_int32), - 'int64': (-2**63, 2**63, _rand_int64), - 'uint8': (0, 2**8, _rand_uint8), - 'uint16': (0, 2**16, _rand_uint16), - 'uint32': (0, 2**32, _rand_uint32), - 'uint64': (0, 2**64, _rand_uint64) - } + np.dtype(np.bool_): (0, 2, _rand_bool), + np.dtype(np.int8): (-2**7, 2**7, _rand_int8), + np.dtype(np.int16): (-2**15, 2**15, _rand_int16), + np.dtype(np.int32): (-2**31, 2**31, _rand_int32), + np.dtype(np.int64): (-2**63, 2**63, _rand_int64), + np.dtype(np.uint8): (0, 2**8, _rand_uint8), + np.dtype(np.uint16): (0, 2**16, _rand_uint16), + np.dtype(np.uint32): (0, 2**32, _rand_uint32), + np.dtype(np.uint64): (0, 2**64, _rand_uint64) +} cdef class RandomState: @@ -969,13 +969,12 @@ cdef class RandomState: high = low low = 0 - # '_randint_type' is defined in - # 'generate_randint_helpers.py' - key = np.dtype(dtype).name - if key not in _randint_type: - raise TypeError('Unsupported dtype "%s" for randint' % key) - - lowbnd, highbnd, randfunc = _randint_type[key] + raw_dtype = dtype + dtype = np.dtype(dtype) + try: + lowbnd, highbnd, randfunc = _randint_type[dtype] + except KeyError: + raise TypeError('Unsupported dtype "%s" for randint' % dtype) # TODO: Do not cast these inputs to Python int # @@ -986,20 +985,20 @@ cdef class RandomState: ihigh = int(high) if ilow < lowbnd: - raise ValueError("low is out of bounds for %s" % (key,)) + raise ValueError("low is out of bounds for %s" % dtype) if ihigh > highbnd: - raise ValueError("high is out of bounds for %s" % (key,)) + raise ValueError("high is out of bounds for %s" % dtype) if ilow >= ihigh: raise ValueError("low >= high") with self.lock: ret = randfunc(ilow, ihigh - 1, size, self.state_address) - if size is None: - if dtype in (np.bool, np.int, np.long): - return dtype(ret) + # back-compat: keep python scalars when a python type is passed + if size is None and raw_dtype in (bool, int, np.long): + return raw_dtype(ret) - return ret + return ret def bytes(self, npy_intp length): """ @@ -1607,7 +1606,7 @@ cdef class RandomState: References ---------- .. [1] Wikipedia, "Normal distribution", - http://en.wikipedia.org/wiki/Normal_distribution + https://en.wikipedia.org/wiki/Normal_distribution .. [2] P. R. Peebles Jr., "Central Limit Theorem" in "Probability, Random Variables and Random Signal Principles", 4th ed., 2001, pp. 51, 51, 125. @@ -1759,9 +1758,9 @@ cdef class RandomState: .. [1] Peyton Z. Peebles Jr., "Probability, Random Variables and Random Signal Principles", 4th ed, 2001, p. 57. .. [2] Wikipedia, "Poisson process", - http://en.wikipedia.org/wiki/Poisson_process + https://en.wikipedia.org/wiki/Poisson_process .. [3] Wikipedia, "Exponential distribution", - http://en.wikipedia.org/wiki/Exponential_distribution + https://en.wikipedia.org/wiki/Exponential_distribution """ cdef ndarray oscale @@ -1860,7 +1859,7 @@ cdef class RandomState: Wolfram Web Resource. http://mathworld.wolfram.com/GammaDistribution.html .. [2] Wikipedia, "Gamma distribution", - http://en.wikipedia.org/wiki/Gamma_distribution + https://en.wikipedia.org/wiki/Gamma_distribution Examples -------- @@ -1950,7 +1949,7 @@ cdef class RandomState: Wolfram Web Resource. http://mathworld.wolfram.com/GammaDistribution.html .. [2] Wikipedia, "Gamma distribution", - http://en.wikipedia.org/wiki/Gamma_distribution + https://en.wikipedia.org/wiki/Gamma_distribution Examples -------- @@ -2047,7 +2046,7 @@ cdef class RandomState: .. [1] Glantz, Stanton A. "Primer of Biostatistics.", McGraw-Hill, Fifth Edition, 2002. .. [2] Wikipedia, "F-distribution", - http://en.wikipedia.org/wiki/F-distribution + https://en.wikipedia.org/wiki/F-distribution Examples -------- @@ -2150,7 +2149,7 @@ cdef class RandomState: From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/NoncentralF-Distribution.html .. [2] Wikipedia, "Noncentral F-distribution", - http://en.wikipedia.org/wiki/Noncentral_F-distribution + https://en.wikipedia.org/wiki/Noncentral_F-distribution Examples -------- @@ -2257,7 +2256,7 @@ cdef class RandomState: References ---------- .. [1] NIST "Engineering Statistics Handbook" - http://www.itl.nist.gov/div898/handbook/eda/section3/eda3666.htm + https://www.itl.nist.gov/div898/handbook/eda/section3/eda3666.htm Examples -------- @@ -2333,8 +2332,8 @@ cdef class RandomState: .. [1] Delhi, M.S. Holla, "On a noncentral chi-square distribution in the analysis of weapon systems effectiveness", Metrika, Volume 15, Number 1 / December, 1970. - .. [2] Wikipedia, "Noncentral chi-square distribution" - http://en.wikipedia.org/wiki/Noncentral_chi-square_distribution + .. [2] Wikipedia, "Noncentral chi-squared distribution" + https://en.wikipedia.org/wiki/Noncentral_chi-squared_distribution Examples -------- @@ -2433,12 +2432,12 @@ cdef class RandomState: ---------- .. [1] NIST/SEMATECH e-Handbook of Statistical Methods, "Cauchy Distribution", - http://www.itl.nist.gov/div898/handbook/eda/section3/eda3663.htm + https://www.itl.nist.gov/div898/handbook/eda/section3/eda3663.htm .. [2] Weisstein, Eric W. "Cauchy Distribution." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/CauchyDistribution.html .. [3] Wikipedia, "Cauchy distribution" - http://en.wikipedia.org/wiki/Cauchy_distribution + https://en.wikipedia.org/wiki/Cauchy_distribution Examples -------- @@ -2501,7 +2500,7 @@ cdef class RandomState: .. [1] Dalgaard, Peter, "Introductory Statistics With R", Springer, 2002. .. [2] Wikipedia, "Student's t-distribution" - http://en.wikipedia.org/wiki/Student's_t-distribution + https://en.wikipedia.org/wiki/Student's_t-distribution Examples -------- @@ -2731,7 +2730,7 @@ cdef class RandomState: .. [3] Reiss, R.D., Thomas, M.(2001), Statistical Analysis of Extreme Values, Birkhauser Verlag, Basel, pp 23-30. .. [4] Wikipedia, "Pareto distribution", - http://en.wikipedia.org/wiki/Pareto_distribution + https://en.wikipedia.org/wiki/Pareto_distribution Examples -------- @@ -2836,7 +2835,7 @@ cdef class RandomState: Wide Applicability", Journal Of Applied Mechanics ASME Paper 1951. .. [3] Wikipedia, "Weibull distribution", - http://en.wikipedia.org/wiki/Weibull_distribution + https://en.wikipedia.org/wiki/Weibull_distribution Examples -------- @@ -2927,7 +2926,7 @@ cdef class RandomState: Dataplot Reference Manual, Volume 2: Let Subcommands and Library Functions", National Institute of Standards and Technology Handbook Series, June 2003. - http://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/powpdf.pdf + https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/powpdf.pdf Examples -------- @@ -3042,7 +3041,7 @@ cdef class RandomState: From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/LaplaceDistribution.html .. [4] Wikipedia, "Laplace distribution", - http://en.wikipedia.org/wiki/Laplace_distribution + https://en.wikipedia.org/wiki/Laplace_distribution Examples -------- @@ -3272,7 +3271,7 @@ cdef class RandomState: MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/LogisticDistribution.html .. [3] Wikipedia, "Logistic-distribution", - http://en.wikipedia.org/wiki/Logistic_distribution + https://en.wikipedia.org/wiki/Logistic_distribution Examples -------- @@ -3366,7 +3365,7 @@ cdef class RandomState: .. [1] Limpert, E., Stahel, W. A., and Abbt, M., "Log-normal Distributions across the Sciences: Keys and Clues," BioScience, Vol. 51, No. 5, May, 2001. - http://stat.ethz.ch/~stahel/lognormal/bioscience.pdf + https://stat.ethz.ch/~stahel/lognormal/bioscience.pdf .. [2] Reiss, R.D. and Thomas, M., "Statistical Analysis of Extreme Values," Basel: Birkhauser Verlag, 2001, pp. 31-32. @@ -3472,9 +3471,9 @@ cdef class RandomState: References ---------- .. [1] Brighton Webs Ltd., "Rayleigh Distribution," - http://www.brighton-webs.co.uk/distributions/rayleigh.asp + https://web.archive.org/web/20090514091424/http://brighton-webs.co.uk:80/distributions/rayleigh.asp .. [2] Wikipedia, "Rayleigh distribution" - http://en.wikipedia.org/wiki/Rayleigh_distribution + https://en.wikipedia.org/wiki/Rayleigh_distribution Examples -------- @@ -3560,12 +3559,12 @@ cdef class RandomState: References ---------- .. [1] Brighton Webs Ltd., Wald Distribution, - http://www.brighton-webs.co.uk/distributions/wald.asp + https://web.archive.org/web/20090423014010/http://www.brighton-webs.co.uk:80/distributions/wald.asp .. [2] Chhikara, Raj S., and Folks, J. Leroy, "The Inverse Gaussian Distribution: Theory : Methodology, and Applications", CRC Press, 1988. - .. [3] Wikipedia, "Wald distribution" - http://en.wikipedia.org/wiki/Wald_distribution + .. [3] Wikipedia, "Inverse Gaussian distribution" + https://en.wikipedia.org/wiki/Inverse_Gaussian_distribution Examples -------- @@ -3651,7 +3650,7 @@ cdef class RandomState: References ---------- .. [1] Wikipedia, "Triangular distribution" - http://en.wikipedia.org/wiki/Triangular_distribution + https://en.wikipedia.org/wiki/Triangular_distribution Examples -------- @@ -3758,7 +3757,7 @@ cdef class RandomState: Wolfram Web Resource. http://mathworld.wolfram.com/BinomialDistribution.html .. [5] Wikipedia, "Binomial distribution", - http://en.wikipedia.org/wiki/Binomial_distribution + https://en.wikipedia.org/wiki/Binomial_distribution Examples -------- @@ -3861,7 +3860,7 @@ cdef class RandomState: MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/NegativeBinomialDistribution.html .. [2] Wikipedia, "Negative binomial distribution", - http://en.wikipedia.org/wiki/Negative_binomial_distribution + https://en.wikipedia.org/wiki/Negative_binomial_distribution Examples -------- @@ -3955,7 +3954,7 @@ cdef class RandomState: From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/PoissonDistribution.html .. [2] Wikipedia, "Poisson distribution", - http://en.wikipedia.org/wiki/Poisson_distribution + https://en.wikipedia.org/wiki/Poisson_distribution Examples -------- @@ -4225,7 +4224,7 @@ cdef class RandomState: MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/HypergeometricDistribution.html .. [3] Wikipedia, "Hypergeometric distribution", - http://en.wikipedia.org/wiki/Hypergeometric_distribution + https://en.wikipedia.org/wiki/Hypergeometric_distribution Examples -------- @@ -4335,7 +4334,7 @@ cdef class RandomState: .. [3] D. J. Hand, F. Daly, D. Lunn, E. Ostrowski, A Handbook of Small Data Sets, CRC Press, 1994. .. [4] Wikipedia, "Logarithmic distribution", - http://en.wikipedia.org/wiki/Logarithmic_distribution + https://en.wikipedia.org/wiki/Logarithmic_distribution Examples -------- @@ -4697,9 +4696,9 @@ cdef class RandomState: ---------- .. [1] David McKay, "Information Theory, Inference and Learning Algorithms," chapter 23, - http://www.inference.phy.cam.ac.uk/mackay/ + http://www.inference.org.uk/mackay/itila/ .. [2] Wikipedia, "Dirichlet distribution", - http://en.wikipedia.org/wiki/Dirichlet_distribution + https://en.wikipedia.org/wiki/Dirichlet_distribution Examples -------- diff --git a/numpy/random/tests/test_random.py b/numpy/random/tests/test_random.py index 61c6e912d..7b4f90839 100644 --- a/numpy/random/tests/test_random.py +++ b/numpy/random/tests/test_random.py @@ -759,7 +759,7 @@ class TestRandomDist(object): [1.40840323350391515e+02, 1.98390255135251704e+05]]) # For some reason on 32-bit x86 Ubuntu 12.10 the [1, 0] entry in this # matrix differs by 24 nulps. Discussion: - # http://mail.python.org/pipermail/numpy-discussion/2012-September/063801.html + # https://mail.python.org/pipermail/numpy-discussion/2012-September/063801.html # Consensus is that this is probably some gcc quirk that affects # rounding but not in any important way, so we just use a looser # tolerance on this test: diff --git a/numpy/testing/_private/noseclasses.py b/numpy/testing/_private/noseclasses.py index 08dec0ca9..e99bbc97d 100644 --- a/numpy/testing/_private/noseclasses.py +++ b/numpy/testing/_private/noseclasses.py @@ -26,7 +26,7 @@ from .utils import KnownFailureException, KnownFailureTest #----------------------------------------------------------------------------- # Modified version of the one in the stdlib, that fixes a python bug (doctests -# not found in extension modules, http://bugs.python.org/issue3158) +# not found in extension modules, https://bugs.python.org/issue3158) class NumpyDocTestFinder(doctest.DocTestFinder): def _from_module(self, module, object): diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py index 032c4a116..f821fbebd 100644 --- a/numpy/testing/_private/utils.py +++ b/numpy/testing/_private/utils.py @@ -69,7 +69,7 @@ def import_nose(): if not nose_is_good: msg = ('Need nose >= %d.%d.%d for tests - see ' - 'http://nose.readthedocs.io' % + 'https://nose.readthedocs.io' % minimum_nose_version) raise ImportError(msg) @@ -177,7 +177,7 @@ if os.name == 'nt': # thread's CPU usage is either 0 or 100). To read counters like this, # you should copy this function, but keep the counter open, and call # CollectQueryData() each time you need to know. - # See http://msdn.microsoft.com/library/en-us/dnperfmo/html/perfmonpt2.asp + # See http://msdn.microsoft.com/library/en-us/dnperfmo/html/perfmonpt2.asp (dead link) # My older explanation for this was that the "AddCounter" process forced # the CPU to 100%, but the above makes more sense :) import win32pdh @@ -1609,7 +1609,7 @@ def _integer_repr(x, vdt, comp): # Reinterpret binary representation of the float as sign-magnitude: # take into account two-complement representation # See also - # http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm + # https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ rx = x.view(vdt) if not (rx.size == 1): rx[rx < 0] = comp - rx[rx < 0] @@ -1917,7 +1917,7 @@ class suppress_warnings(object): ``warnings.catch_warnings``. However, it also provides a filter mechanism to work around - http://bugs.python.org/issue4180. + https://bugs.python.org/issue4180. This bug causes Python before 3.4 to not reliably show warnings again after they have been ignored once (even within catch_warnings). It diff --git a/numpy/testing/setup.py b/numpy/testing/setup.py index e27a9b85b..7c3f2fbdf 100755 --- a/numpy/testing/setup.py +++ b/numpy/testing/setup.py @@ -15,7 +15,7 @@ if __name__ == '__main__': setup(maintainer="NumPy Developers", maintainer_email="numpy-dev@numpy.org", description="NumPy test module", - url="http://www.numpy.org", + url="https://www.numpy.org", license="NumPy License (BSD Style)", configuration=configuration, ) diff --git a/pavement.py b/pavement.py index 3484e8029..41acc5624 100644 --- a/pavement.py +++ b/pavement.py @@ -95,10 +95,10 @@ finally: #----------------------------------- # Source of the release notes -RELEASE_NOTES = 'doc/release/1.15.0-notes.rst' +RELEASE_NOTES = 'doc/release/1.16.0-notes.rst' # Start/end of the log (from git) -LOG_START = 'maintenance/1.14.x' +LOG_START = 'maintenance/1.15.x' LOG_END = 'master' @@ -16,7 +16,7 @@ All numpy wheels distributed from pypi are BSD licensed. Windows wheels are linked against the ATLAS BLAS / LAPACK library, restricted to SSE2 instructions, so may not give optimal linear algebra performance for -your machine. See http://docs.scipy.org/doc/numpy/user/install.html for +your machine. See https://docs.scipy.org/doc/numpy/user/install.html for alternatives. """ @@ -62,7 +62,7 @@ Operating System :: MacOS """ MAJOR = 1 -MINOR = 15 +MINOR = 16 MICRO = 0 ISRELEASED = False VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) @@ -357,7 +357,7 @@ def setup_package(): maintainer_email = "numpy-discussion@python.org", description = DOCLINES[0], long_description = "\n".join(DOCLINES[2:]), - url = "http://www.numpy.org", + url = "https://www.numpy.org", author = "Travis E. Oliphant et al.", download_url = "https://pypi.python.org/pypi/numpy", license = 'BSD', diff --git a/site.cfg.example b/site.cfg.example index 21609a332..48b17fbdf 100644 --- a/site.cfg.example +++ b/site.cfg.example @@ -10,7 +10,7 @@ # The format of the file is that of the standard library's ConfigParser module. # No interpolation is allowed, RawConfigParser class being used to load it. # -# http://docs.python.org/3/library/configparser.html +# https://docs.python.org/library/configparser.html # # Each section defines settings that apply to one particular dependency. Some of # the settings are general and apply to nearly any section and are defined here. @@ -122,7 +122,7 @@ # multiprocessing. # (This problem does not exist with multithreaded ATLAS.) # -# http://docs.python.org/3.4/library/multiprocessing.html#contexts-and-start-methods +# https://docs.python.org/library/multiprocessing.html#contexts-and-start-methods # https://github.com/xianyi/OpenBLAS/issues/294 # # [openblas] @@ -197,9 +197,9 @@ # # UMFPACK is not used by numpy. # -# http://www.cise.ufl.edu/research/sparse/umfpack/ -# http://www.cise.ufl.edu/research/sparse/amd/ -# http://scikits.appspot.com/umfpack +# https://www.cise.ufl.edu/research/sparse/umfpack/ +# https://www.cise.ufl.edu/research/sparse/amd/ +# https://scikit-umfpack.github.io/scikit-umfpack/ # #[amd] #amd_libs = amd @@ -213,7 +213,7 @@ # Note that these libraries are not used by for numpy or scipy. # # http://fftw.org/ -# http://cr.yp.to/djbfft.html +# https://cr.yp.to/djbfft.html # # Given only this section, numpy.distutils will try to figure out which version # of FFTW you are using. diff --git a/tools/allocation_tracking/sorttable.js b/tools/allocation_tracking/sorttable.js index 25bccb2b6..c9528873e 100644 --- a/tools/allocation_tracking/sorttable.js +++ b/tools/allocation_tracking/sorttable.js @@ -2,7 +2,7 @@ SortTable version 2 7th April 2007 - Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ + Stuart Langridge, https://www.kryogenix.org/code/browser/sorttable/ Instructions: Download this file @@ -11,7 +11,7 @@ Click on the headers to sort Thanks to many, many people for contributions and suggestions. - Licenced as X11: http://www.kryogenix.org/code/browser/licence.html + Licenced as X11: https://www.kryogenix.org/code/browser/licence.html This basically means: do what you want with it. */ @@ -301,7 +301,7 @@ sorttable = { shaker_sort: function(list, comp_func) { // A stable sort function to allow multi-level sorting of data - // see: http://en.wikipedia.org/wiki/Cocktail_sort + // see: https://en.wikipedia.org/wiki/Cocktail_shaker_sort // thanks to Joseph Nahmias var b = 0; var t = list.length - 1; @@ -441,7 +441,7 @@ fixEvent.stopPropagation = function() { /* forEach, version 1.0 Copyright 2006, Dean Edwards - License: http://www.opensource.org/licenses/mit-license.php + License: https://www.opensource.org/licenses/mit-license.php */ // array-like enumeration @@ -1,7 +1,7 @@ # 'Tox' is a tool for automating sdist/build/test cycles against # multiple Python versions: -# http://pypi.python.org/pypi/tox -# http://tox.testrun.org/ +# https://pypi.python.org/pypi/tox +# https://tox.readthedocs.io/ # Running the command 'tox' while in the root of the numpy source # directory will: |