diff --git a/doc/release/1.12.0-notes.rst b/doc/release/1.12.0-notes.rst index e752c1ef1b43..5486a298f429 100644 --- a/doc/release/1.12.0-notes.rst +++ b/doc/release/1.12.0-notes.rst @@ -1,13 +1,14 @@ NumPy 1.12.0 Release Notes ************************** -This release supports Python 2.7 and 3.4 - 3.5. +This release supports Python 2.7 and 3.4 - 3.6. Highlights ========== * Order of operations in ``np.einsum`` now can be optimized for large speed improvements. * New ``signature`` argument to ``np.vectorize`` for vectorizing with core dimensions. +* The ``keepdims`` argument was added to many functions. Dropped Support =============== @@ -43,8 +44,9 @@ corresponding to intervening fields in the original array, unlike the copy in 1.12, which will affect code such as ``arr[['f1', 'f3']].view(newdtype)``. Second, for numpy versions 1.6 to 1.12 assignment between structured arrays -occurs "by field name": Fields in the dst array are set to the -identically-named field in the src or to 0 if the src does not have a field: +occurs "by field name": Fields in the destination array are set to the +identically-named field in the source array or to 0 if the source does not have +a field:: >>> a = np.array([(1,2),(3,4)], dtype=[('x', 'i4'), ('y', 'i4')]) >>> b = np.ones(2, dtype=[('z', 'i4'), ('y', 'i4'), ('x', 'i4')]) @@ -53,10 +55,11 @@ identically-named field in the src or to 0 if the src does not have a field: array([(0, 2, 1), (0, 4, 3)], dtype=[('z', '`. This allows +for vectorizing a much broader class of functions. For example, an arbitrary +distance metric that combines two vectors to produce a scalar could be +vectorized with ``signature='(n),(n)->()'``. See ``np.vectorize`` for full +details. + +Emit py3kwarnings for division of integer arrays +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +To help people migrate their code bases from Python 2 to Python 3, the +python interpreter has a handy option -3, which issues warnings at runtime. +One of its warnings is for integer division:: + + $ python -3 -c "2/3" + + -c:1: DeprecationWarning: classic int division + +In Python 3, the new integer division semantics also apply to numpy arrays. +With this version, numpy will emit a similar warning:: + + $ python -3 -c "import numpy as np; np.array(2)/np.array(3)" + + -c:1: DeprecationWarning: numpy: classic int division + +numpy.sctypes now includes bytes on Python3 too +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Previously, it included str (bytes) and unicode on Python2, but only str +(unicode) on Python3. + + +Improvements +============ + +``bitwise_and`` identity changed +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The previous identity was 1 with the result that all bits except the LSB were +masked out when the reduce method was used. The new identity is -1, which +should work properly on twos complement machines as all bits will be set to +one. + +Generalized Ufuncs will now unlock the GIL +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Generalized Ufuncs, including most of the linalg module, will now unlock +the Python global interpreter lock. + Caches in `np.fft` are now bounded in total size and item count ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The caches in `np.fft` that speed up successive FFTs of the same length can no @@ -364,29 +392,13 @@ an intermediate array to reduce this scaling to ``N^3`` or effectively been applied to the general einsum summation notation. See ``np.einsum_path`` for more details. -New ``signature`` argument to ``np.vectorize`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -This argument allows for vectorizing user defined functions with core -dimensions, in the style of NumPy's -:ref:`generalized universal functions`. This allows -for vectorizing a much broader class of functions. For example, an arbitrary -distance metric that combines two vectors to produce a scalar could be -vectorized with ``signature='(n),(n)->()'``. See ``np.vectorize`` for full -details. +quicksort has been changed to an introsort +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The quicksort kind of ``np.sort`` and ``np.argsort`` is now an introsort which +is regular quicksort but changing to a heapsort when not enough progress is +made. This retains the good quicksort performance while changing the worst case +runtime from ``O(N^2)`` to ``O(N*log(N))``. -Emit py3kwarnings for division of integer arrays -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -To help people migrate their code bases from Python 2 to Python 3, the -python interpreter has a handy option -3, which issues warnings at runtime. -One of its warnings is for integer division: - $ python -3 -c "2/3" - - -c:1: DeprecationWarning: classic int division -In Python 3, the new integer division semantics also apply to numpy arrays. -With this version, numpy will emit a similar warning: - $ python -3 -c "import numpy as np; np.array(2)/np.array(3)" - - -c:1: DeprecationWarning: numpy: classic int division Changes ======= @@ -410,28 +422,16 @@ from these operations. Also, reduction of a memmap (e.g. ``.sum(axis=None``) now returns a numpy scalar instead of a 0d memmap. -numpy.sctypes now includes bytes on Python3 too -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Previously, it included str (bytes) and unicode on Python2, but only str -(unicode) on Python3. - -quicksort has been changed to an introsort -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The quicksort kind of ``np.sort`` and ``np.argsort`` is now an introsort which -is regular quicksort but changing to a heapsort when not enough progress is -made. This retains the good quicksort performance while changing the worst case -runtime from ``O(N^2)`` to ``O(N*log(N))``. - stacklevel of warnings increased ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The stacklevel for python based warnings was increased so that most warnings will report the offending line of the user code instead of the line the warning itself is given. Passing of stacklevel is now tested to ensure that -new warnings will recieve the ``stacklevel`` argument. +new warnings will receive the ``stacklevel`` argument. This causes warnings with the "default" or "module" filter to be shown once for every offending user code line or user module instead of only once. On -python versions before 3.4, this can cause warnings to appear that were falsly +python versions before 3.4, this can cause warnings to appear that were falsely ignored before, which may be surprising especially in test suits. diff --git a/numpy/core/code_generators/cversions.txt b/numpy/core/code_generators/cversions.txt index 47781add8fbc..9ade153f5241 100644 --- a/numpy/core/code_generators/cversions.txt +++ b/numpy/core/code_generators/cversions.txt @@ -32,4 +32,5 @@ # Version 10 (NumPy 1.10) Added PyArray_CheckAnyScalarExact # Version 10 (NumPy 1.11) No change. +# Version 10 (NumPy 1.12) No change. 0x0000000a = 9b8bce614655d3eb02acddcb508203cb diff --git a/numpy/core/include/numpy/numpyconfig.h b/numpy/core/include/numpy/numpyconfig.h index 71ced6e07e4e..701f02c6ecd7 100644 --- a/numpy/core/include/numpy/numpyconfig.h +++ b/numpy/core/include/numpy/numpyconfig.h @@ -33,5 +33,6 @@ #define NPY_1_9_API_VERSION 0x00000008 #define NPY_1_10_API_VERSION 0x00000008 #define NPY_1_11_API_VERSION 0x00000008 +#define NPY_1_12_API_VERSION 0x00000008 #endif diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py index a97b02645827..d9e9ba5df758 100644 --- a/numpy/core/setup_common.py +++ b/numpy/core/setup_common.py @@ -37,6 +37,7 @@ # 0x00000009 - 1.9.x # 0x0000000a - 1.10.x # 0x0000000a - 1.11.x +# 0x0000000a - 1.12.x C_API_VERSION = 0x0000000a class MismatchCAPIWarning(Warning):