diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2020-01-06 12:11:25 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2020-01-06 12:11:25 +0000 |
commit | 679c83407ca95eab7eec844e945a725b932fbb60 (patch) | |
tree | be7f65c9ff3e4335aca57de874e0736c37a23988 /doc | |
parent | d7523e21aa65abb8ef58895c6bf3c768059f74aa (diff) | |
parent | c28fc48328e9621160debae4d0d99feeff3b8fdf (diff) | |
download | numpy-679c83407ca95eab7eec844e945a725b932fbb60.tar.gz |
Merge remote-tracking branch 'upstream/master' into remove-numpy.distutils.compat
Diffstat (limited to 'doc')
-rw-r--r-- | doc/DISTUTILS.rst.txt | 3 | ||||
-rw-r--r-- | doc/Py3K.rst.txt | 16 | ||||
-rw-r--r-- | doc/TESTS.rst.txt | 4 | ||||
-rwxr-xr-x | doc/cdoc/numpyfilter.py | 2 | ||||
-rw-r--r-- | doc/changelog/1.16.6-changelog.rst | 36 | ||||
-rw-r--r-- | doc/changelog/1.17.5-changelog.rst | 26 | ||||
-rw-r--r-- | doc/example.py | 2 | ||||
-rwxr-xr-x | doc/postprocess.py | 2 | ||||
-rw-r--r-- | doc/release/upcoming_changes/15218.improvement.rst | 6 | ||||
-rw-r--r-- | doc/release/upcoming_changes/15229.compatibility.rst | 7 | ||||
-rw-r--r-- | doc/release/upcoming_changes/15251.c_api.rst | 10 | ||||
-rw-r--r-- | doc/source/conf.py | 2 | ||||
-rw-r--r-- | doc/source/f2py/setup_example.py | 2 | ||||
-rw-r--r-- | doc/source/reference/arrays.ndarray.rst | 4 | ||||
-rw-r--r-- | doc/source/reference/c-api/array.rst | 2 | ||||
-rw-r--r-- | doc/source/reference/random/multithreading.rst | 2 | ||||
-rw-r--r-- | doc/source/release.rst | 2 | ||||
-rw-r--r-- | doc/source/release/1.16.6-notes.rst | 87 | ||||
-rw-r--r-- | doc/source/release/1.17.5-notes.rst | 45 | ||||
-rw-r--r-- | doc/source/user/c-info.ufunc-tutorial.rst | 103 | ||||
-rw-r--r-- | doc/source/user/quickstart.rst | 44 | ||||
-rwxr-xr-x | doc/summarize.py | 2 |
22 files changed, 252 insertions, 157 deletions
diff --git a/doc/DISTUTILS.rst.txt b/doc/DISTUTILS.rst.txt index bcef82500..677398baa 100644 --- a/doc/DISTUTILS.rst.txt +++ b/doc/DISTUTILS.rst.txt @@ -577,9 +577,6 @@ The header of a typical SciPy ``__init__.py`` is:: Package docstring, typically with a brief description and function listing. """ - # py3k related imports - from __future__ import division, print_function, absolute_import - # import functions into module namespace from .subpackage import * ... diff --git a/doc/Py3K.rst.txt b/doc/Py3K.rst.txt index b23536ca5..fe2dd13c4 100644 --- a/doc/Py3K.rst.txt +++ b/doc/Py3K.rst.txt @@ -225,6 +225,8 @@ A #define in config.h, defined when building for Py3. Currently, this is generated as a part of the config. Is this sensible (we could also use Py_VERSION_HEX)? + This is being cleaned up in the C code. + private/npy_3kcompat.h ---------------------- @@ -355,9 +357,7 @@ The Py2/Py3 compatible structure definition looks like:: (binaryfunc)0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 (unaryfunc)NULL, /*nb_index*/ - #endif }; @@ -394,14 +394,6 @@ There are a couple of places that need further attention: In some cases, this returns a buffer object on Python 2. On Python 3, there is no stand-alone buffer object, so we return a byte array instead. -- multiarray.int_asbuffer - - Converts an integer to a void* pointer -- in Python. - - Should we just remove this for Py3? It doesn't seem like it is used - anywhere, and it doesn't sound very useful. - - The Py2/Py3 compatible PyBufferMethods definition looks like:: NPY_NO_EXPORT PyBufferProcs array_as_buffer = { @@ -430,10 +422,6 @@ The Py2/Py3 compatible PyBufferMethods definition looks like:: .. todo:: - Figure out what to do with int_asbuffer - -.. todo:: - There's stuff to clean up in numarray/_capi.c diff --git a/doc/TESTS.rst.txt b/doc/TESTS.rst.txt index 14cb28df8..9023c7100 100644 --- a/doc/TESTS.rst.txt +++ b/doc/TESTS.rst.txt @@ -119,7 +119,7 @@ that makes it hard to identify the test from the output of running the test suite with ``verbose=2`` (or similar verbosity setting). Use plain comments (``#``) if necessary. -Labeling tests +Labeling tests -------------- As an alternative to ``pytest.mark.<label>``, there are a number of labels you @@ -174,7 +174,7 @@ name; thus:: print 'doing teardown' - class TestMe(object): + class TestMe: def setup(): """Class-level setup""" print 'doing setup' diff --git a/doc/cdoc/numpyfilter.py b/doc/cdoc/numpyfilter.py index 0ec50697e..65c801206 100755 --- a/doc/cdoc/numpyfilter.py +++ b/doc/cdoc/numpyfilter.py @@ -6,8 +6,6 @@ Interpret C comments as ReStructuredText, and replace them by the HTML output. Also, add Doxygen /** and /**< syntax automatically where appropriate. """ -from __future__ import division, absolute_import, print_function - import sys import re import os diff --git a/doc/changelog/1.16.6-changelog.rst b/doc/changelog/1.16.6-changelog.rst new file mode 100644 index 000000000..62ff46c34 --- /dev/null +++ b/doc/changelog/1.16.6-changelog.rst @@ -0,0 +1,36 @@ + +Contributors +============ + +A total of 10 people contributed to this release. + +* CakeWithSteak +* Charles Harris +* Chris Burr +* Eric Wieser +* Fernando Saravia +* Lars Grueter +* Matti Picus +* Maxwell Aladago +* Qiming Sun +* Warren Weckesser + +Pull requests merged +==================== + +A total of 14 pull requests were merged for this release. + +* `#14211 <https://github.com/numpy/numpy/pull/14211>`__: BUG: Fix uint-overflow if padding with linear_ramp and negative... +* `#14275 <https://github.com/numpy/numpy/pull/14275>`__: BUG: fixing to allow unpickling of PY3 pickles from PY2 +* `#14340 <https://github.com/numpy/numpy/pull/14340>`__: BUG: Fix misuse of .names and .fields in various places (backport... +* `#14423 <https://github.com/numpy/numpy/pull/14423>`__: BUG: test, fix regression in converting to ctypes. +* `#14434 <https://github.com/numpy/numpy/pull/14434>`__: BUG: Fixed maximum relative error reporting in assert_allclose +* `#14509 <https://github.com/numpy/numpy/pull/14509>`__: BUG: Fix regression in boolean matmul. +* `#14686 <https://github.com/numpy/numpy/pull/14686>`__: BUG: properly define PyArray_DescrCheck +* `#14853 <https://github.com/numpy/numpy/pull/14853>`__: BLD: add 'apt update' to shippable +* `#14854 <https://github.com/numpy/numpy/pull/14854>`__: BUG: Fix _ctypes class circular reference. (#13808) +* `#14856 <https://github.com/numpy/numpy/pull/14856>`__: BUG: Fix `np.einsum` errors on Power9 Linux and z/Linux +* `#14863 <https://github.com/numpy/numpy/pull/14863>`__: BLD: Prevent -flto from optimising long double representation... +* `#14864 <https://github.com/numpy/numpy/pull/14864>`__: BUG: lib: Fix histogram problem with signed integer arrays. +* `#15172 <https://github.com/numpy/numpy/pull/15172>`__: ENH: Backport improvements to testing functions. +* `#15191 <https://github.com/numpy/numpy/pull/15191>`__: REL: Prepare for 1.16.6 release. diff --git a/doc/changelog/1.17.5-changelog.rst b/doc/changelog/1.17.5-changelog.rst new file mode 100644 index 000000000..7ac758075 --- /dev/null +++ b/doc/changelog/1.17.5-changelog.rst @@ -0,0 +1,26 @@ + +Contributors +============ + +A total of 6 people contributed to this release. People with a "+" by their +names contributed a patch for the first time. + +* Charles Harris +* Eric Wieser +* Ilhan Polat +* Matti Picus +* Michael Hudson-Doyle +* Ralf Gommers + +Pull requests merged +==================== + +A total of 7 pull requests were merged for this release. + +* `#14593 <https://github.com/numpy/numpy/pull/14593>`__: MAINT: backport Cython API cleanup to 1.17.x, remove docs +* `#14937 <https://github.com/numpy/numpy/pull/14937>`__: BUG: fix integer size confusion in handling array's ndmin argument +* `#14939 <https://github.com/numpy/numpy/pull/14939>`__: BUILD: remove SSE2 flag from numpy.random builds +* `#14993 <https://github.com/numpy/numpy/pull/14993>`__: MAINT: Added Python3.8 branch to dll lib discovery +* `#15038 <https://github.com/numpy/numpy/pull/15038>`__: BUG: Fix refcounting in ufunc object loops +* `#15067 <https://github.com/numpy/numpy/pull/15067>`__: BUG: Exceptions tracebacks are dropped +* `#15175 <https://github.com/numpy/numpy/pull/15175>`__: ENH: Backport improvements to testing functions. diff --git a/doc/example.py b/doc/example.py index 8a5f9948f..5e3d79807 100644 --- a/doc/example.py +++ b/doc/example.py @@ -8,8 +8,6 @@ extend over multiple lines, the closing three quotation marks must be on a line by itself, preferably preceded by a blank line. """ -from __future__ import division, absolute_import, print_function - import os # standard library imports first # Do NOT import using *, e.g. from numpy import * diff --git a/doc/postprocess.py b/doc/postprocess.py index 2e50c115e..b6d067437 100755 --- a/doc/postprocess.py +++ b/doc/postprocess.py @@ -6,8 +6,6 @@ Post-processes HTML and Latex files output by Sphinx. MODE is either 'html' or 'tex'. """ -from __future__ import division, absolute_import, print_function - import re import optparse import io diff --git a/doc/release/upcoming_changes/15218.improvement.rst b/doc/release/upcoming_changes/15218.improvement.rst new file mode 100644 index 000000000..ccbbbd66f --- /dev/null +++ b/doc/release/upcoming_changes/15218.improvement.rst @@ -0,0 +1,6 @@ +Use 64-bit integer size on 64-bit platforms in fallback lapack_lite +------------------------------------------------------------------- + +Use 64-bit integer size on 64-bit platforms in the fallback LAPACK library, +which is used when the system has no LAPACK installed, allowing it to deal with +linear algebra for large arrays. diff --git a/doc/release/upcoming_changes/15229.compatibility.rst b/doc/release/upcoming_changes/15229.compatibility.rst new file mode 100644 index 000000000..404f7774f --- /dev/null +++ b/doc/release/upcoming_changes/15229.compatibility.rst @@ -0,0 +1,7 @@ +Removed ``multiarray.int_asbuffer`` +----------------------------------- + +As part of the continued removal of Python 2 compatibility, +``multiarray.int_asbuffer`` was removed. On Python 3, it threw a +``NotImplementedError`` and was unused internally. It is expected that there +are no downstream use cases for this method with Python 3. diff --git a/doc/release/upcoming_changes/15251.c_api.rst b/doc/release/upcoming_changes/15251.c_api.rst new file mode 100644 index 000000000..f391c904b --- /dev/null +++ b/doc/release/upcoming_changes/15251.c_api.rst @@ -0,0 +1,10 @@ +Better support for ``const`` dimensions in API functions +-------------------------------------------------------- +The following functions now accept a constant array of ``npy_intp``: + +* `PyArray_BroadcastToShape` +* `PyArray_IntTupleFromIntp` +* `PyArray_OverflowMultiplyList` + +Previously the caller would have to cast away the const-ness to call these +functions. diff --git a/doc/source/conf.py b/doc/source/conf.py index 09770535b..7e3a145f5 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import division, absolute_import, print_function - import sys, os, re # Minimum version, enforced by sphinx diff --git a/doc/source/f2py/setup_example.py b/doc/source/f2py/setup_example.py index 54af77299..479acc004 100644 --- a/doc/source/f2py/setup_example.py +++ b/doc/source/f2py/setup_example.py @@ -1,5 +1,3 @@ -from __future__ import division, absolute_import, print_function - from numpy.distutils.core import Extension ext1 = Extension(name = 'scalar', diff --git a/doc/source/reference/arrays.ndarray.rst b/doc/source/reference/arrays.ndarray.rst index 831d211bc..47692c8b4 100644 --- a/doc/source/reference/arrays.ndarray.rst +++ b/doc/source/reference/arrays.ndarray.rst @@ -512,10 +512,6 @@ Arithmetic: - Any third argument to :func:`pow()` is silently ignored, as the underlying :func:`ufunc <power>` takes only two arguments. - - The three division operators are all defined; :obj:`div` is active - by default, :obj:`truediv` is active when - :obj:`__future__` division is in effect. - - Because :class:`ndarray` is a built-in type (written in C), the ``__r{op}__`` special methods are not directly defined. diff --git a/doc/source/reference/c-api/array.rst b/doc/source/reference/c-api/array.rst index c910efa60..2eaf3a27a 100644 --- a/doc/source/reference/c-api/array.rst +++ b/doc/source/reference/c-api/array.rst @@ -2514,7 +2514,7 @@ this useful approach to looping over an array. stride and that axis will be used. .. c:function:: PyObject *PyArray_BroadcastToShape( \ - PyObject* arr, npy_intp *dimensions, int nd) + PyObject* arr, npy_intp const *dimensions, int nd) Return an array iterator that is broadcast to iterate as an array of the shape provided by *dimensions* and *nd*. diff --git a/doc/source/reference/random/multithreading.rst b/doc/source/reference/random/multithreading.rst index a0a31d0ea..8502429ce 100644 --- a/doc/source/reference/random/multithreading.rst +++ b/doc/source/reference/random/multithreading.rst @@ -24,7 +24,7 @@ seed will produce the same outputs. import concurrent.futures import numpy as np - class MultithreadedRNG(object): + class MultithreadedRNG: def __init__(self, n, seed=None, threads=None): rg = PCG64(seed) if threads is None: diff --git a/doc/source/release.rst b/doc/source/release.rst index 26373ad07..9679ec6c8 100644 --- a/doc/source/release.rst +++ b/doc/source/release.rst @@ -7,11 +7,13 @@ Release Notes 1.19.0 <release/1.19.0-notes> 1.18.0 <release/1.18.0-notes> + 1.17.5 <release/1.17.5-notes> 1.17.4 <release/1.17.4-notes> 1.17.3 <release/1.17.3-notes> 1.17.2 <release/1.17.2-notes> 1.17.1 <release/1.17.1-notes> 1.17.0 <release/1.17.0-notes> + 1.16.6 <release/1.16.6-notes> 1.16.5 <release/1.16.5-notes> 1.16.4 <release/1.16.4-notes> 1.16.3 <release/1.16.3-notes> diff --git a/doc/source/release/1.16.6-notes.rst b/doc/source/release/1.16.6-notes.rst new file mode 100644 index 000000000..0aeba3cd3 --- /dev/null +++ b/doc/source/release/1.16.6-notes.rst @@ -0,0 +1,87 @@ +.. currentmodule:: numpy + +========================== +NumPy 1.16.6 Release Notes +========================== + +The NumPy 1.16.6 release fixes bugs reported against the 1.16.5 release, and +also backports several enhancements from master that seem appropriate for a +release series that is the last to support Python 2.7. The wheels on PyPI are +linked with OpenBLAS v0.3.7, which should fix errors on Skylake series +cpus. + +Downstream developers building this release should use Cython >= 0.29.2 and, if +using OpenBLAS, OpenBLAS >= v0.3.7. The supported Python versions are 2.7 and +3.5-3.7. + +Highlights +========== + +- The ``np.testing.utils`` functions have been updated from 1.19.0-dev0. + This improves the function documentation and error messages as well + extending the ``assert_array_compare`` function to additional types. + + +New functions +============= + +Allow matmul (`@` operator) to work with object arrays. +------------------------------------------------------- +This is an enhancement that was added in NumPy 1.17 and seems reasonable to +include in the LTS 1.16 release series. + + +Compatibility notes +=================== + +Fix regression in matmul (`@` operator) for boolean types +--------------------------------------------------------- +Booleans were being treated as integers rather than booleans, +which was a regression from previous behavior. + + +Improvements +============ + +Array comparison assertions include maximum differences +------------------------------------------------------- +Error messages from array comparison tests such as ``testing.assert_allclose`` +now include "max absolute difference" and "max relative difference," in +addition to the previous "mismatch" percentage. This information makes it +easier to update absolute and relative error tolerances. + +Contributors +============ + +A total of 10 people contributed to this release. + +* CakeWithSteak +* Charles Harris +* Chris Burr +* Eric Wieser +* Fernando Saravia +* Lars Grueter +* Matti Picus +* Maxwell Aladago +* Qiming Sun +* Warren Weckesser + +Pull requests merged +==================== + +A total of 14 pull requests were merged for this release. + +* `#14211 <https://github.com/numpy/numpy/pull/14211>`__: BUG: Fix uint-overflow if padding with linear_ramp and negative... +* `#14275 <https://github.com/numpy/numpy/pull/14275>`__: BUG: fixing to allow unpickling of PY3 pickles from PY2 +* `#14340 <https://github.com/numpy/numpy/pull/14340>`__: BUG: Fix misuse of .names and .fields in various places (backport... +* `#14423 <https://github.com/numpy/numpy/pull/14423>`__: BUG: test, fix regression in converting to ctypes. +* `#14434 <https://github.com/numpy/numpy/pull/14434>`__: BUG: Fixed maximum relative error reporting in assert_allclose +* `#14509 <https://github.com/numpy/numpy/pull/14509>`__: BUG: Fix regression in boolean matmul. +* `#14686 <https://github.com/numpy/numpy/pull/14686>`__: BUG: properly define PyArray_DescrCheck +* `#14853 <https://github.com/numpy/numpy/pull/14853>`__: BLD: add 'apt update' to shippable +* `#14854 <https://github.com/numpy/numpy/pull/14854>`__: BUG: Fix _ctypes class circular reference. (#13808) +* `#14856 <https://github.com/numpy/numpy/pull/14856>`__: BUG: Fix `np.einsum` errors on Power9 Linux and z/Linux +* `#14863 <https://github.com/numpy/numpy/pull/14863>`__: BLD: Prevent -flto from optimising long double representation... +* `#14864 <https://github.com/numpy/numpy/pull/14864>`__: BUG: lib: Fix histogram problem with signed integer arrays. +* `#15172 <https://github.com/numpy/numpy/pull/15172>`__: ENH: Backport improvements to testing functions. +* `#15191 <https://github.com/numpy/numpy/pull/15191>`__: REL: Prepare for 1.16.6 release. diff --git a/doc/source/release/1.17.5-notes.rst b/doc/source/release/1.17.5-notes.rst new file mode 100644 index 000000000..0f1d3e1a5 --- /dev/null +++ b/doc/source/release/1.17.5-notes.rst @@ -0,0 +1,45 @@ +.. currentmodule:: numpy + +========================== +NumPy 1.17.5 Release Notes +========================== + +This release contains fixes for bugs reported against NumPy 1.17.4 along with +some build improvements. The Python versions supported in this release +are 3.5-3.8. + +Downstream developers should use Cython >= 0.29.14 for Python 3.8 support and +OpenBLAS >= 3.7 to avoid errors on the Skylake architecture. + +It is recommended that developers interested in the new random bit generators +upgrade to the NumPy 1.18.x series, as it has updated documentation and +many small improvements. + + +Contributors +============ + +A total of 6 people contributed to this release. People with a "+" by their +names contributed a patch for the first time. + +* Charles Harris +* Eric Wieser +* Ilhan Polat +* Matti Picus +* Michael Hudson-Doyle +* Ralf Gommers + + +Pull requests merged +==================== + +A total of 8 pull requests were merged for this release. + +* `#14593 <https://github.com/numpy/numpy/pull/14593>`__: MAINT: backport Cython API cleanup to 1.17.x, remove docs +* `#14937 <https://github.com/numpy/numpy/pull/14937>`__: BUG: fix integer size confusion in handling array's ndmin argument +* `#14939 <https://github.com/numpy/numpy/pull/14939>`__: BUILD: remove SSE2 flag from numpy.random builds +* `#14993 <https://github.com/numpy/numpy/pull/14993>`__: MAINT: Added Python3.8 branch to dll lib discovery +* `#15038 <https://github.com/numpy/numpy/pull/15038>`__: BUG: Fix refcounting in ufunc object loops +* `#15067 <https://github.com/numpy/numpy/pull/15067>`__: BUG: Exceptions tracebacks are dropped +* `#15175 <https://github.com/numpy/numpy/pull/15175>`__: ENH: Backport improvements to testing functions. +* `#15213 <https://github.com/numpy/numpy/pull/15213>`__: REL: Prepare for the NumPy 1.17.5 release. diff --git a/doc/source/user/c-info.ufunc-tutorial.rst b/doc/source/user/c-info.ufunc-tutorial.rst index 96a73f9a6..8ff45a934 100644 --- a/doc/source/user/c-info.ufunc-tutorial.rst +++ b/doc/source/user/c-info.ufunc-tutorial.rst @@ -137,7 +137,6 @@ the module. /* This initiates the module using the above definitions. */ - #if PY_VERSION_HEX >= 0x03000000 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "spam", @@ -159,17 +158,6 @@ the module. } return m; } - #else - PyMODINIT_FUNC initspam(void) - { - PyObject *m; - - m = Py_InitModule("spam", SpamMethods); - if (m == NULL) { - return; - } - } - #endif To use the setup.py file, place setup.py and spammodule.c in the same folder. Then python setup.py build will build the module to import, @@ -322,7 +310,6 @@ the primary thing that must be changed to create your own ufunc. static void *data[1] = {NULL}; - #if PY_VERSION_HEX >= 0x03000000 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "npufunc", @@ -357,30 +344,6 @@ the primary thing that must be changed to create your own ufunc. return m; } - #else - PyMODINIT_FUNC initnpufunc(void) - { - PyObject *m, *logit, *d; - - - m = Py_InitModule("npufunc", LogitMethods); - if (m == NULL) { - return; - } - - import_array(); - import_umath(); - - logit = PyUFunc_FromFuncAndData(funcs, data, types, 1, 1, 1, - PyUFunc_None, "logit", - "logit_docstring", 0); - - d = PyModule_GetDict(m); - - PyDict_SetItemString(d, "logit", logit); - Py_DECREF(logit); - } - #endif This is a setup.py file for the above code. As before, the module can be build via calling python setup.py build at the command prompt, @@ -601,7 +564,6 @@ the primary thing that must be changed to create your own ufunc. NPY_LONGDOUBLE, NPY_LONGDOUBLE}; static void *data[4] = {NULL, NULL, NULL, NULL}; - #if PY_VERSION_HEX >= 0x03000000 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "npufunc", @@ -636,30 +598,6 @@ the primary thing that must be changed to create your own ufunc. return m; } - #else - PyMODINIT_FUNC initnpufunc(void) - { - PyObject *m, *logit, *d; - - - m = Py_InitModule("npufunc", LogitMethods); - if (m == NULL) { - return; - } - - import_array(); - import_umath(); - - logit = PyUFunc_FromFuncAndData(funcs, data, types, 4, 1, 1, - PyUFunc_None, "logit", - "logit_docstring", 0); - - d = PyModule_GetDict(m); - - PyDict_SetItemString(d, "logit", logit); - Py_DECREF(logit); - } - #endif This is a setup.py file for the above code. As before, the module can be build via calling python setup.py build at the command prompt, @@ -824,7 +762,6 @@ as well as all other properties of a ufunc. static void *data[1] = {NULL}; - #if PY_VERSION_HEX >= 0x03000000 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "npufunc", @@ -859,30 +796,6 @@ as well as all other properties of a ufunc. return m; } - #else - PyMODINIT_FUNC initnpufunc(void) - { - PyObject *m, *logit, *d; - - - m = Py_InitModule("npufunc", LogitMethods); - if (m == NULL) { - return; - } - - import_array(); - import_umath(); - - logit = PyUFunc_FromFuncAndData(funcs, data, types, 1, 2, 2, - PyUFunc_None, "logit", - "logit_docstring", 0); - - d = PyModule_GetDict(m); - - PyDict_SetItemString(d, "logit", logit); - Py_DECREF(logit); - } - #endif .. _`sec:NumPy-struct-dtype`: @@ -976,7 +889,6 @@ The C file is given below. static void *data[1] = {NULL}; - #if defined(NPY_PY3K) static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "struct_ufunc_test", @@ -988,31 +900,18 @@ The C file is given below. NULL, NULL }; - #endif - #if defined(NPY_PY3K) PyMODINIT_FUNC PyInit_struct_ufunc_test(void) - #else - PyMODINIT_FUNC initstruct_ufunc_test(void) - #endif { PyObject *m, *add_triplet, *d; PyObject *dtype_dict; PyArray_Descr *dtype; PyArray_Descr *dtypes[3]; - #if defined(NPY_PY3K) m = PyModule_Create(&moduledef); - #else - m = Py_InitModule("struct_ufunc_test", StructUfuncTestMethods); - #endif if (m == NULL) { - #if defined(NPY_PY3K) return NULL; - #else - return; - #endif } import_array(); @@ -1043,9 +942,7 @@ The C file is given below. PyDict_SetItemString(d, "add_triplet", add_triplet); Py_DECREF(add_triplet); - #if defined(NPY_PY3K) return m; - #endif } .. index:: diff --git a/doc/source/user/quickstart.rst b/doc/source/user/quickstart.rst index 6211d0c69..34e327d75 100644 --- a/doc/source/user/quickstart.rst +++ b/doc/source/user/quickstart.rst @@ -117,9 +117,8 @@ from the type of the elements in the sequences. >>> b.dtype dtype('float64') -A frequent error consists in calling ``array`` with multiple numeric -arguments, rather than providing a single list of numbers as an -argument. +A frequent error consists in calling ``array`` with multiple arguments, +rather than providing a single sequence as an argument. :: @@ -174,8 +173,9 @@ state of the memory. By default, the dtype of the created array is array([[ 3.73603959e-262, 6.02658058e-154, 6.55490914e-260], [ 5.30498948e-313, 3.14673309e-307, 1.00000000e+000]]) -To create sequences of numbers, NumPy provides a function analogous to -``range`` that returns arrays instead of lists. +To create sequences of numbers, NumPy provides the ``arange`` function +which is analogous to the Python built-in ``range``, but returns an +array. :: @@ -300,9 +300,9 @@ elementwise in NumPy arrays. The matrix product can be performed using the ``@`` operator (in python >=3.5) or the ``dot`` function or method:: >>> A = np.array( [[1,1], - ... [0,1]] ) + ... [0,1]] ) >>> B = np.array( [[2,0], - ... [3,4]] ) + ... [3,4]] ) >>> A * B # elementwise product array([[2, 0], [0, 4]]) @@ -437,7 +437,7 @@ operate elementwise on an array, producing an array as output. `dot`, `floor`, `inner`, - `inv`, + `invert`, `lexsort`, `max`, `maximum`, @@ -732,8 +732,14 @@ stacks 1D arrays as columns into a 2D array. It is equivalent to array([[ 4., 3.], [ 2., 8.]]) -On the other hand, the function `ma.row_stack` is equivalent to `vstack` -for any input arrays. +On the other hand, the function `row_stack` is equivalent to `vstack` +for any input arrays. In fact, `row_stack` is an alias for `vstack`:: + + >>> np.column_stack is np.hstack + False + >>> np.row_stack is np.vstack + True + In general, for arrays with more than two dimensions, `hstack` stacks along their second axes, `vstack` stacks along their @@ -917,7 +923,7 @@ Array Creation `ogrid`, `ones`, `ones_like`, - `r`, + `r_`, `zeros`, `zeros_like` Conversions @@ -1431,11 +1437,15 @@ functions ``column_stack``, ``dstack``, ``hstack`` and ``vstack``, depending on the dimension in which the stacking is to be done. For example:: - x = np.arange(0,10,2) # x=([0,2,4,6,8]) - y = np.arange(5) # y=([0,1,2,3,4]) - m = np.vstack([x,y]) # m=([[0,2,4,6,8], - # [0,1,2,3,4]]) - xy = np.hstack([x,y]) # xy =([0,2,4,6,8,0,1,2,3,4]) + >>> x = np.arange(0,10,2) + >>> y = np.arange(5) + >>> m = np.vstack([x,y]) + >>> m + array([[0, 2, 4, 6, 8], + [0, 1, 2, 3, 4]]) + >>> xy = np.hstack([x,y]) + >>> xy + array([0, 2, 4, 6, 8, 0, 1, 2, 3, 4]) The logic behind those functions in more than two dimensions can be strange. @@ -1448,7 +1458,7 @@ Histograms ---------- The NumPy ``histogram`` function applied to an array returns a pair of -vectors: the histogram of the array and the vector of bins. Beware: +vectors: the histogram of the array and a vector of the bin edges. Beware: ``matplotlib`` also has a function to build histograms (called ``hist``, as in Matlab) that differs from the one in NumPy. The main difference is that ``pylab.hist`` plots the histogram automatically, while diff --git a/doc/summarize.py b/doc/summarize.py index cfce2713e..9b02a408c 100755 --- a/doc/summarize.py +++ b/doc/summarize.py @@ -5,8 +5,6 @@ summarize.py Show a summary about which NumPy functions are documented and which are not. """ -from __future__ import division, absolute_import, print_function - import os, glob, re, sys, inspect, optparse try: # Accessing collections abstract classes from collections |