summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/neps/nep-0049.rst4
-rw-r--r--doc/release/upcoming_changes/17582.new_feature.rst8
-rw-r--r--doc/source/reference/c-api/data_memory.rst2
-rw-r--r--doc/source/user/absolute_beginners.rst2
-rw-r--r--numpy/lib/function_base.py13
-rw-r--r--numpy/random/_generator.pyx6
-rw-r--r--numpy/random/mtrand.pyx5
7 files changed, 30 insertions, 10 deletions
diff --git a/doc/neps/nep-0049.rst b/doc/neps/nep-0049.rst
index 277351e3b..4758edb35 100644
--- a/doc/neps/nep-0049.rst
+++ b/doc/neps/nep-0049.rst
@@ -3,10 +3,10 @@ NEP 49 — Data allocation strategies
===================================
:Author: Matti Picus
-:Status: Draft
+:Status: Final
:Type: Standards Track
:Created: 2021-04-18
-:Resolution: http://numpy-discussion.10968.n7.nabble.com/NEP-49-Data-allocation-strategies-tt49185.html
+:Resolution: https://mail.python.org/archives/list/numpy-discussion@python.org/thread/YZ3PNTXZUT27B6ITFAD3WRSM3T3SRVK4/#PKYXCTG4R5Q6LIRZC4SEWLNBM6GLRF26
Abstract
diff --git a/doc/release/upcoming_changes/17582.new_feature.rst b/doc/release/upcoming_changes/17582.new_feature.rst
new file mode 100644
index 000000000..be5997dda
--- /dev/null
+++ b/doc/release/upcoming_changes/17582.new_feature.rst
@@ -0,0 +1,8 @@
+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.
+
+.. _`NEP 49`: https://numpy.org/neps/nep-0049.html
+
diff --git a/doc/source/reference/c-api/data_memory.rst b/doc/source/reference/c-api/data_memory.rst
index 8e2989403..c17f98a2c 100644
--- a/doc/source/reference/c-api/data_memory.rst
+++ b/doc/source/reference/c-api/data_memory.rst
@@ -1,3 +1,5 @@
+.. _data_memory:
+
Memory management in NumPy
==========================
diff --git a/doc/source/user/absolute_beginners.rst b/doc/source/user/absolute_beginners.rst
index a98ca3e40..ec4fe25a6 100644
--- a/doc/source/user/absolute_beginners.rst
+++ b/doc/source/user/absolute_beginners.rst
@@ -613,7 +613,7 @@ How to create an array from existing data
-----
-You can easily use create a new array from a section of an existing array.
+You can easily create a new array from a section of an existing array.
Let's say you have this array:
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 232a51cab..20e32a78d 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -670,11 +670,16 @@ def select(condlist, choicelist, default=0):
Examples
--------
- >>> x = np.arange(10)
- >>> condlist = [x<3, x>5]
+ >>> x = np.arange(6)
+ >>> condlist = [x<3, x>3]
>>> choicelist = [x, x**2]
- >>> np.select(condlist, choicelist)
- array([ 0, 1, 2, ..., 49, 64, 81])
+ >>> np.select(condlist, choicelist, 42)
+ array([ 0, 1, 2, 42, 16, 25])
+
+ >>> condlist = [x<=4, x>3]
+ >>> choicelist = [x, x**2]
+ >>> np.select(condlist, choicelist, 55)
+ array([ 0, 1, 2, 3, 4, 25])
"""
# Check the size of condlist and choicelist are the same, or abort.
diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx
index 5bacb9f6f..54973100e 100644
--- a/numpy/random/_generator.pyx
+++ b/numpy/random/_generator.pyx
@@ -876,8 +876,10 @@ cdef class Generator:
greater than or equal to low. The default value is 0.
high : float or array_like of floats
Upper boundary of the output interval. All values generated will be
- less than high. high - low must be non-negative. The default value
- is 1.0.
+ less than high. The high limit may be included in the returned array of
+ floats due to floating-point rounding in the equation
+ ``low + (high-low) * random_sample()``. high - low must be
+ non-negative. The default value is 1.0.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
diff --git a/numpy/random/mtrand.pyx b/numpy/random/mtrand.pyx
index 06e75a698..ca539c00e 100644
--- a/numpy/random/mtrand.pyx
+++ b/numpy/random/mtrand.pyx
@@ -1033,7 +1033,10 @@ cdef class RandomState:
greater than or equal to low. The default value is 0.
high : float or array_like of floats
Upper boundary of the output interval. All values generated will be
- less than or equal to high. The default value is 1.0.
+ less than or equal to high. The high limit may be included in the
+ returned array of floats due to floating-point rounding in the
+ equation ``low + (high-low) * random_sample()``. The default value
+ is 1.0.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),