Skip to content

Latest commit

 

History

History
138 lines (96 loc) · 3.98 KB

1.9.0-notes.rst

File metadata and controls

138 lines (96 loc) · 3.98 KB

NumPy 1.9.0 Release Notes

This release supports Python 2.6 -2.7 and 3.2 - 3.3.

Highlights

Dropped Support

The oldnumeric and numarray modules have been removed.

Future Changes

Compatibility notes

Special scalar float values don't cause upcast to double anymore

In previous numpy versions operations involving floating point scalars containing special values NaN, Inf and -Inf caused the result type to be at least float64. As the special values can be represented in the smallest available floating point type the upcast not performed anymore.

For example the dtype of:

np.array([1.], dtype=np.float32) * float('nan')

now remains float32 instead of being cast to float64. Operations involving non-special values have not been changed.

Percentile output changes

If given more than one percentile to compute numpy.percentile returns an array instead of a list. A single percentile still returns a scalar. The array is equivalent to converting the the list returned in older versions to an array via np.array.

If the overwrite_input option is used the input is only partially instead of fully sorted.

npy_3kcompat.h header change

The unused simple_capsule_dtor function has been removed from npy_3kcompat.h. Note that this header is not meant to be used outside of numpy; other projects should be using their own copy of this file when needed.

New Features

Percentile supports more interpolation options

np.percentile now has the interpolation keyword argument to specify in which way points should be interpolated if the percentiles fall between two values. See the documentation for the available options.

Ufunc and Dot Overrides

For better compatibility with external objects you can now override universal functions (ufuncs), numpy.core._dotblas.dot, and numpy.core.multiarray.dot (the numpy.dot functions). By defining a __numpy_ufunc__ method.

Dtype parameter added to np.linspace and np.logspace

The returned data type from the linspace and logspace functions can now be specificed using the dtype parameter.

tobytes alias for tostring method

ndarray.tobytes and MaskedArray.tobytes have been added as aliases for tostring which exports arrays as bytes. This is more consistent in Python 3 where str and bytes are not the same.

Improvements

Percentile implemented in terms of np.partition

np.percentile has been implemented interms of np.partition which only partially sorts the data via a selection algorithm. This improves the time complexcity from O(nlog(n)) to O(n).

Performance improvement for np.array

The performance of converting lists containing arrays to arrays using np.array has been improved. It is now equivalent in speed to np.vstack(list).

Changes

Argmin and argmax out argument

The out argument to np.argmin and np.argmax and their equivalent C-API functions is now checked to match the desired output shape exactly. If the check fails a ValueError instead of TypeError is raised.

Einsum

Remove unnecessary broadcasting notation restrictions. np.einsum('ijk,j->ijk', A, B) can also be written as np.einsum('ij...,j->ij...', A, B) (ellipsis is no longer required on 'j')

C-API

None

Deprecations

Non-integer scalars for sequence repetition

Using non-integer numpy scalars to repeat python sequences is deprecated. For example np.float_(2) * [1] will be an error in the future.

C-API

None

New Features