Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MAINT, DOC: Update 1.13.0 release notes and .mailmap #9080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Abdul Muneer <[email protected]> abdulmuneer <[email protected]>
Adam Ginsburg <[email protected]> Adam Ginsburg <[email protected]>
Albert Jornet Puig <[email protected]> jurnix <[email protected]>
Alexander Belopolsky <[email protected]> Alexander Belopolsky <[email protected]>
Alexander Shadchin <[email protected]> Alexandr Shadchin <[email protected]>
Alex Griffing <[email protected]> alex <[email protected]>
Alex Griffing <[email protected]> argriffing <[email protected]>
Alex Griffing <[email protected]> argriffing <[email protected]>
Expand Down Expand Up @@ -111,6 +112,7 @@ Mark Wiebe <[email protected]> Mark Wiebe <[email protected]>
Mark Wiebe <[email protected]> Mark Wiebe <mwiebe@georg.(none)>
Martin Goodson <[email protected]> martingoodson <[email protected]>
Martin Teichmann <[email protected]> Martin Teichmann <[email protected]>
Martino Sorbaro <[email protected]> martinosorb <[email protected]>
Mattheus Ueckermann <[email protected]> empeeu <[email protected]>
Matthew Harrigan <[email protected]> MattHarrigan <[email protected]>
Matti Picus <[email protected]> mattip <[email protected]>
Expand All @@ -127,6 +129,7 @@ Pat Miller <patmiller@localhost> patmiller <patmiller@localhost>
Paul Ivanov <[email protected]> Paul Ivanov <paul.ivanov@local>
Paul Jacobson <[email protected]> hpaulj <[email protected]>
Pearu Peterson <[email protected]> Pearu Peterson <pearu@pearu-laptop.(none)>
Pete Peeradej Tanruangporn <[email protected]> petetanru <[email protected]>
Peter J Cock <[email protected]> peterjc <[email protected]>
Phil Elson <[email protected]>
Pierre GM <[email protected]> pierregm <[email protected]>
Expand Down Expand Up @@ -155,6 +158,7 @@ Stephan Hoyer <[email protected]> Stephan Hoyer <[email protected]>
Steven J Kern <[email protected]>
Thomas A Caswell <[email protected]> Thomas A Caswell <[email protected]>
Tim Cera <[email protected]> tim cera <[email protected]>
Tom Boyd <[email protected]> pezcore <[email protected]>
Tom Poole <[email protected]> tpoole <[email protected]>
Travis Oliphant <[email protected]> Travis E. Oliphant <[email protected]>
Travis Oliphant <[email protected]> Travis Oliphant <[email protected]>
Expand All @@ -163,3 +167,4 @@ Warren Weckesser <[email protected]> Warren Weckesser <warren.wecke
Wendell Smith <[email protected]> Wendell Smith <[email protected]>
William Spotz <[email protected]@localhost> [email protected] <[email protected]@localhost>
Wojtek Ruszczewski <[email protected]> wrwrwr <[email protected]>
Zixu Zhao <[email protected]> ZZhaoTireless <[email protected]>
258 changes: 137 additions & 121 deletions doc/release/1.13.0-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,31 @@ NumPy 1.13.0 Release Notes

This release supports Python 2.7 and 3.4 - 3.6.


Highlights
==========

* Operations like ``a + b + c`` will reuse temporaries on some platforms,
resulting in less memory use and faster execution.
* Inplace operations check if inputs overlap outputs and create temporaries
to avoid problems.
* Improved ability for classes to override default ufunc behavior. See
``__array_ufunc__`` below.
* New ``__array_ufunc__`` attribute provides improved ability for classes to
override default ufunc behavior.
* New ``np.block`` function for creating blocked arrays.


New functions
=============

Dropped Support
===============
* New ``np.positive`` ufunc.
* New ``np.divmod`` ufunc provides more efficient divmod.
* New ``np.isnat`` ufunc tests for NaT special values.
* New ``np.heaviside`` ufunc computes the Heaviside function.
* New ``np.isin`` function, improves on ``in1d``.
* New ``np.block`` function for creating blocked arrays.
* New ``PyArray_MapIterArrayCopyIfOverlap`` added to NumPy C-API.

See below for details.


Deprecations
Expand All @@ -43,12 +54,6 @@ Deprecations
* Calling ``ndarray.conjugate`` on non-numeric dtypes is deprecated (it
should match the behavior of ``np.conjugate``, which throws an error).

Build System Changes
====================

* ``numpy.distutils`` now automatically determines C-file dependencies with
GCC compatible compilers.


Future Changes
==============
Expand All @@ -62,6 +67,13 @@ Future Changes
NumPy 1.14.


Build System Changes
====================

* ``numpy.distutils`` now automatically determines C-file dependencies with
GCC compatible compilers.


Compatibility notes
===================

Expand Down Expand Up @@ -126,11 +138,11 @@ now issue a DeprecationWarning - ``.__getitem__(slice(start, end))`` should be
used instead.


C API
-----
C API changes
=============

GUfuncs on empty arrays and NpyIter axis removal
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------------------------
It is now allowed to remove a zero-sized axis from NpyIter. Which may mean
that code removing axes from NpyIter has to add an additional check when
accessing the removed dimensions later on.
Expand All @@ -143,6 +155,14 @@ For most gufuncs no change should be necessary. However, it is now possible
for gufuncs with a signature such as ``(..., N, M) -> (..., M)`` to return
a valid result if ``N=0`` without further wrapping code.

``PyArray_MapIterArrayCopyIfOverlap`` added to NumPy C-API
----------------------------------------------------------
Similar to ``PyArray_MapIterArray`` but with an additional ``copy_if_overlap``
argument. If ``copy_if_overlap != 0``, checks if input has memory overlap with
any of the other arrays and make copies as appropriate to avoid problems if the
input is modified during the iteration. See the documentation for more complete
documentation.


New Features
============
Expand All @@ -155,15 +175,67 @@ override the behavior of NumPy's ufuncs. This works quite similarly to Python's
``__mul__`` and other binary operation routines. See the documentation for a
more detailed description of the implementation and behavior of this new
option. The API is provisional, we do not yet guarantee backward compatibility
as modifications may be made pending feedback.
as modifications may be made pending feedback. See the NEP_ and
documentation_ for more details.

``PyArray_MapIterArrayCopyIfOverlap`` added to NumPy C-API
----------------------------------------------------------
Similar to ``PyArray_MapIterArray`` but with an additional ``copy_if_overlap``
argument. If ``copy_if_overlap != 0``, checks if input has memory overlap with
any of the other arrays and make copies as appropriate to avoid problems if the
input is modified during the iteration. See the documentation for more complete
documentation.
.. _NEP: https://github.com/numpy/numpy/blob/master/doc/neps/ufunc-overrides.rst
.. _documentation: https://github.com/charris/numpy/blob/master/doc/source/reference/arrays.classes.rst

New ``positive`` ufunc
----------------------
This ufunc corresponds to unary `+`, but unlike `+` on an ndarray it will raise
an error if array values do not support numeric operations.

New ``divmod`` ufunc
--------------------
This ufunc corresponds to the Python builtin `divmod`, and is used to implement
`divmod` when called on numpy arrays. ``np.divmod(x, y)`` calculates a result
equivalent to ``(np.floor_divide(x, y), np.remainder(x, y))`` but is
approximately twice as fast as calling the functions separately.

``np.isnat`` ufunc tests for NaT special datetime and timedelta values
----------------------------------------------------------------------
The new ufunc ``np.isnat`` finds the positions of special NaT values
within datetime and timedelta arrays. This is analogous to ``np.isnan``.

``np.heaviside`` ufunc computes the Heaviside function
------------------------------------------------------
The new function ``np.heaviside(x, h0)`` (a ufunc) computes the Heaviside
function:
.. code::
{ 0 if x < 0,
heaviside(x, h0) = { h0 if x == 0,
{ 1 if x > 0.

``np.block`` function for creating blocked arrays
-------------------------------------------------
Add a new ``block`` function to the current stacking functions ``vstack``,
``hstack``, and ``stack``. This allows concatenation across multiple axes
simultaneously, with a similar syntax to array creation, but where elements
can themselves be arrays. For instance::

>>> A = np.eye(2) * 2
>>> B = np.eye(3) * 3
>>> np.block([
... [A, np.zeros((2, 3))],
... [np.ones((3, 2)), B ]
... ])
array([[ 2., 0., 0., 0., 0.],
[ 0., 2., 0., 0., 0.],
[ 1., 1., 3., 0., 0.],
[ 1., 1., 0., 3., 0.],
[ 1., 1., 0., 0., 3.]])

While primarily useful for block matrices, this works for arbitrary dimensions
of arrays.

It is similar to Matlab's square bracket notation for creating block matrices.

``isin`` function, improving on ``in1d``
----------------------------------------
The new function ``isin`` tests whether each element of an N-dimensonal
array is present anywhere within a second array. It is an enhancement
of ``in1d`` that preserves the shape of the first array.

Temporary elision
-----------------
Expand All @@ -179,17 +251,6 @@ In an N-dimensional array, the user can now choose the axis along which to look
for duplicate N-1-dimensional elements using ``numpy.unique``. The original
behaviour is recovered if ``axis=None`` (default).

``np.isnat`` function to test for NaT special datetime and timedelta values
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``np.isnat`` can now be used to find the positions of special NaT values
within datetime and timedelta arrays. This is analogous to ``np.isnan``.

``isin`` function, improving on ``in1d``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The new function ``isin`` tests whether each element of an N-dimensonal
array is present anywhere within a second array. It is an enhancement
of ``in1d`` that preserves the shape of the first array.

``np.gradient`` now supports unevenly spaced data
-------------------------------------------------
Users can now specify a not-constant spacing for data.
Expand All @@ -211,15 +272,6 @@ This means that, e.g., it is now possible to do the following::
[array([[ 1. , 1. , -0.5], [ 1. , 1. , -0.5]]),
array([[ 2. , 2. , 2. ], [ 2. , 1.7, 0.5]])]

``np.heaviside`` computes the Heaviside function
------------------------------------------------
The new function ``np.heaviside(x, h0)`` (a ufunc) computes the Heaviside
function:
.. code::
{ 0 if x < 0,
heaviside(x, h0) = { h0 if x == 0,
{ 1 if x > 0.

Support for returning arrays of arbitrary dimensions in ``apply_along_axis``
----------------------------------------------------------------------------
Previously, only scalars or 1D arrays could be returned by the function passed
Expand All @@ -232,30 +284,6 @@ being iterated over.
For consistency with ``ndarray`` and ``broadcast``, ``d.ndim`` is a shorthand
for ``len(d.shape)``.

``np.block`` function for creating blocked arrays
-------------------------------------------------
Add a new ``block`` function to the current stacking functions ``vstack``,
``hstack``, and ``stack``. This allows concatenation across multiple axes
simultaneously, with a similar syntax to array creation, but where elements
can themselves be arrays. For instance::

>>> A = np.eye(2) * 2
>>> B = np.eye(3) * 3
>>> np.block([
... [A, np.zeros((2, 3))],
... [np.ones((3, 2)), B ]
... ])
array([[ 2., 0., 0., 0., 0.],
[ 0., 2., 0., 0., 0.],
[ 1., 1., 3., 0., 0.],
[ 1., 1., 0., 3., 0.],
[ 1., 1., 0., 0., 3.]])

While primarily useful for block matrices, this works for arbitrary dimensions
of arrays.

It is similar to Matlab's square bracket notation for creating block matrices.

Support for tracemalloc in Python 3.6
-------------------------------------
NumPy now supports memory tracing with tracemalloc_ module of Python 3.6 or
Expand Down Expand Up @@ -283,6 +311,49 @@ now disabled by default but can be enabled for test builds.
Improvements
============

Ufunc behavior for overlapping inputs
-------------------------------------

Operations where ufunc input and output operands have memory overlap
produced undefined results in previous NumPy versions, due to data
dependency issues. In NumPy 1.13.0, results from such operations are
now defined to be the same as for equivalent operations where there is
no memory overlap.

Operations affected now make temporary copies, as needed to eliminate
data dependency. As detecting these cases is computationally
expensive, a heuristic is used, which may in rare cases result to
needless temporary copies. For operations where the data dependency
is simple enough for the heuristic to analyze, temporary copies will
not be made even if the arrays overlap, if it can be deduced copies
are not necessary. As an example,``np.add(a, b, out=a)`` will not
involve copies.

To illustrate a previously undefined operation::

>>> x = np.arange(16).astype(float)
>>> np.add(x[1:], x[:-1], out=x[1:])

In NumPy 1.13.0 the last line is guaranteed to be equivalent to::

>>> np.add(x[1:].copy(), x[:-1].copy(), out=x[1:])

A similar operation with simple non-problematic data dependence is::

>>> x = np.arange(16).astype(float)
>>> np.add(x[1:], x[:-1], out=x[:-1])

It will continue to produce the same results as in previous NumPy
versions, and will not involve unnecessary temporary copies.

The change applies also to in-place binary operations, for example::

>>> x = np.random.rand(500, 500)
>>> x += x.T

This statement is now guaranteed to be equivalent to ``x[...] = x + x.T``,
whereas in previous NumPy versions the results were undefined.

Partial support for 64-bit f2py extensions with MinGW
-----------------------------------------------------
Extensions that incorporate Fortran libraries can now be built using the free
Expand Down Expand Up @@ -363,18 +434,6 @@ regarding "workspace" sizes, and in some places may use faster algorithms.
This now works on empty arrays, returning 0, and can reduce over multiple axes.
Previously, a ``ValueError`` was thrown in these cases.

New ``positive`` ufunc
----------------------
This ufunc corresponds to unary `+`, but unlike `+` on an ndarray it will raise
an error if array values do not support numeric operations.

New ``divmod`` ufunc
--------------------
This ufunc corresponds to the Python builtin `divmod`, and is used to implement
`divmod` when called on numpy arrays. ``np.divmod(x, y)`` calculates a result
equivalent to ``(np.floor_divide(x, y), np.remainder(x, y))`` but is
approximately twice as fast as calling the functions separately.

Better ``repr`` of object arrays
--------------------------------
Object arrays that contain themselves no longer cause a recursion error.
Expand All @@ -385,49 +444,6 @@ clear the difference between a 2d object array, and a 1d object array of lists.
Changes
=======

Ufunc behavior for overlapping inputs
-------------------------------------

Operations where ufunc input and output operands have memory overlap
produced undefined results in previous NumPy versions, due to data
dependency issues. In NumPy 1.13.0, results from such operations are
now defined to be the same as for equivalent operations where there is
no memory overlap.

Operations affected now make temporary copies, as needed to eliminate
data dependency. As detecting these cases is computationally
expensive, a heuristic is used, which may in rare cases result to
needless temporary copies. For operations where the data dependency
is simple enough for the heuristic to analyze, temporary copies will
not be made even if the arrays overlap, if it can be deduced copies
are not necessary. As an example,``np.add(a, b, out=a)`` will not
involve copies.

To illustrate a previously undefined operation::

>>> x = np.arange(16).astype(float)
>>> np.add(x[1:], x[:-1], out=x[1:])

In NumPy 1.13.0 the last line is guaranteed to be equivalent to::

>>> np.add(x[1:].copy(), x[:-1].copy(), out=x[1:])

A similar operation with simple non-problematic data dependence is::

>>> x = np.arange(16).astype(float)
>>> np.add(x[1:], x[:-1], out=x[:-1])

It will continue to produce the same results as in previous NumPy
versions, and will not involve unnecessary temporary copies.

The change applies also to in-place binary operations, for example::

>>> x = np.random.rand(500, 500)
>>> x += x.T

This statement is now guaranteed to be equivalent to ``x[...] = x + x.T``,
whereas in previous NumPy versions the results were undefined.

``argsort`` on masked arrays takes the same default arguments as ``sort``
-------------------------------------------------------------------------
By default, ``argsort`` now places the masked values at the end of the sorted
Expand Down