Available release of Python library for scientific computing NumPy 2.0.0, focused on working with multidimensional arrays and matrices, and also providing a large collection of functions with the implementation of various algorithms related to the use of matrices. NumPy is one of the most popular libraries used for scientific calculations. The project code is written in Python using optimizations in C and distributed by under BSD license.
NumPy 2.0.0 marks the first significant release since 2006. IN new version in addition to new features and performance optimizations, changes have been made to the ABI, Python API And C-API, violating backward compatibility. For example, the SciPy library compiled with NumPy 1.x will require recompilation to work with NumPy 2.0. In some cases, for using NumPy 2.0 in applications may be required making changes to the code.
The biggest violation relates to preserving the precision of scalar expressions, for example, “np.float32(3) + 3” will now return a value of type float32 rather than float64, and in expressions with multiple types, the type with the highest precision will be used for the result, i.e. e. “np.array((3), dtype=np.float32) + np.float64(3)” will return a value with type float64. The default integer types on the Windows platform have been changed – on 64-bit systems the 64-bit integer type is now used, and on 32-bit systems the 32-bit integer type is used (previously the analogue of the C type long was used, and now the equivalent of np.intp).
Some definitions in the C-API have been replaced or removed, for example, the PyArray_Descr structure has been changed. The maximum number of dimensions and arguments set through the NPY_MAXDIMS and NPY_MAXARGS macros has been increased to 64. All complex types have been switched to using standard types from the C99 specification (cfloat_t, cdouble_t, clongdouble_t). Added new C API to create your own dtype. New simplified initialization functions PyArray_ImportNumPyAPI and PyUFunc_ImportUFuncAPI have been proposed.
The Python API provides a more explicit separation between public and private APIs, suggesting new module structure. About 100 functions, modules, and constants have been moved out of the main “np” namespace, deprecated, or removed. Cleaned up the np.lib namespace. The number of objects in the main namespace has been reduced by 10%, and in the numpy.lib namespace by 80%. The numpy.core namespace has been moved to private. Removed some methods from np.ndarray and np.generic classes. New namespace created numpy.stringsf with string operations.
New features include support for float32 and longdouble types in all functions numpy.fftstandard API support Array in the main namespace, a new namespace and types for variable length strings. Performance optimization was carried out using the Intel x86-simd-sort and Google Highway libraries for the string functions sort, argsort, partition and argpartition, operations with fixed strings in the module were accelerated numpy.char. New API added
opt_func_info for tracing and introspection.
Thanks for reading: