From fae8369fba4a683783280b044915b11bbca07a44 Mon Sep 17 00:00:00 2001 From: Julian Taylor Date: Sun, 26 May 2013 17:03:51 +0200 Subject: ENH: implement may_share_memory in C memmap needs to call it in __array_finalize__ to determine if it can drop the references on copies. The python version if may_share_memory caused significant slowdowns when slicing these maps. closes gh-3364 --- numpy/add_newdocs.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'numpy/add_newdocs.py') diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py index ae07f05da..39dd2205e 100644 --- a/numpy/add_newdocs.py +++ b/numpy/add_newdocs.py @@ -3648,6 +3648,32 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('min', """)) +add_newdoc('numpy.core.multiarray', 'may_share_memory', + """ + Determine if two arrays can share memory + + 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*. + + Parameters + ---------- + a, b : ndarray + + Returns + ------- + out : bool + + Examples + -------- + >>> np.may_share_memory(np.array([1,2]), np.array([5,8,9])) + False + + """) + + add_newdoc('numpy.core.multiarray', 'ndarray', ('newbyteorder', """ arr.newbyteorder(new_order='S') -- cgit v1.2.1