summaryrefslogtreecommitdiff
path: root/numpy/add_newdocs.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2015-08-29 11:56:52 -0400
committerCharles Harris <charlesr.harris@gmail.com>2015-08-29 11:56:52 -0400
commit7001d613aaa445ff650a273ec3d4db6787daf2e3 (patch)
tree45213b57444d5c8d232207688e5b9682bcdb1a83 /numpy/add_newdocs.py
parent2e9bd3f1ead83392b5148e71b48d75020a15ee5d (diff)
parent3a52e1942aac937e8ae8381f9ea519b9328fd052 (diff)
downloadnumpy-7001d613aaa445ff650a273ec3d4db6787daf2e3.tar.gz
Merge pull request #6166 from pv/sld
Better memory overlap detection
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r--numpy/add_newdocs.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 195789a39..607e28a28 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -3784,24 +3784,40 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('min',
"""))
-add_newdoc('numpy.core.multiarray', 'may_share_memory',
+add_newdoc('numpy.core.multiarray', 'shares_memory',
"""
- Determine if two arrays can share memory
+ shares_memory(a, b, max_work=None)
- The memory-bounds of a and b are computed. If they overlap then
- this function returns True. Otherwise, it returns False.
-
- A return of True does not necessarily mean that the two arrays
- share any element. It just means that they *might*.
+ Determine if two arrays share memory
Parameters
----------
a, b : ndarray
+ Input arrays
+ max_work : int, optional
+ Effort to spend on solving the overlap problem (maximum number
+ of candidate solutions to consider). The following special
+ values are recognized:
+
+ max_work=MAY_SHARE_EXACT (default)
+ The problem is solved exactly. In this case, the function returns
+ True only if there is an element shared between the arrays.
+ max_work=MAY_SHARE_BOUNDS
+ Only the memory bounds of a and b are checked.
+
+ Raises
+ ------
+ numpy.TooHardError
+ Exceeded max_work.
Returns
-------
out : bool
+ See Also
+ --------
+ may_share_memory
+
Examples
--------
>>> np.may_share_memory(np.array([1,2]), np.array([5,8,9]))