summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul van Mulbregt <pvanmulbregt@users.noreply.github.com>2018-06-14 11:44:18 -0400
committerPaul van Mulbregt <pvanmulbregt@users.noreply.github.com>2018-06-14 11:44:18 -0400
commit06b2b718835661132ba45ddb336ea720919d0b61 (patch)
tree26351e7eac8f8f518c3e5ff7e44de37e76a6e457
parent8f4f7d93cda0189655e829bfb93ad8592ea69e6e (diff)
downloadnumpy-06b2b718835661132ba45ddb336ea720919d0b61.tar.gz
DOC: Change array lengths/entries in an example to reduce confusion.
-rw-r--r--numpy/lib/stride_tricks.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/numpy/lib/stride_tricks.py b/numpy/lib/stride_tricks.py
index 2abe5cdd1..bc5993802 100644
--- a/numpy/lib/stride_tricks.py
+++ b/numpy/lib/stride_tricks.py
@@ -219,23 +219,19 @@ def broadcast_arrays(*args, **kwargs):
Examples
--------
>>> x = np.array([[1,2,3]])
- >>> y = np.array([[1],[2],[3]])
+ >>> y = np.array([[4],[5]])
>>> np.broadcast_arrays(x, y)
[array([[1, 2, 3],
- [1, 2, 3],
- [1, 2, 3]]), array([[1, 1, 1],
- [2, 2, 2],
- [3, 3, 3]])]
+ [1, 2, 3]]), array([[4, 4, 4],
+ [5, 5, 5]])]
Here is a useful idiom for getting contiguous copies instead of
non-contiguous views.
>>> [np.array(a) for a in np.broadcast_arrays(x, y)]
[array([[1, 2, 3],
- [1, 2, 3],
- [1, 2, 3]]), array([[1, 1, 1],
- [2, 2, 2],
- [3, 3, 3]])]
+ [1, 2, 3]]), array([[4, 4, 4],
+ [5, 5, 5]])]
"""
# nditer is not used here to avoid the limit of 32 arrays.