[Numpy-discussion] Applying Patch #1085
Wed Dec 9 10:21:25 CST 2009
> What do people think of applying patch #1085.
Fine with me.
> I'd rename the function ...
Let me know if you want me to make these canges
or feel free to make them.
> It looks like the routine doesn't try to determine if the
> views actually overlap, just if they might potentially
> share data. Is that correct? That seems safe and if the
> time isn't much it might be a nice safety catch.
The function compares the ultimate base of every output
with those of the inputs and if an output and an input
have the same base (or either one is the base of the other),
the input is copied to a temporary object before the operation
(unless it is the easy case of same dimensions and strides,
strides all positive and the output pointer is less than the input one).
The two views might not overlap (such as z[1::2] = z[0::2] + 1)
but the routine it is not smart enough to understand it and
makes a copy anyway.
This should be a conservative approach: it should be safe,
at most it might cause copying some array unnecessarily.
Let me know if you can think of better approach able to
save some unnecesasary copy but light enough (as it is applied
nin x nout times).
More information about the NumPy-Discussion