You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This means that slices by default do not share the mask with the original object, which doesn't seem a good idea given that we tried to change this behaviour in #5580 (hence, cc @jakirkham).
A relatively straightforward solution would be to replace it with not np.may_share_memory(ma, ma2)
(this, perhaps surprisingly, is also much faster than the above for the simple slice case).
The text was updated successfully, but these errors were encountered:
Yes, you're right, it is. I guess that if we changed the behaviour here, some of the work-arounds in __getitem__ could be removed. But maybe it is not worth the hassle (though the present comparison takes 4us on my computer, while may_share_memory takes 0.3us)
Currently, in
MaskedArray.__array_finalize__
, the following is done to check whether the new object may be a view of an old one:if that check fails, the mask is copied.
This seems unnecessarily restrictive and fails even simple slicing:
This means that slices by default do not share the mask with the original object, which doesn't seem a good idea given that we tried to change this behaviour in #5580 (hence, cc @jakirkham).
A relatively straightforward solution would be to replace it with
not np.may_share_memory(ma, ma2)
(this, perhaps surprisingly, is also much faster than the above for the simple slice case).
The text was updated successfully, but these errors were encountered: