NumPy 1.20.0, described as the largest-ever release of the scientific computing package for Python, has arrived, introducing new capabilities such as type annotations and expanded use of SIMD (single instruction, multiple data).
Release notes for NumPy 1.20.0 indicate type annotations have been added for large parts of NumPy. There also is a new
numpy.typing module containing useful types for end users. Currently available types include
ArrayLike, for objects that can be coerced into an array, and
DtypeLike, for objects that can be coerced into a dtype.
Wider use of SIMD in NumPy increases execution speed of universal functions (ufuncs). Work was done to introduce universal functions that will ease the use of modern features on different hardware platforms. In addition, improvements have been made to pave the way to NEP-38 (NumPy Enhancement Proposal) SIMD performance optimizations.
Other additions and improvements in NumPy 1.20.0 include:
- Preliminary work on changing the dtype (data type object) and casting implementations to provide for extending dtypes.
- Preliminary support for version 3.0 of the Cython language for writing C extensions for Python.
randon.Generatorclass has a new
- Indexing errors shall be reported even when the index result is empty.
wherekeyword argument has been added, to only consider specified elements or subaxes from an array in the Boolean evaluation of
- Types in
numpy.typingnow can be imported at runtime.
sliding_window_viewfunction offers a sliding window view for NumPy arrays.
- When creating or assigning to arrays, in all revelant cases NumPy scalars now will be cast identically to NumPy arrays
- Use of aliases of built-in types such as
np.inthas been deprecated.
- Inexact matches for
searchsidehave been deprecated.
- Cleanups have been made pertaining to removing Python 2.7, with code readability improved and technical debt removed.
Installation instructions for NumPy can be found at numpy.org. Language versions supported by NumPy 1.20.0 include Python 3.7 through Python 3.9; support has been dropped for Python 3.6.
Copyright © 2021 IDG Communications, Inc.