|
Packit Service |
a47777 |
==========================
|
|
Packit Service |
a47777 |
NumPy 1.10.0 Release Notes
|
|
Packit Service |
a47777 |
==========================
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
This release supports Python 2.6 - 2.7 and 3.2 - 3.5.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Highlights
|
|
Packit Service |
a47777 |
==========
|
|
Packit Service |
a47777 |
* numpy.distutils now supports parallel compilation via the --parallel/-j
|
|
Packit Service |
a47777 |
argument passed to setup.py build
|
|
Packit Service |
a47777 |
* numpy.distutils now supports additional customization via site.cfg to
|
|
Packit Service |
a47777 |
control compilation parameters, i.e. runtime libraries, extra
|
|
Packit Service |
a47777 |
linking/compilation flags.
|
|
Packit Service |
a47777 |
* Addition of *np.linalg.multi_dot*: compute the dot product of two or more
|
|
Packit Service |
a47777 |
arrays in a single function call, while automatically selecting the fastest
|
|
Packit Service |
a47777 |
evaluation order.
|
|
Packit Service |
a47777 |
* The new function `np.stack` provides a general interface for joining a
|
|
Packit Service |
a47777 |
sequence of arrays along a new axis, complementing `np.concatenate` for
|
|
Packit Service |
a47777 |
joining along an existing axis.
|
|
Packit Service |
a47777 |
* Addition of `nanprod` to the set of nanfunctions.
|
|
Packit Service |
a47777 |
* Support for the '@' operator in Python 3.5.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Dropped Support
|
|
Packit Service |
a47777 |
===============
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
* The _dotblas module has been removed. CBLAS Support is now in
|
|
Packit Service |
a47777 |
Multiarray.
|
|
Packit Service |
a47777 |
* The testcalcs.py file has been removed.
|
|
Packit Service |
a47777 |
* The polytemplate.py file has been removed.
|
|
Packit Service |
a47777 |
* npy_PyFile_Dup and npy_PyFile_DupClose have been removed from
|
|
Packit Service |
a47777 |
npy_3kcompat.h.
|
|
Packit Service |
a47777 |
* splitcmdline has been removed from numpy/distutils/exec_command.py.
|
|
Packit Service |
a47777 |
* try_run and get_output have been removed from
|
|
Packit Service |
a47777 |
numpy/distutils/command/config.py
|
|
Packit Service |
a47777 |
* The a._format attribute is no longer supported for array printing.
|
|
Packit Service |
a47777 |
* Keywords ``skiprows`` and ``missing`` removed from np.genfromtxt.
|
|
Packit Service |
a47777 |
* Keyword ``old_behavior`` removed from np.correlate.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Future Changes
|
|
Packit Service |
a47777 |
==============
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
* In array comparisons like ``arr1 == arr2``, many corner cases
|
|
Packit Service |
a47777 |
involving strings or structured dtypes that used to return scalars
|
|
Packit Service |
a47777 |
now issue ``FutureWarning`` or ``DeprecationWarning``, and in the
|
|
Packit Service |
a47777 |
future will be change to either perform elementwise comparisons or
|
|
Packit Service |
a47777 |
raise an error.
|
|
Packit Service |
a47777 |
* In ``np.lib.split`` an empty array in the result always had dimension
|
|
Packit Service |
a47777 |
``(0,)`` no matter the dimensions of the array being split. In Numpy 1.11
|
|
Packit Service |
a47777 |
that behavior will be changed so that the dimensions will be preserved. A
|
|
Packit Service |
a47777 |
``FutureWarning`` for this change has been in place since Numpy 1.9 but,
|
|
Packit Service |
a47777 |
due to a bug, sometimes no warning was raised and the dimensions were
|
|
Packit Service |
a47777 |
already preserved.
|
|
Packit Service |
a47777 |
* The SafeEval class will be removed in Numpy 1.11.
|
|
Packit Service |
a47777 |
* The alterdot and restoredot functions will be removed in Numpy 1.11.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
See below for more details on these changes.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Compatibility notes
|
|
Packit Service |
a47777 |
===================
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Default casting rule change
|
|
Packit Service |
a47777 |
---------------------------
|
|
Packit Service |
a47777 |
Default casting for inplace operations has changed to ``'same_kind'``. For
|
|
Packit Service |
a47777 |
instance, if n is an array of integers, and f is an array of floats, then
|
|
Packit Service |
a47777 |
``n += f`` will result in a ``TypeError``, whereas in previous Numpy
|
|
Packit Service |
a47777 |
versions the floats would be silently cast to ints. In the unlikely case
|
|
Packit Service |
a47777 |
that the example code is not an actual bug, it can be updated in a backward
|
|
Packit Service |
a47777 |
compatible way by rewriting it as ``np.add(n, f, out=n, casting='unsafe')``.
|
|
Packit Service |
a47777 |
The old ``'unsafe'`` default has been deprecated since Numpy 1.7.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
numpy version string
|
|
Packit Service |
a47777 |
--------------------
|
|
Packit Service |
a47777 |
The numpy version string for development builds has been changed from
|
|
Packit Service |
a47777 |
``x.y.z.dev-githash`` to ``x.y.z.dev0+githash`` (note the +) in order to comply
|
|
Packit Service |
a47777 |
with PEP 440.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
relaxed stride checking
|
|
Packit Service |
a47777 |
-----------------------
|
|
Packit Service |
a47777 |
NPY_RELAXED_STRIDE_CHECKING is now true by default.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
UPDATE: In 1.10.2 the default value of NPY_RELAXED_STRIDE_CHECKING was
|
|
Packit Service |
a47777 |
changed to false for back compatibility reasons. More time is needed before
|
|
Packit Service |
a47777 |
it can be made the default. As part of the roadmap a deprecation of
|
|
Packit Service |
a47777 |
dimension changing views of f_contiguous not c_contiguous arrays was also
|
|
Packit Service |
a47777 |
added.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Concatenation of 1d arrays along any but ``axis=0`` raises ``IndexError``
|
|
Packit Service |
a47777 |
-------------------------------------------------------------------------
|
|
Packit Service |
a47777 |
Using axis != 0 has raised a DeprecationWarning since NumPy 1.7, it now
|
|
Packit Service |
a47777 |
raises an error.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*np.ravel*, *np.diagonal* and *np.diag* now preserve subtypes
|
|
Packit Service |
a47777 |
-------------------------------------------------------------
|
|
Packit Service |
a47777 |
There was inconsistent behavior between *x.ravel()* and *np.ravel(x)*, as
|
|
Packit Service |
a47777 |
well as between *x.diagonal()* and *np.diagonal(x)*, with the methods
|
|
Packit Service |
a47777 |
preserving subtypes while the functions did not. This has been fixed and
|
|
Packit Service |
a47777 |
the functions now behave like the methods, preserving subtypes except in
|
|
Packit Service |
a47777 |
the case of matrices. Matrices are special cased for backward
|
|
Packit Service |
a47777 |
compatibility and still return 1-D arrays as before. If you need to
|
|
Packit Service |
a47777 |
preserve the matrix subtype, use the methods instead of the functions.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*rollaxis* and *swapaxes* always return a view
|
|
Packit Service |
a47777 |
----------------------------------------------
|
|
Packit Service |
a47777 |
Previously, a view was returned except when no change was made in the order
|
|
Packit Service |
a47777 |
of the axes, in which case the input array was returned. A view is now
|
|
Packit Service |
a47777 |
returned in all cases.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*nonzero* now returns base ndarrays
|
|
Packit Service |
a47777 |
-----------------------------------
|
|
Packit Service |
a47777 |
Previously, an inconsistency existed between 1-D inputs (returning a
|
|
Packit Service |
a47777 |
base ndarray) and higher dimensional ones (which preserved subclasses).
|
|
Packit Service |
a47777 |
Behavior has been unified, and the return will now be a base ndarray.
|
|
Packit Service |
a47777 |
Subclasses can still override this behavior by providing their own
|
|
Packit Service |
a47777 |
*nonzero* method.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
C API
|
|
Packit Service |
a47777 |
-----
|
|
Packit Service |
a47777 |
The changes to *swapaxes* also apply to the *PyArray_SwapAxes* C function,
|
|
Packit Service |
a47777 |
which now returns a view in all cases.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
The changes to *nonzero* also apply to the *PyArray_Nonzero* C function,
|
|
Packit Service |
a47777 |
which now returns a base ndarray in all cases.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
The dtype structure (PyArray_Descr) has a new member at the end to cache
|
|
Packit Service |
a47777 |
its hash value. This shouldn't affect any well-written applications.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
The change to the concatenation function DeprecationWarning also affects
|
|
Packit Service |
a47777 |
PyArray_ConcatenateArrays,
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
recarray field return types
|
|
Packit Service |
a47777 |
---------------------------
|
|
Packit Service |
a47777 |
Previously the returned types for recarray fields accessed by attribute and by
|
|
Packit Service |
a47777 |
index were inconsistent, and fields of string type were returned as chararrays.
|
|
Packit Service |
a47777 |
Now, fields accessed by either attribute or indexing will return an ndarray for
|
|
Packit Service |
a47777 |
fields of non-structured type, and a recarray for fields of structured type.
|
|
Packit Service |
a47777 |
Notably, this affect recarrays containing strings with whitespace, as trailing
|
|
Packit Service |
a47777 |
whitespace is trimmed from chararrays but kept in ndarrays of string type.
|
|
Packit Service |
a47777 |
Also, the dtype.type of nested structured fields is now inherited.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
recarray views
|
|
Packit Service |
a47777 |
--------------
|
|
Packit Service |
a47777 |
Viewing an ndarray as a recarray now automatically converts the dtype to
|
|
Packit Service |
a47777 |
np.record. See new record array documentation. Additionally, viewing a recarray
|
|
Packit Service |
a47777 |
with a non-structured dtype no longer converts the result's type to ndarray -
|
|
Packit Service |
a47777 |
the result will remain a recarray.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
'out' keyword argument of ufuncs now accepts tuples of arrays
|
|
Packit Service |
a47777 |
-------------------------------------------------------------
|
|
Packit Service |
a47777 |
When using the 'out' keyword argument of a ufunc, a tuple of arrays, one per
|
|
Packit Service |
a47777 |
ufunc output, can be provided. For ufuncs with a single output a single array
|
|
Packit Service |
a47777 |
is also a valid 'out' keyword argument. Previously a single array could be
|
|
Packit Service |
a47777 |
provided in the 'out' keyword argument, and it would be used as the first
|
|
Packit Service |
a47777 |
output for ufuncs with multiple outputs, is deprecated, and will result in a
|
|
Packit Service |
a47777 |
`DeprecationWarning` now and an error in the future.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
byte-array indices now raises an IndexError
|
|
Packit Service |
a47777 |
-------------------------------------------
|
|
Packit Service |
a47777 |
Indexing an ndarray using a byte-string in Python 3 now raises an IndexError
|
|
Packit Service |
a47777 |
instead of a ValueError.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Masked arrays containing objects with arrays
|
|
Packit Service |
a47777 |
--------------------------------------------
|
|
Packit Service |
a47777 |
For such (rare) masked arrays, getting a single masked item no longer returns a
|
|
Packit Service |
a47777 |
corrupted masked array, but a fully masked version of the item.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Median warns and returns nan when invalid values are encountered
|
|
Packit Service |
a47777 |
----------------------------------------------------------------
|
|
Packit Service |
a47777 |
Similar to mean, median and percentile now emits a Runtime warning and
|
|
Packit Service |
a47777 |
returns `NaN` in slices where a `NaN` is present.
|
|
Packit Service |
a47777 |
To compute the median or percentile while ignoring invalid values use the
|
|
Packit Service |
a47777 |
new `nanmedian` or `nanpercentile` functions.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Functions available from numpy.ma.testutils have changed
|
|
Packit Service |
a47777 |
--------------------------------------------------------
|
|
Packit Service |
a47777 |
All functions from numpy.testing were once available from
|
|
Packit Service |
a47777 |
numpy.ma.testutils but not all of them were redefined to work with masked
|
|
Packit Service |
a47777 |
arrays. Most of those functions have now been removed from
|
|
Packit Service |
a47777 |
numpy.ma.testutils with a small subset retained in order to preserve
|
|
Packit Service |
a47777 |
backward compatibility. In the long run this should help avoid mistaken use
|
|
Packit Service |
a47777 |
of the wrong functions, but it may cause import problems for some.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
New Features
|
|
Packit Service |
a47777 |
============
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Reading extra flags from site.cfg
|
|
Packit Service |
a47777 |
---------------------------------
|
|
Packit Service |
a47777 |
Previously customization of compilation of dependency libraries and numpy
|
|
Packit Service |
a47777 |
itself was only accomblishable via code changes in the distutils package.
|
|
Packit Service |
a47777 |
Now numpy.distutils reads in the following extra flags from each group of the
|
|
Packit Service |
a47777 |
*site.cfg*:
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
* ``runtime_library_dirs/rpath``, sets runtime library directories to override
|
|
Packit Service |
a47777 |
``LD_LIBRARY_PATH``
|
|
Packit Service |
a47777 |
* ``extra_compile_args``, add extra flags to the compilation of sources
|
|
Packit Service |
a47777 |
* ``extra_link_args``, add extra flags when linking libraries
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
This should, at least partially, complete user customization.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*np.cbrt* to compute cube root for real floats
|
|
Packit Service |
a47777 |
----------------------------------------------
|
|
Packit Service |
a47777 |
*np.cbrt* wraps the C99 cube root function *cbrt*.
|
|
Packit Service |
a47777 |
Compared to *np.power(x, 1./3.)* it is well defined for negative real floats
|
|
Packit Service |
a47777 |
and a bit faster.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
numpy.distutils now allows parallel compilation
|
|
Packit Service |
a47777 |
-----------------------------------------------
|
|
Packit Service |
a47777 |
By passing *--parallel=n* or *-j n* to *setup.py build* the compilation of
|
|
Packit Service |
a47777 |
extensions is now performed in *n* parallel processes.
|
|
Packit Service |
a47777 |
The parallelization is limited to files within one extension so projects using
|
|
Packit Service |
a47777 |
Cython will not profit because it builds extensions from single files.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*genfromtxt* has a new ``max_rows`` argument
|
|
Packit Service |
a47777 |
--------------------------------------------
|
|
Packit Service |
a47777 |
A ``max_rows`` argument has been added to *genfromtxt* to limit the
|
|
Packit Service |
a47777 |
number of rows read in a single call. Using this functionality, it is
|
|
Packit Service |
a47777 |
possible to read in multiple arrays stored in a single file by making
|
|
Packit Service |
a47777 |
repeated calls to the function.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
New function *np.broadcast_to* for invoking array broadcasting
|
|
Packit Service |
a47777 |
--------------------------------------------------------------
|
|
Packit Service |
a47777 |
*np.broadcast_to* manually broadcasts an array to a given shape according to
|
|
Packit Service |
a47777 |
numpy's broadcasting rules. The functionality is similar to broadcast_arrays,
|
|
Packit Service |
a47777 |
which in fact has been rewritten to use broadcast_to internally, but only a
|
|
Packit Service |
a47777 |
single array is necessary.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
New context manager *clear_and_catch_warnings* for testing warnings
|
|
Packit Service |
a47777 |
-------------------------------------------------------------------
|
|
Packit Service |
a47777 |
When Python emits a warning, it records that this warning has been emitted in
|
|
Packit Service |
a47777 |
the module that caused the warning, in a module attribute
|
|
Packit Service |
a47777 |
``__warningregistry__``. Once this has happened, it is not possible to emit
|
|
Packit Service |
a47777 |
the warning again, unless you clear the relevant entry in
|
|
Packit Service |
a47777 |
``__warningregistry__``. This makes is hard and fragile to test warnings,
|
|
Packit Service |
a47777 |
because if your test comes after another that has already caused the warning,
|
|
Packit Service |
a47777 |
you will not be able to emit the warning or test it. The context manager
|
|
Packit Service |
a47777 |
``clear_and_catch_warnings`` clears warnings from the module registry on entry
|
|
Packit Service |
a47777 |
and resets them on exit, meaning that warnings can be re-raised.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*cov* has new ``fweights`` and ``aweights`` arguments
|
|
Packit Service |
a47777 |
-----------------------------------------------------
|
|
Packit Service |
a47777 |
The ``fweights`` and ``aweights`` arguments add new functionality to
|
|
Packit Service |
a47777 |
covariance calculations by applying two types of weighting to observation
|
|
Packit Service |
a47777 |
vectors. An array of ``fweights`` indicates the number of repeats of each
|
|
Packit Service |
a47777 |
observation vector, and an array of ``aweights`` provides their relative
|
|
Packit Service |
a47777 |
importance or probability.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Support for the '@' operator in Python 3.5+
|
|
Packit Service |
a47777 |
-------------------------------------------
|
|
Packit Service |
a47777 |
Python 3.5 adds support for a matrix multiplication operator '@' proposed
|
|
Packit Service |
a47777 |
in PEP465. Preliminary support for that has been implemented, and an
|
|
Packit Service |
a47777 |
equivalent function ``matmul`` has also been added for testing purposes and
|
|
Packit Service |
a47777 |
use in earlier Python versions. The function is preliminary and the order
|
|
Packit Service |
a47777 |
and number of its optional arguments can be expected to change.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
New argument ``norm`` to fft functions
|
|
Packit Service |
a47777 |
--------------------------------------
|
|
Packit Service |
a47777 |
The default normalization has the direct transforms unscaled and the inverse
|
|
Packit Service |
a47777 |
transforms are scaled by :math:`1/n`. It is possible to obtain unitary
|
|
Packit Service |
a47777 |
transforms by setting the keyword argument ``norm`` to ``"ortho"`` (default is
|
|
Packit Service |
a47777 |
`None`) so that both direct and inverse transforms will be scaled by
|
|
Packit Service |
a47777 |
:math:`1/\\sqrt{n}`.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Improvements
|
|
Packit Service |
a47777 |
============
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*np.digitize* using binary search
|
|
Packit Service |
a47777 |
---------------------------------
|
|
Packit Service |
a47777 |
*np.digitize* is now implemented in terms of *np.searchsorted*. This means
|
|
Packit Service |
a47777 |
that a binary search is used to bin the values, which scales much better
|
|
Packit Service |
a47777 |
for larger number of bins than the previous linear search. It also removes
|
|
Packit Service |
a47777 |
the requirement for the input array to be 1-dimensional.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*np.poly* now casts integer inputs to float
|
|
Packit Service |
a47777 |
-------------------------------------------
|
|
Packit Service |
a47777 |
*np.poly* will now cast 1-dimensional input arrays of integer type to double
|
|
Packit Service |
a47777 |
precision floating point, to prevent integer overflow when computing the monic
|
|
Packit Service |
a47777 |
polynomial. It is still possible to obtain higher precision results by
|
|
Packit Service |
a47777 |
passing in an array of object type, filled e.g. with Python ints.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*np.interp* can now be used with periodic functions
|
|
Packit Service |
a47777 |
---------------------------------------------------
|
|
Packit Service |
a47777 |
*np.interp* now has a new parameter *period* that supplies the period of the
|
|
Packit Service |
a47777 |
input data *xp*. In such case, the input data is properly normalized to the
|
|
Packit Service |
a47777 |
given period and one end point is added to each extremity of *xp* in order to
|
|
Packit Service |
a47777 |
close the previous and the next period cycles, resulting in the correct
|
|
Packit Service |
a47777 |
interpolation behavior.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*np.pad* supports more input types for ``pad_width`` and ``constant_values``
|
|
Packit Service |
a47777 |
----------------------------------------------------------------------------
|
|
Packit Service |
a47777 |
``constant_values`` parameters now accepts NumPy arrays and float values.
|
|
Packit Service |
a47777 |
NumPy arrays are supported as input for ``pad_width``, and an exception is
|
|
Packit Service |
a47777 |
raised if its values are not of integral type.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*np.argmax* and *np.argmin* now support an ``out`` argument
|
|
Packit Service |
a47777 |
-----------------------------------------------------------
|
|
Packit Service |
a47777 |
The ``out`` parameter was added to *np.argmax* and *np.argmin* for consistency
|
|
Packit Service |
a47777 |
with *ndarray.argmax* and *ndarray.argmin*. The new parameter behaves exactly
|
|
Packit Service |
a47777 |
as it does in those methods.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
More system C99 complex functions detected and used
|
|
Packit Service |
a47777 |
---------------------------------------------------
|
|
Packit Service |
a47777 |
All of the functions ``in complex.h`` are now detected. There are new
|
|
Packit Service |
a47777 |
fallback implementations of the following functions.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
* npy_ctan,
|
|
Packit Service |
a47777 |
* npy_cacos, npy_casin, npy_catan
|
|
Packit Service |
a47777 |
* npy_ccosh, npy_csinh, npy_ctanh,
|
|
Packit Service |
a47777 |
* npy_cacosh, npy_casinh, npy_catanh
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
As a result of these improvements, there will be some small changes in
|
|
Packit Service |
a47777 |
returned values, especially for corner cases.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*np.loadtxt* support for the strings produced by the ``float.hex`` method
|
|
Packit Service |
a47777 |
-------------------------------------------------------------------------
|
|
Packit Service |
a47777 |
The strings produced by ``float.hex`` look like ``0x1.921fb54442d18p+1``,
|
|
Packit Service |
a47777 |
so this is not the hex used to represent unsigned integer types.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*np.isclose* properly handles minimal values of integer dtypes
|
|
Packit Service |
a47777 |
--------------------------------------------------------------
|
|
Packit Service |
a47777 |
In order to properly handle minimal values of integer types, *np.isclose* will
|
|
Packit Service |
a47777 |
now cast to the float dtype during comparisons. This aligns its behavior with
|
|
Packit Service |
a47777 |
what was provided by *np.allclose*.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*np.allclose* uses *np.isclose* internally.
|
|
Packit Service |
a47777 |
-------------------------------------------
|
|
Packit Service |
a47777 |
*np.allclose* now uses *np.isclose* internally and inherits the ability to
|
|
Packit Service |
a47777 |
compare NaNs as equal by setting ``equal_nan=True``. Subclasses, such as
|
|
Packit Service |
a47777 |
*np.ma.MaskedArray*, are also preserved now.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*np.genfromtxt* now handles large integers correctly
|
|
Packit Service |
a47777 |
----------------------------------------------------
|
|
Packit Service |
a47777 |
*np.genfromtxt* now correctly handles integers larger than ``2**31-1`` on
|
|
Packit Service |
a47777 |
32-bit systems and larger than ``2**63-1`` on 64-bit systems (it previously
|
|
Packit Service |
a47777 |
crashed with an ``OverflowError`` in these cases). Integers larger than
|
|
Packit Service |
a47777 |
``2**63-1`` are converted to floating-point values.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*np.load*, *np.save* have pickle backward compatibility flags
|
|
Packit Service |
a47777 |
-------------------------------------------------------------
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
The functions *np.load* and *np.save* have additional keyword
|
|
Packit Service |
a47777 |
arguments for controlling backward compatibility of pickled Python
|
|
Packit Service |
a47777 |
objects. This enables Numpy on Python 3 to load npy files containing
|
|
Packit Service |
a47777 |
object arrays that were generated on Python 2.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
MaskedArray support for more complicated base classes
|
|
Packit Service |
a47777 |
-----------------------------------------------------
|
|
Packit Service |
a47777 |
Built-in assumptions that the baseclass behaved like a plain array are being
|
|
Packit Service |
a47777 |
removed. In particular, setting and getting elements and ranges will respect
|
|
Packit Service |
a47777 |
baseclass overrides of ``__setitem__`` and ``__getitem__``, and arithmetic
|
|
Packit Service |
a47777 |
will respect overrides of ``__add__``, ``__sub__``, etc.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Changes
|
|
Packit Service |
a47777 |
=======
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
dotblas functionality moved to multiarray
|
|
Packit Service |
a47777 |
-----------------------------------------
|
|
Packit Service |
a47777 |
The cblas versions of dot, inner, and vdot have been integrated into
|
|
Packit Service |
a47777 |
the multiarray module. In particular, vdot is now a multiarray function,
|
|
Packit Service |
a47777 |
which it was not before.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
stricter check of gufunc signature compliance
|
|
Packit Service |
a47777 |
---------------------------------------------
|
|
Packit Service |
a47777 |
Inputs to generalized universal functions are now more strictly checked
|
|
Packit Service |
a47777 |
against the function's signature: all core dimensions are now required to
|
|
Packit Service |
a47777 |
be present in input arrays; core dimensions with the same label must have
|
|
Packit Service |
a47777 |
the exact same size; and output core dimension's must be specified, either
|
|
Packit Service |
a47777 |
by a same label input core dimension or by a passed-in output array.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
views returned from *np.einsum* are writeable
|
|
Packit Service |
a47777 |
---------------------------------------------
|
|
Packit Service |
a47777 |
Views returned by *np.einsum* will now be writeable whenever the input
|
|
Packit Service |
a47777 |
array is writeable.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*np.argmin* skips NaT values
|
|
Packit Service |
a47777 |
----------------------------
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
*np.argmin* now skips NaT values in datetime64 and timedelta64 arrays,
|
|
Packit Service |
a47777 |
making it consistent with *np.min*, *np.argmax* and *np.max*.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Deprecations
|
|
Packit Service |
a47777 |
============
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Array comparisons involving strings or structured dtypes
|
|
Packit Service |
a47777 |
--------------------------------------------------------
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Normally, comparison operations on arrays perform elementwise
|
|
Packit Service |
a47777 |
comparisons and return arrays of booleans. But in some corner cases,
|
|
Packit Service |
a47777 |
especially involving strings are structured dtypes, NumPy has
|
|
Packit Service |
a47777 |
historically returned a scalar instead. For example::
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
### Current behaviour
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
np.arange(2) == "foo"
|
|
Packit Service |
a47777 |
# -> False
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
np.arange(2) < "foo"
|
|
Packit Service |
a47777 |
# -> True on Python 2, error on Python 3
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
np.ones(2, dtype="i4,i4") == np.ones(2, dtype="i4,i4,i4")
|
|
Packit Service |
a47777 |
# -> False
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Continuing work started in 1.9, in 1.10 these comparisons will now
|
|
Packit Service |
a47777 |
raise ``FutureWarning`` or ``DeprecationWarning``, and in the future
|
|
Packit Service |
a47777 |
they will be modified to behave more consistently with other
|
|
Packit Service |
a47777 |
comparison operations, e.g.::
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
### Future behaviour
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
np.arange(2) == "foo"
|
|
Packit Service |
a47777 |
# -> array([False, False])
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
np.arange(2) < "foo"
|
|
Packit Service |
a47777 |
# -> error, strings and numbers are not orderable
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
np.ones(2, dtype="i4,i4") == np.ones(2, dtype="i4,i4,i4")
|
|
Packit Service |
a47777 |
# -> [False, False]
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
SafeEval
|
|
Packit Service |
a47777 |
--------
|
|
Packit Service |
a47777 |
The SafeEval class in numpy/lib/utils.py is deprecated and will be removed
|
|
Packit Service |
a47777 |
in the next release.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
alterdot, restoredot
|
|
Packit Service |
a47777 |
--------------------
|
|
Packit Service |
a47777 |
The alterdot and restoredot functions no longer do anything, and are
|
|
Packit Service |
a47777 |
deprecated.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
pkgload, PackageLoader
|
|
Packit Service |
a47777 |
----------------------
|
|
Packit Service |
a47777 |
These ways of loading packages are now deprecated.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
bias, ddof arguments to corrcoef
|
|
Packit Service |
a47777 |
--------------------------------
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
The values for the ``bias`` and ``ddof`` arguments to the ``corrcoef``
|
|
Packit Service |
a47777 |
function canceled in the division implied by the correlation coefficient and
|
|
Packit Service |
a47777 |
so had no effect on the returned values.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
We now deprecate these arguments to ``corrcoef`` and the masked array version
|
|
Packit Service |
a47777 |
``ma.corrcoef``.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
Because we are deprecating the ``bias`` argument to ``ma.corrcoef``, we also
|
|
Packit Service |
a47777 |
deprecate the use of the ``allow_masked`` argument as a positional argument,
|
|
Packit Service |
a47777 |
as its position will change with the removal of ``bias``. ``allow_masked``
|
|
Packit Service |
a47777 |
will in due course become a keyword-only argument.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
dtype string representation changes
|
|
Packit Service |
a47777 |
-----------------------------------
|
|
Packit Service |
a47777 |
Since 1.6, creating a dtype object from its string representation, e.g.
|
|
Packit Service |
a47777 |
``'f4'``, would issue a deprecation warning if the size did not correspond
|
|
Packit Service |
a47777 |
to an existing type, and default to creating a dtype of the default size
|
|
Packit Service |
a47777 |
for the type. Starting with this release, this will now raise a ``TypeError``.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
The only exception is object dtypes, where both ``'O4'`` and ``'O8'`` will
|
|
Packit Service |
a47777 |
still issue a deprecation warning. This platform-dependent representation
|
|
Packit Service |
a47777 |
will raise an error in the next release.
|
|
Packit Service |
a47777 |
|
|
Packit Service |
a47777 |
In preparation for this upcoming change, the string representation of an
|
|
Packit Service |
a47777 |
object dtype, i.e. ``np.dtype(object).str``, no longer includes the item
|
|
Packit Service |
a47777 |
size, i.e. will return ``'|O'`` instead of ``'|O4'`` or ``'|O8'`` as
|
|
Packit Service |
a47777 |
before.
|