diff options
52 files changed, 445 insertions, 300 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index de7f52f81..182f7e678 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,8 +44,8 @@ jobs: . venv/bin/activate pip install --progress-bar=off --upgrade pip 'setuptools<49.2.0' pip install --progress-bar=off -r test_requirements.txt - pip install . pip install --progress-bar=off -r doc_requirements.txt + pip install . - run: name: create release notes diff --git a/doc/release/upcoming_changes/17530.improvement.rst b/doc/release/upcoming_changes/17530.improvement.rst deleted file mode 100644 index 07a23f0e5..000000000 --- a/doc/release/upcoming_changes/17530.improvement.rst +++ /dev/null @@ -1,5 +0,0 @@ -`ctypeslib.load_library` can now take any path-like object ------------------------------------------------------------------------ -All parameters in the can now take any :term:`python:path-like object`. -This includes the likes of strings, bytes and objects implementing the -:meth:`__fspath__<os.PathLike.__fspath__>` protocol. diff --git a/doc/release/upcoming_changes/17582.new_feature.rst b/doc/release/upcoming_changes/17582.new_feature.rst deleted file mode 100644 index c2426330c..000000000 --- a/doc/release/upcoming_changes/17582.new_feature.rst +++ /dev/null @@ -1,10 +0,0 @@ -NEP 49 configurable allocators ------------------------------- -As detailed in `NEP 49`_, the function used for allocation of the data segment -of a ndarray can be changed. The policy can be set globally or in a context. -For more information see the NEP and the :ref:`data_memory` reference docs. -Also add a ``NUMPY_WARN_IF_NO_MEM_POLICY`` override to warn on dangerous use -of transfering ownership by setting ``NPY_ARRAY_OWNDATA``. - -.. _`NEP 49`: https://numpy.org/neps/nep-0049.html - diff --git a/doc/release/upcoming_changes/18536.improvement.rst b/doc/release/upcoming_changes/18536.improvement.rst deleted file mode 100644 index 8693916db..000000000 --- a/doc/release/upcoming_changes/18536.improvement.rst +++ /dev/null @@ -1,7 +0,0 @@ -Add ``smallest_normal`` and ``smallest_subnormal`` attributes to `finfo` -------------------------------------------------------------------------- - -The attributes ``smallest_normal`` and ``smallest_subnormal`` are available as -an extension of `finfo` class for any floating-point data type. To use these -new attributes, write ``np.finfo(np.float64).smallest_normal`` or -``np.finfo(np.float64).smallest_subnormal``. diff --git a/doc/release/upcoming_changes/18585.new_feature.rst b/doc/release/upcoming_changes/18585.new_feature.rst deleted file mode 100644 index bb83d755c..000000000 --- a/doc/release/upcoming_changes/18585.new_feature.rst +++ /dev/null @@ -1,15 +0,0 @@ -Implementation of the NEP 47 (adopting the array API standard) --------------------------------------------------------------- - -An initial implementation of `NEP 47`_ (adoption the array API standard) has -been added as ``numpy.array_api``. The implementation is experimental and will -issue a UserWarning on import, as the `array API standard -<https://data-apis.org/array-api/latest/index.html>`_ is still in draft state. -``numpy.array_api`` is a conforming implementation of the array API standard, -which is also minimal, meaning that only those functions and behaviors that -are required by the standard are implemented (see the NEP for more info). -Libraries wishing to make use of the array API standard are encouraged to use -``numpy.array_api`` to check that they are only using functionality that is -guaranteed to be present in standard conforming implementations. - -.. _`NEP 47`: https://numpy.org/neps/nep-0047-array-api-standard.html diff --git a/doc/release/upcoming_changes/18884.new_feature.rst b/doc/release/upcoming_changes/18884.new_feature.rst deleted file mode 100644 index 41503b00e..000000000 --- a/doc/release/upcoming_changes/18884.new_feature.rst +++ /dev/null @@ -1,7 +0,0 @@ -Generate C/C++ API reference documentation from comments blocks is now possible -------------------------------------------------------------------------------- -This feature depends on Doxygen_ in the generation process and on Breathe_ -to integrate it with Sphinx. - -.. _`Doxygen`: https://www.doxygen.nl/index.html -.. _`Breathe`: https://breathe.readthedocs.io/en/latest/ diff --git a/doc/release/upcoming_changes/19062.new_feature.rst b/doc/release/upcoming_changes/19062.new_feature.rst deleted file mode 100644 index 171715568..000000000 --- a/doc/release/upcoming_changes/19062.new_feature.rst +++ /dev/null @@ -1,21 +0,0 @@ -Assign the platform-specific ``c_intp`` precision via a mypy plugin -------------------------------------------------------------------- - -The mypy_ plugin, introduced in `numpy/numpy#17843`_, has again been expanded: -the plugin now is now responsible for setting the platform-specific precision -of `numpy.ctypeslib.c_intp`, the latter being used as data type for various -`numpy.ndarray.ctypes` attributes. - -Without the plugin, aforementioned type will default to `ctypes.c_int64`. - -To enable the plugin, one must add it to their mypy `configuration file`_: - -.. code-block:: ini - - [mypy] - plugins = numpy.typing.mypy_plugin - - -.. _mypy: http://mypy-lang.org/ -.. _configuration file: https://mypy.readthedocs.io/en/stable/config_file.html -.. _`numpy/numpy#17843`: https://github.com/numpy/numpy/pull/17843 diff --git a/doc/release/upcoming_changes/19083.new_feature.rst b/doc/release/upcoming_changes/19083.new_feature.rst deleted file mode 100644 index 92f00c0d6..000000000 --- a/doc/release/upcoming_changes/19083.new_feature.rst +++ /dev/null @@ -1,6 +0,0 @@ -Add NEP 47-compatible dlpack support ------------------------------------- - -Add a ``ndarray.__dlpack__()`` method which returns a ``dlpack`` C structure -wrapped in a ``PyCapsule``. Also add a ``np._from_dlpack(obj)`` function, where -``obj`` supports ``__dlpack__()``, and returns an ``ndarray``. diff --git a/doc/release/upcoming_changes/19135.change.rst b/doc/release/upcoming_changes/19135.change.rst deleted file mode 100644 index 0b900a16a..000000000 --- a/doc/release/upcoming_changes/19135.change.rst +++ /dev/null @@ -1,10 +0,0 @@ -Removed floor division support for complex types ------------------------------------------------- - -Floor division of complex types will now result in a `TypeError` - -.. code-block:: python - - >>> a = np.arange(10) + 1j* np.arange(10) - >>> a // 1 - TypeError: ufunc 'floor_divide' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'' diff --git a/doc/release/upcoming_changes/19151.improvement.rst b/doc/release/upcoming_changes/19151.improvement.rst deleted file mode 100644 index 2108b9c4f..000000000 --- a/doc/release/upcoming_changes/19151.improvement.rst +++ /dev/null @@ -1,6 +0,0 @@ -`numpy.linalg.qr` accepts stacked matrices as inputs ----------------------------------------------------- - -`numpy.linalg.qr` is able to produce results for stacked matrices as inputs. -Moreover, the implementation of QR decomposition has been shifted to C -from Python. diff --git a/doc/release/upcoming_changes/19211.new_feature.rst b/doc/release/upcoming_changes/19211.new_feature.rst deleted file mode 100644 index 40e42387c..000000000 --- a/doc/release/upcoming_changes/19211.new_feature.rst +++ /dev/null @@ -1,7 +0,0 @@ -``keepdims`` optional argument added to `numpy.argmin`, `numpy.argmax` ----------------------------------------------------------------------- - -``keepdims`` argument is added to `numpy.argmin`, `numpy.argmax`. -If set to ``True``, the axes which are reduced are left in the result as dimensions with size one. -The resulting array has the same number of dimensions and will broadcast with the -input array. diff --git a/doc/release/upcoming_changes/19259.c_api.rst b/doc/release/upcoming_changes/19259.c_api.rst deleted file mode 100644 index dac9f520a..000000000 --- a/doc/release/upcoming_changes/19259.c_api.rst +++ /dev/null @@ -1,12 +0,0 @@ -Masked inner-loops cannot be customized anymore ------------------------------------------------ -The masked inner-loop selector is now never used. A warning -will be given in the unlikely event that it was customized. - -We do not expect that any code uses this. If you do use it, -you must unset the selector on newer NumPy version. -Please also contact the NumPy developers, we do anticipate -providing a new, more specific, mechanism. - -The customization was part of a never-implemented feature to allow -for faster masked operations. diff --git a/doc/release/upcoming_changes/19355.new_feature.rst b/doc/release/upcoming_changes/19355.new_feature.rst deleted file mode 100644 index cfa50b7a1..000000000 --- a/doc/release/upcoming_changes/19355.new_feature.rst +++ /dev/null @@ -1,13 +0,0 @@ -``bit_count`` to compute the number of 1-bits in an integer ------------------------------------------------------------ - -Computes the number of 1-bits in the absolute value of the input. -This works on all the numpy integer types. Analogous to the builtin -``int.bit_count`` or ``popcount`` in C++. - -.. code-block:: python - - >>> np.uint32(1023).bit_count() - 10 - >>> np.int32(-127).bit_count() - 7 diff --git a/doc/release/upcoming_changes/19356.change.rst b/doc/release/upcoming_changes/19356.change.rst deleted file mode 100644 index 3c5ef4a91..000000000 --- a/doc/release/upcoming_changes/19356.change.rst +++ /dev/null @@ -1,7 +0,0 @@ -`numpy.vectorize` functions now produce the same output class as the base function ----------------------------------------------------------------------------------- -When a function that respects `numpy.ndarray` subclasses is vectorized using -`numpy.vectorize`, the vectorized function will now be subclass-safe -also for cases that a signature is given (i.e., when creating a ``gufunc``): -the output class will be the same as that returned by the first call to -the underlying function. diff --git a/doc/release/upcoming_changes/19459.new_feature.rst b/doc/release/upcoming_changes/19459.new_feature.rst deleted file mode 100644 index aecae670f..000000000 --- a/doc/release/upcoming_changes/19459.new_feature.rst +++ /dev/null @@ -1,4 +0,0 @@ -The ``ndim`` and ``axis`` attributes have been added to `numpy.AxisError` -------------------------------------------------------------------------- -The ``ndim`` and ``axis`` parameters are now also stored as attributes -within each `numpy.AxisError` instance. diff --git a/doc/release/upcoming_changes/19462.change.rst b/doc/release/upcoming_changes/19462.change.rst deleted file mode 100644 index 8fbadb394..000000000 --- a/doc/release/upcoming_changes/19462.change.rst +++ /dev/null @@ -1,3 +0,0 @@ -OpenBLAS v0.3.17 ----------------- -Update the OpenBLAS used in testing and in wheels to v0.3.17 diff --git a/doc/release/upcoming_changes/19478.performance.rst b/doc/release/upcoming_changes/19478.performance.rst deleted file mode 100644 index 6a389c20e..000000000 --- a/doc/release/upcoming_changes/19478.performance.rst +++ /dev/null @@ -1,11 +0,0 @@ -Vectorize umath module using AVX-512 -------------------------------------- - -By leveraging Intel Short Vector Math Library (SVML), 18 umath functions -(``exp2``, ``log2``, ``log10``, ``expm1``, ``log1p``, ``cbrt``, ``sin``, -``cos``, ``tan``, ``arcsin``, ``arccos``, ``arctan``, ``sinh``, ``cosh``, -``tanh``, ``arcsinh``, ``arccosh``, ``arctanh``) are vectorized using AVX-512 -instruction set for both single and double precision implementations. This -change is currently enabled only for Linux users and on processors with -AVX-512 instruction set. It provides an average speed up of 32x and 14x for -single and double precision functions respectively. diff --git a/doc/release/upcoming_changes/19479.compatibility.rst b/doc/release/upcoming_changes/19479.compatibility.rst deleted file mode 100644 index 83533a305..000000000 --- a/doc/release/upcoming_changes/19479.compatibility.rst +++ /dev/null @@ -1,7 +0,0 @@ -Distutils forces strict floating point model on clang ------------------------------------------------------ -NumPy now sets the ``-ftrapping-math`` option on clang to enforce correct -floating point error handling for universal functions. -Clang defaults to non-IEEE and C99 conform behaviour otherwise. -This change (using the equivalent but newer ``-ffp-exception-behavior=strict``) -was attempted in NumPy 1.21, but was effectively never used. diff --git a/doc/release/upcoming_changes/19513.new_feature.rst b/doc/release/upcoming_changes/19513.new_feature.rst deleted file mode 100644 index 5f945cea2..000000000 --- a/doc/release/upcoming_changes/19513.new_feature.rst +++ /dev/null @@ -1,4 +0,0 @@ -Preliminary support for `windows/arm64` target ----------------------------------------------- -``numpy`` added support for windows/arm64 target. Please note -``OpenBLAS`` support is not yet available for windows/arm64 target. diff --git a/doc/release/upcoming_changes/19527.new_feature.rst b/doc/release/upcoming_changes/19527.new_feature.rst deleted file mode 100644 index 3967f1841..000000000 --- a/doc/release/upcoming_changes/19527.new_feature.rst +++ /dev/null @@ -1,3 +0,0 @@ -Added support for LoongArch ------------------------------------------------- -LoongArch is a new instruction set, numpy compilation failure on LoongArch architecture, so add the commit. diff --git a/doc/release/upcoming_changes/19539.expired.rst b/doc/release/upcoming_changes/19539.expired.rst deleted file mode 100644 index 6e94f175d..000000000 --- a/doc/release/upcoming_changes/19539.expired.rst +++ /dev/null @@ -1,2 +0,0 @@ -* Using the strings ``"Bytes0"``, ``"Datetime64"``, ``"Str0"``, ``"Uint32"``, - and ``"Uint64"`` as a dtype will now raise a ``TypeError``.
\ No newline at end of file diff --git a/doc/release/upcoming_changes/19615.expired.rst b/doc/release/upcoming_changes/19615.expired.rst deleted file mode 100644 index 4e02771e3..000000000 --- a/doc/release/upcoming_changes/19615.expired.rst +++ /dev/null @@ -1,8 +0,0 @@ -Expired deprecations for ``loads``, ``ndfromtxt``, and ``mafromtxt`` in npyio ------------------------------------------------------------------------------ - -``numpy.loads`` was deprecated in v1.15, with the recommendation that users -use `pickle.loads` instead. -``ndfromtxt`` and ``mafromtxt`` were both deprecated in v1.17 - users should -use `numpy.genfromtxt` instead with the appropriate value for the -``usemask`` parameter. diff --git a/doc/release/upcoming_changes/19665.change.rst b/doc/release/upcoming_changes/19665.change.rst deleted file mode 100644 index 2c2315dd2..000000000 --- a/doc/release/upcoming_changes/19665.change.rst +++ /dev/null @@ -1,4 +0,0 @@ -Python 3.7 is no longer supported ---------------------------------- -Python support has been dropped. This is rather strict, there are -changes that require Python >=3.8. diff --git a/doc/release/upcoming_changes/19680.improvement.rst b/doc/release/upcoming_changes/19680.improvement.rst deleted file mode 100644 index 1a2a3496b..000000000 --- a/doc/release/upcoming_changes/19680.improvement.rst +++ /dev/null @@ -1,5 +0,0 @@ -`numpy.fromregex` now accepts ``os.PathLike`` implementations -------------------------------------------------------------- - -`numpy.fromregex` now accepts objects implementing the `__fspath__<os.PathLike>` -protocol, *e.g.* `pathlib.Path`. diff --git a/doc/release/upcoming_changes/19687.change.rst b/doc/release/upcoming_changes/19687.change.rst deleted file mode 100644 index c7f7512b6..000000000 --- a/doc/release/upcoming_changes/19687.change.rst +++ /dev/null @@ -1,8 +0,0 @@ -str/repr of complex dtypes now include space after punctuation --------------------------------------------------------------- - -The repr of ``np.dtype({"names": ["a"], "formats": [int], "offsets": [2]})`` is -now ``dtype({'names': ['a'], 'formats': ['<i8'], 'offsets': [2], 'itemsize': 10})``, -whereas spaces where previously omitted after colons and between fields. - -The old behavior can be restored via ``np.set_printoptions(legacy="1.21")``. diff --git a/doc/release/upcoming_changes/19754.new_feature.rst b/doc/release/upcoming_changes/19754.new_feature.rst deleted file mode 100644 index 4e91e4cb3..000000000 --- a/doc/release/upcoming_changes/19754.new_feature.rst +++ /dev/null @@ -1,7 +0,0 @@ -A ``.clang-format`` file has been added ---------------------------------------- -Clang-format is a C/C++ code formatter, together with the added -``.clang-format`` file, it produces code close enough to the NumPy -C_STYLE_GUIDE for general use. Clang-format version 12+ is required -due to the use of several new features, it is available in -Fedora 34 and Ubuntu Focal among other distributions. diff --git a/doc/release/upcoming_changes/19803.new_feature.rst b/doc/release/upcoming_changes/19803.new_feature.rst deleted file mode 100644 index 942325822..000000000 --- a/doc/release/upcoming_changes/19803.new_feature.rst +++ /dev/null @@ -1,14 +0,0 @@ -``is_integer`` is now available to `numpy.floating` and `numpy.integer` ------------------------------------------------------------------------ -Based on its counterpart in `float` and `int`, the numpy floating point and -integer types now support `~float.is_integer`. Returns ``True`` if the -number is finite with integral value, and ``False`` otherwise. - -.. code-block:: python - - >>> np.float32(-2.0).is_integer() - True - >>> np.float64(3.2).is_integer() - False - >>> np.int32(-2).is_integer() - True diff --git a/doc/release/upcoming_changes/19805.new_feature.rst b/doc/release/upcoming_changes/19805.new_feature.rst deleted file mode 100644 index f59409254..000000000 --- a/doc/release/upcoming_changes/19805.new_feature.rst +++ /dev/null @@ -1,5 +0,0 @@ -Symbolic parser for Fortran dimension specifications ----------------------------------------------------- -A new symbolic parser has been added to f2py in order to correctly parse -dimension specifications. The parser is the basis for future improvements -and provides compatibility with Draft Fortran 202x. diff --git a/doc/release/upcoming_changes/19857.improvement.rst b/doc/release/upcoming_changes/19857.improvement.rst deleted file mode 100644 index cbeff08b1..000000000 --- a/doc/release/upcoming_changes/19857.improvement.rst +++ /dev/null @@ -1,13 +0,0 @@ -Add new methods for ``quantile`` and ``percentile`` ---------------------------------------------------- - -``quantile`` and ``percentile`` now have have a ``method=`` -keyword argument supporting 13 different methods. -This replaces the ``interpolation=`` keyword argument. - -The methods are now aligned with nine methods which can be -found in scientific literature and the R language. -The remaining methods are the previous discontinuous variations -of the default "linear" one. - -Please see the documentation of `numpy.percentile` for more information. diff --git a/doc/release/upcoming_changes/19879.new_feature.rst b/doc/release/upcoming_changes/19879.new_feature.rst deleted file mode 100644 index c6624138b..000000000 --- a/doc/release/upcoming_changes/19879.new_feature.rst +++ /dev/null @@ -1,15 +0,0 @@ -``ndarray``, ``dtype`` and ``number`` are now runtime-subscriptable -------------------------------------------------------------------- -Mimicking :pep:`585`, the `~numpy.ndarray`, `~numpy.dtype` and `~numpy.number` -classes are now subscriptable for python 3.9 and later. -Consequently, expressions that were previously only allowed in .pyi stub files -or with the help of ``from __future__ import annotations`` are now also legal -during runtime. - -.. code-block:: python - - >>> import numpy as np - >>> from typing import Any - - >>> np.ndarray[Any, np.dtype[np.float64]] - numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]] diff --git a/doc/release/upcoming_changes/19921.deprecation.rst b/doc/release/upcoming_changes/19921.deprecation.rst deleted file mode 100644 index 17fa0f605..000000000 --- a/doc/release/upcoming_changes/19921.deprecation.rst +++ /dev/null @@ -1,3 +0,0 @@ -* the misspelled keyword argument ``delimitor`` of - ``numpy.ma.mrecords.fromtextfile()`` has been changed into - ``delimiter``, using it will emit a deprecation warning. diff --git a/doc/release/upcoming_changes/20000.deprecation.rst b/doc/release/upcoming_changes/20000.deprecation.rst deleted file mode 100644 index e0a56cd47..000000000 --- a/doc/release/upcoming_changes/20000.deprecation.rst +++ /dev/null @@ -1,5 +0,0 @@ -Passing boolean ``kth`` values to (arg-)partition has been deprecated ---------------------------------------------------------------------- -`~numpy.partition` and `~numpy.argpartition` would previously accept boolean -values for the ``kth`` parameter, which would subsequently be converted into -integers. This behavior has now been deprecated. diff --git a/doc/release/upcoming_changes/20027.improvement.rst b/doc/release/upcoming_changes/20027.improvement.rst deleted file mode 100644 index 86b3bed74..000000000 --- a/doc/release/upcoming_changes/20027.improvement.rst +++ /dev/null @@ -1,17 +0,0 @@ -Missing parameters have been added to the ``nan<x>`` functions --------------------------------------------------------------- -A number of the ``nan<x>`` functions previously lacked parameters that were -present in their ``<x>``-based counterpart, *e.g.* the ``where`` parameter was -present in `~numpy.mean` but absent from `~numpy.nanmean`. - -The following parameters have now been added to the ``nan<x>`` functions: - -* nanmin: ``initial`` & ``where`` -* nanmax: ``initial`` & ``where`` -* nanargmin: ``keepdims`` & ``out`` -* nanargmax: ``keepdims`` & ``out`` -* nansum: ``initial`` & ``where`` -* nanprod: ``initial`` & ``where`` -* nanmean: ``where`` -* nanvar: ``where`` -* nanstd: ``where`` diff --git a/doc/release/upcoming_changes/20049.change.rst b/doc/release/upcoming_changes/20049.change.rst deleted file mode 100644 index e1f08b343..000000000 --- a/doc/release/upcoming_changes/20049.change.rst +++ /dev/null @@ -1,5 +0,0 @@ -Corrected ``advance`` in ``PCG64DSXM`` and ``PCG64`` ----------------------------------------------------- -Fixed a bug in the ``advance`` method of ``PCG64DSXM`` and ``PCG64``. The bug only -affects results when the step was larger than :math:`2^{64}` on platforms -that do not support 128-bit integers(e.g., Windows and 32-bit Linux). diff --git a/doc/release/upcoming_changes/20201.deprecation.rst b/doc/release/upcoming_changes/20201.deprecation.rst deleted file mode 100644 index db8cda21f..000000000 --- a/doc/release/upcoming_changes/20201.deprecation.rst +++ /dev/null @@ -1,5 +0,0 @@ -The ``np.MachAr`` class has been deprecated -------------------------------------------- -The `~numpy.MachAr` class and `finfo.machar <numpy.finfo>` attribute have -been deprecated. Users are encouraged to access the property if interest -directly from the corresponding `~numpy.finfo` attribute. diff --git a/doc/release/upcoming_changes/20217.improvement.rst b/doc/release/upcoming_changes/20217.improvement.rst deleted file mode 100644 index 28e5c8ff7..000000000 --- a/doc/release/upcoming_changes/20217.improvement.rst +++ /dev/null @@ -1,10 +0,0 @@ -Annotating the main Numpy namespace --------------------------------------- -Starting from the 1.20 release, PEP 484 type annotations have been included -for parts of the NumPy library; annotating the remaining functions being a -work in progress. With the release of 1.22 this process has been completed for -the main NumPy namespace, which is now fully annotated. - -Besides the main namespace, a limited number of sub-packages contain -annotations as well. This includes, among others, `numpy.testing`, -`numpy.linalg` and `numpy.random` (available since 1.21). diff --git a/doc/release/upcoming_changes/20314.change.rst b/doc/release/upcoming_changes/20314.change.rst deleted file mode 100644 index ea7e29aff..000000000 --- a/doc/release/upcoming_changes/20314.change.rst +++ /dev/null @@ -1,10 +0,0 @@ -Change in generation of random 32 bit floating point variates -------------------------------------------------------------- -There was bug in the generation of 32 bit floating point values from -the uniform distribution that would result in the least significant -bit of the random variate always being 0. This has been fixed. - -This change affects the variates produced by the `random.Generator` -methods ``random``, ``standard_normal``, ``standard_exponential``, and -``standard_gamma``, but only when the dtype is specified as -``numpy.float32``. diff --git a/doc/source/dev/development_workflow.rst b/doc/source/dev/development_workflow.rst index 8c56f6fb2..585aacfc9 100644 --- a/doc/source/dev/development_workflow.rst +++ b/doc/source/dev/development_workflow.rst @@ -187,6 +187,27 @@ Standard acronyms to start the commit message with are:: TST: addition or modification of tests REL: related to releasing numpy +Commands to skip continuous integration +``````````````````````````````````````` + +By default a lot of continuous integration (CI) jobs are run for every PR, +from running the test suite on different operating systems and hardware +platforms to building the docs. In some cases you already know that CI isn't +needed (or not all of it), for example if you work on CI config files, text in +the README, or other files that aren't involved in regular build, test or docs +sequences. In such cases you may explicitly skip CI by including one of these +fragments in your commit message:: + + ``[ci skip]``: skip as much CI as possible (not all jobs can be skipped) + ``[skip github]``: skip GitHub Actions "build numpy and run tests" jobs + ``[skip travis]``: skip TravisCI jobs + ``[skip azurepipelines]``: skip Azure jobs + +*Note: unfortunately not all CI systems implement this feature well, or at all. +CircleCI supports ``ci skip`` but has no command to skip only CircleCI. +Azure chooses to still run jobs with skip commands on PRs, the jobs only get +skipped on merging to master.* + .. _workflow_mailing_list: diff --git a/doc/source/release.rst b/doc/source/release.rst index a4a5bde63..9504c6e97 100644 --- a/doc/source/release.rst +++ b/doc/source/release.rst @@ -5,6 +5,7 @@ Release notes .. toctree:: :maxdepth: 3 + 1.23.0 <release/1.23.0-notes> 1.22.0 <release/1.22.0-notes> 1.21.4 <release/1.21.4-notes> 1.21.3 <release/1.21.3-notes> diff --git a/doc/source/release/1.23.0-notes.rst b/doc/source/release/1.23.0-notes.rst new file mode 100644 index 000000000..330e7fd44 --- /dev/null +++ b/doc/source/release/1.23.0-notes.rst @@ -0,0 +1,45 @@ +.. currentmodule:: numpy + +========================== +NumPy 1.23.0 Release Notes +========================== + + +Highlights +========== + + +New functions +============= + + +Deprecations +============ + + +Future Changes +============== + + +Expired deprecations +==================== + + +Compatibility notes +=================== + + +C API changes +============= + + +New Features +============ + + +Improvements +============ + + +Changes +======= diff --git a/doc/source/user/basics.copies.rst b/doc/source/user/basics.copies.rst index 583a59b95..e8ba68bc0 100644 --- a/doc/source/user/basics.copies.rst +++ b/doc/source/user/basics.copies.rst @@ -39,6 +39,8 @@ do not reflect on the original array. Making a copy is slower and memory-consuming but sometimes necessary. A copy can be forced by using :meth:`.ndarray.copy`. +.. _indexing-operations: + Indexing operations =================== diff --git a/doc/source/user/basics.indexing.rst b/doc/source/user/basics.indexing.rst index 264c3d721..e99682f02 100644 --- a/doc/source/user/basics.indexing.rst +++ b/doc/source/user/basics.indexing.rst @@ -28,6 +28,7 @@ Note that in Python, ``x[(exp1, exp2, ..., expN)]`` is equivalent to ``x[exp1, exp2, ..., expN]``; the latter is just syntactic sugar for the former. +.. _basic-indexing: Basic indexing -------------- @@ -88,6 +89,7 @@ that is subsequently indexed by 2. rapidly changing location in memory. This difference represents a great potential for confusion. +.. _slicing-and-striding: Slicing and striding ^^^^^^^^^^^^^^^^^^^^ @@ -226,6 +228,7 @@ concepts to remember include: .. index:: pair: ndarray; view +.. _dimensional-indexing-tools: Dimensional indexing tools ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -470,6 +473,7 @@ such an array with an image with shape (ny, nx) with dtype=np.uint8 lookup table) will result in an array of shape (ny, nx, 3) where a triple of RGB values is associated with each pixel location. +.. _boolean-indexing: Boolean array indexing ^^^^^^^^^^^^^^^^^^^^^^ @@ -851,7 +855,7 @@ For this reason, it is possible to use the output from the :meth:`np.nonzero() <ndarray.nonzero>` function directly as an index since it always returns a tuple of index arrays. -Because the special treatment of tuples, they are not automatically +Because of the special treatment of tuples, they are not automatically converted to an array as a list would be. As an example: :: >>> z[[1, 1, 1, 1]] # produces a large array diff --git a/doc/source/user/how-to-index.rst b/doc/source/user/how-to-index.rst new file mode 100644 index 000000000..41061d5f4 --- /dev/null +++ b/doc/source/user/how-to-index.rst @@ -0,0 +1,351 @@ +.. currentmodule:: numpy + +.. _how-to-index.rst: + +***************************************** +How to index :class:`ndarrays <.ndarray>` +***************************************** + +.. seealso:: :ref:`basics.indexing` + +This page tackles common examples. For an in-depth look into indexing, refer +to :ref:`basics.indexing`. + +Access specific/arbitrary rows and columns +========================================== + +Use :ref:`basic-indexing` features like :ref:`slicing-and-striding`, and +:ref:`dimensional-indexing-tools`. + + >>> a = np.arange(30).reshape(2, 3, 5) + >>> a + array([[[ 0, 1, 2, 3, 4], + [ 5, 6, 7, 8, 9], + [10, 11, 12, 13, 14]], + <BLANKLINE> + [[15, 16, 17, 18, 19], + [20, 21, 22, 23, 24], + [25, 26, 27, 28, 29]]]) + >>> a[0, 2, :] + array([10, 11, 12, 13, 14]) + >>> a[0, :, 3] + array([ 3, 8, 13]) + +Note that the output from indexing operations can have different shape from the +original object. To preserve the original dimensions after indexing, you can +use :func:`newaxis`. To use other such tools, refer to +:ref:`dimensional-indexing-tools`. + + >>> a[0, :, 3].shape + (3,) + >>> a[0, :, 3, np.newaxis].shape + (3, 1) + >>> a[0, :, 3, np.newaxis, np.newaxis].shape + (3, 1, 1) + +Variables can also be used to index:: + + >>> y = 0 + >>> a[y, :, y+3] + array([ 3, 8, 13]) + +Refer to :ref:`dealing-with-variable-indices` to see how to use +:term:`python:slice` and :py:data:`Ellipsis` in your index variables. + +Index columns +------------- + +To index columns, you have to index the last axis. Use +:ref:`dimensional-indexing-tools` to get the desired number of dimensions:: + + >>> a = np.arange(24).reshape(2, 3, 4) + >>> a + array([[[ 0, 1, 2, 3], + [ 4, 5, 6, 7], + [ 8, 9, 10, 11]], + <BLANKLINE> + [[12, 13, 14, 15], + [16, 17, 18, 19], + [20, 21, 22, 23]]]) + >>> a[..., 3] + array([[ 3, 7, 11], + [15, 19, 23]]) + +To index specific elements in each column, make use of :ref:`advanced-indexing` +as below:: + + >>> arr = np.arange(3*4).reshape(3, 4) + >>> arr + array([[ 0, 1, 2, 3], + [ 4, 5, 6, 7], + [ 8, 9, 10, 11]]) + >>> column_indices = [[1, 3], [0, 2], [2, 2]] + >>> np.arange(arr.shape[0]) + array([0, 1, 2]) + >>> row_indices = np.arange(arr.shape[0])[:, np.newaxis] + >>> row_indices + array([[0], + [1], + [2]]) + +Use the ``row_indices`` and ``column_indices`` for advanced +indexing:: + + >>> arr[row_indices, column_indices] + array([[ 1, 3], + [ 4, 6], + [10, 10]]) + +Index along a specific axis +--------------------------- + +Use :meth:`take`. See also :meth:`take_along_axis` and +:meth:`put_along_axis`. + + >>> a = np.arange(30).reshape(2, 3, 5) + >>> a + array([[[ 0, 1, 2, 3, 4], + [ 5, 6, 7, 8, 9], + [10, 11, 12, 13, 14]], + <BLANKLINE> + [[15, 16, 17, 18, 19], + [20, 21, 22, 23, 24], + [25, 26, 27, 28, 29]]]) + >>> np.take(a, [2, 3], axis=2) + array([[[ 2, 3], + [ 7, 8], + [12, 13]], + <BLANKLINE> + [[17, 18], + [22, 23], + [27, 28]]]) + >>> np.take(a, [2], axis=1) + array([[[10, 11, 12, 13, 14]], + <BLANKLINE> + [[25, 26, 27, 28, 29]]]) + +Create subsets of larger matrices +================================= + +Use :ref:`slicing-and-striding` to access chunks of a large array:: + + >>> a = np.arange(100).reshape(10, 10) + >>> a + array([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9], + [10, 11, 12, 13, 14, 15, 16, 17, 18, 19], + [20, 21, 22, 23, 24, 25, 26, 27, 28, 29], + [30, 31, 32, 33, 34, 35, 36, 37, 38, 39], + [40, 41, 42, 43, 44, 45, 46, 47, 48, 49], + [50, 51, 52, 53, 54, 55, 56, 57, 58, 59], + [60, 61, 62, 63, 64, 65, 66, 67, 68, 69], + [70, 71, 72, 73, 74, 75, 76, 77, 78, 79], + [80, 81, 82, 83, 84, 85, 86, 87, 88, 89], + [90, 91, 92, 93, 94, 95, 96, 97, 98, 99]]) + >>> a[2:5, 2:5] + array([[22, 23, 24], + [32, 33, 34], + [42, 43, 44]]) + >>> a[2:5, 1:3] + array([[21, 22], + [31, 32], + [41, 42]]) + >>> a[:5, :5] + array([[ 0, 1, 2, 3, 4], + [10, 11, 12, 13, 14], + [20, 21, 22, 23, 24], + [30, 31, 32, 33, 34], + [40, 41, 42, 43, 44]]) + +The same thing can be done with advanced indexing in a slightly more complex +way. Remember that +:ref:`advanced indexing creates a copy <indexing-operations>`:: + + >>> a[np.arange(5)[:, None], np.arange(5)[None, :]] + array([[ 0, 1, 2, 3, 4], + [10, 11, 12, 13, 14], + [20, 21, 22, 23, 24], + [30, 31, 32, 33, 34], + [40, 41, 42, 43, 44]]) + +You can also use :meth:`mgrid` to generate indices:: + + >>> indices = np.mgrid[0:6:2] + >>> indices + array([0, 2, 4]) + >>> a[:, indices] + array([[ 0, 2, 4], + [10, 12, 14], + [20, 22, 24], + [30, 32, 34], + [40, 42, 44], + [50, 52, 54], + [60, 62, 64], + [70, 72, 74], + [80, 82, 84], + [90, 92, 94]]) + +Filter values +============= + +Non-zero elements +----------------- + +Use :meth:`nonzero` to get a tuple of array indices of non-zero elements +corresponding to every dimension:: + + >>> z = np.array([[1, 2, 3, 0], [0, 0, 5, 3], [4, 6, 0, 0]]) + >>> z + array([[1, 2, 3, 0], + [0, 0, 5, 3], + [4, 6, 0, 0]]) + >>> np.nonzero(z) + (array([0, 0, 0, 1, 1, 2, 2]), array([0, 1, 2, 2, 3, 0, 1])) + +Use :meth:`flatnonzero` to fetch indices of elements that are non-zero in +the flattened version of the ndarray:: + + >>> np.flatnonzero(z) + array([0, 1, 2, 6, 7, 8, 9]) + +Arbitrary conditions +-------------------- + +Use :meth:`where` to generate indices based on conditions and then +use :ref:`advanced-indexing`. + + >>> a = np.arange(30).reshape(2, 3, 5) + >>> indices = np.where(a % 2 == 0) + >>> indices + (array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1]), + array([0, 0, 0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 2, 2]), + array([0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4, 1, 3])) + >>> a[indices] + array([ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28]) + +Or, use :ref:`boolean-indexing`:: + + >>> a > 14 + array([[[False, False, False, False, False], + [False, False, False, False, False], + [False, False, False, False, False]], + <BLANKLINE> + [[ True, True, True, True, True], + [ True, True, True, True, True], + [ True, True, True, True, True]]]) + >>> a[a > 14] + array([15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]) + +Replace values after filtering +------------------------------ + +Use assignment with filtering to replace desired values:: + + >>> p = np.arange(-10, 10).reshape(2, 2, 5) + >>> p + array([[[-10, -9, -8, -7, -6], + [ -5, -4, -3, -2, -1]], + <BLANKLINE> + [[ 0, 1, 2, 3, 4], + [ 5, 6, 7, 8, 9]]]) + >>> q = p < 0 + >>> q + array([[[ True, True, True, True, True], + [ True, True, True, True, True]], + <BLANKLINE> + [[False, False, False, False, False], + [False, False, False, False, False]]]) + >>> p[q] = 0 + >>> p + array([[[0, 0, 0, 0, 0], + [0, 0, 0, 0, 0]], + <BLANKLINE> + [[0, 1, 2, 3, 4], + [5, 6, 7, 8, 9]]]) + +Fetch indices of max/min values +=============================== + +Use :meth:`argmax` and :meth:`argmin`:: + + >>> a = np.arange(30).reshape(2, 3, 5) + >>> np.argmax(a) + 29 + >>> np.argmin(a) + 0 + +Use the ``axis`` keyword to get the indices of maximum and minimum +values along a specific axis:: + + >>> np.argmax(a, axis=0) + array([[1, 1, 1, 1, 1], + [1, 1, 1, 1, 1], + [1, 1, 1, 1, 1]]) + >>> np.argmax(a, axis=1) + array([[2, 2, 2, 2, 2], + [2, 2, 2, 2, 2]]) + >>> np.argmax(a, axis=2) + array([[4, 4, 4], + [4, 4, 4]]) + <BLANKLINE> + >>> np.argmin(a, axis=1) + array([[0, 0, 0, 0, 0], + [0, 0, 0, 0, 0]]) + >>> np.argmin(a, axis=2) + array([[0, 0, 0], + [0, 0, 0]]) + +Set ``keepdims`` to ``True`` to keep the axes which are reduced in the +result as dimensions with size one:: + + >>> np.argmin(a, axis=2, keepdims=True) + array([[[0], + [0], + [0]], + <BLANKLINE> + [[0], + [0], + [0]]]) + >>> np.argmax(a, axis=1, keepdims=True) + array([[[2, 2, 2, 2, 2]], + <BLANKLINE> + [[2, 2, 2, 2, 2]]]) + +Index the same ndarray multiple times efficiently +================================================= + +It must be kept in mind that basic indexing produces :term:`views <view>` +and advanced indexing produces :term:`copies <copy>`, which are +computationally less efficient. Hence, you should take care to use basic +indexing wherever possible instead of advanced indexing. + +Further reading +=============== + +Nicolas Rougier's `100 NumPy exercises <https://github.com/rougier/numpy-100>`_ +provide a good insight into how indexing is combined with other operations. +Exercises `6`_, `8`_, `10`_, `15`_, `16`_, `19`_, `20`_, `45`_, `59`_, +`64`_, `65`_, `70`_, `71`_, `72`_, `76`_, `80`_, `81`_, `84`_, `87`_, `90`_, +`93`_, `94`_ are specially focused on indexing. + +.. _6: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#6-create-a-null-vector-of-size-10-but-the-fifth-value-which-is-1- +.. _8: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#8-reverse-a-vector-first-element-becomes-last- +.. _10: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#10-find-indices-of-non-zero-elements-from-120040- +.. _15: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#15-create-a-2d-array-with-1-on-the-border-and-0-inside- +.. _16: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#16-how-to-add-a-border-filled-with-0s-around-an-existing-array- +.. _19: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#19-create-a-8x8-matrix-and-fill-it-with-a-checkerboard-pattern- +.. _20: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#20-consider-a-678-shape-array-what-is-the-index-xyz-of-the-100th-element- +.. _45: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#45-create-random-vector-of-size-10-and-replace-the-maximum-value-by-0- +.. _59: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#59-how-to-sort-an-array-by-the-nth-column- +.. _64: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#64-consider-a-given-vector-how-to-add-1-to-each-element-indexed-by-a-second-vector-be-careful-with-repeated-indices- +.. _65: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#65-how-to-accumulate-elements-of-a-vector-x-to-an-array-f-based-on-an-index-list-i- +.. _70: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#70-consider-the-vector-1-2-3-4-5-how-to-build-a-new-vector-with-3-consecutive-zeros-interleaved-between-each-value- +.. _71: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#71-consider-an-array-of-dimension-553-how-to-mulitply-it-by-an-array-with-dimensions-55- +.. _72: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#72-how-to-swap-two-rows-of-an-array- +.. _76: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#76-consider-a-one-dimensional-array-z-build-a-two-dimensional-array-whose-first-row-is-z0z1z2-and-each-subsequent-row-is--shifted-by-1-last-row-should-be-z-3z-2z-1- +.. _80: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#80-consider-an-arbitrary-array-write-a-function-that-extract-a-subpart-with-a-fixed-shape-and-centered-on-a-given-element-pad-with-a-fill-value-when-necessary- +.. _81: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#81-consider-an-array-z--1234567891011121314-how-to-generate-an-array-r--1234-2345-3456--11121314- +.. _84: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#84-extract-all-the-contiguous-3x3-blocks-from-a-random-10x10-matrix- +.. _87: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#87-consider-a-16x16-array-how-to-get-the-block-sum-block-size-is-4x4- +.. _90: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#90-given-an-arbitrary-number-of-vectors-build-the-cartesian-product-every-combinations-of-every-item- +.. _93: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#93-consider-two-arrays-a-and-b-of-shape-83-and-22-how-to-find-rows-of-a-that-contain-elements-of-each-row-of-b-regardless-of-the-order-of-the-elements-in-b- +.. _94: https://github.com/rougier/numpy-100/blob/master/100_Numpy_exercises_with_solutions.md#94-considering-a-10x3-matrix-extract-rows-with-unequal-values-eg-223-
\ No newline at end of file diff --git a/doc/source/user/howtos_index.rst b/doc/source/user/howtos_index.rst index 89a6f54e7..2d66d0638 100644 --- a/doc/source/user/howtos_index.rst +++ b/doc/source/user/howtos_index.rst @@ -13,3 +13,4 @@ the package, see the :ref:`API reference <reference>`. how-to-how-to how-to-io + how-to-index diff --git a/numpy/core/code_generators/cversions.txt b/numpy/core/code_generators/cversions.txt index e7b3ef697..e1ee8a860 100644 --- a/numpy/core/code_generators/cversions.txt +++ b/numpy/core/code_generators/cversions.txt @@ -61,4 +61,5 @@ 0x0000000e = 17a0f366e55ec05e5c5c149123478452 # Version 15 (NumPy 1.22) Configurable memory allocations +# Version 14 (NumPy 1.23) No change. 0x0000000f = b8783365b873681cd204be50cdfb448d diff --git a/numpy/core/code_generators/ufunc_docstrings.py b/numpy/core/code_generators/ufunc_docstrings.py index c9be94569..cd584eea7 100644 --- a/numpy/core/code_generators/ufunc_docstrings.py +++ b/numpy/core/code_generators/ufunc_docstrings.py @@ -3827,6 +3827,7 @@ add_newdoc('numpy.core.umath', 'sqrt', -------- lib.scimath.sqrt A version which returns complex numbers when given negative reals. + Note: 0.0 and -0.0 are handled differently for complex inputs. Notes ----- diff --git a/numpy/core/include/numpy/numpyconfig.h b/numpy/core/include/numpy/numpyconfig.h index f761555b9..4eac083e7 100644 --- a/numpy/core/include/numpy/numpyconfig.h +++ b/numpy/core/include/numpy/numpyconfig.h @@ -57,5 +57,6 @@ #define NPY_1_20_API_VERSION 0x0000000e #define NPY_1_21_API_VERSION 0x0000000e #define NPY_1_22_API_VERSION 0x0000000f +#define NPY_1_23_API_VERSION 0x0000000f #endif /* NUMPY_CORE_INCLUDE_NUMPY_NPY_NUMPYCONFIG_H_ */ diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py index 70e8fc897..772c87c96 100644 --- a/numpy/core/setup_common.py +++ b/numpy/core/setup_common.py @@ -44,6 +44,7 @@ C_ABI_VERSION = 0x01000009 # 0x0000000e - 1.20.x # 0x0000000e - 1.21.x # 0x0000000f - 1.22.x +# 0x0000000f - 1.23.x C_API_VERSION = 0x0000000f class MismatchCAPIWarning(Warning): diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py index 2a4402c89..b69226d48 100644 --- a/numpy/lib/index_tricks.py +++ b/numpy/lib/index_tricks.py @@ -227,13 +227,13 @@ class MGridClass(nd_grid): See Also -------- - numpy.lib.index_tricks.nd_grid : class of `ogrid` and `mgrid` objects + lib.index_tricks.nd_grid : class of `ogrid` and `mgrid` objects ogrid : like mgrid but returns open (not fleshed out) mesh grids r_ : array concatenator Examples -------- - >>> np.mgrid[0:5,0:5] + >>> np.mgrid[0:5, 0:5] array([[[0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [2, 2, 2, 2, 2], diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index 6c34e95fe..85e26f094 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -285,7 +285,8 @@ def load(file, mmap_mode=None, allow_pickle=False, fix_imports=True, ---------- file : file-like object, string, or pathlib.Path The file to read. File-like objects must support the - ``seek()`` and ``read()`` methods. Pickled files require that the + ``seek()`` and ``read()`` methods and must always + be opened in binary mode. Pickled files require that the file-like object support the ``readline()`` method as well. mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional If not None, then memory-map the file, using the given mode (see diff --git a/numpy/lib/scimath.py b/numpy/lib/scimath.py index 308f1328b..b7ef0d710 100644 --- a/numpy/lib/scimath.py +++ b/numpy/lib/scimath.py @@ -234,6 +234,15 @@ def sqrt(x): >>> np.emath.sqrt([-1,4]) array([0.+1.j, 2.+0.j]) + Different results are expected because: + floating point 0.0 and -0.0 are distinct. + + For more control, explicitly use complex() as follows: + + >>> np.emath.sqrt(complex(-4.0, 0.0)) + 2j + >>> np.emath.sqrt(complex(-4.0, -0.0)) + -2j """ x = _fix_real_lt_zero(x) return nx.sqrt(x) diff --git a/pavement.py b/pavement.py index 6fdaae975..025489cbd 100644 --- a/pavement.py +++ b/pavement.py @@ -38,7 +38,7 @@ from paver.easy import Bunch, options, task, sh #----------------------------------- # Path to the release notes -RELEASE_NOTES = 'doc/source/release/1.22.0-notes.rst' +RELEASE_NOTES = 'doc/source/release/1.23.0-notes.rst' #------------------------------------------------------- |