diff options
author | wufangjie <wufangjie1223@126.com> | 2017-07-28 08:06:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-28 08:06:59 +0800 |
commit | 5c213e98bf7721de20e6bc938eaa40349cba883e (patch) | |
tree | 3b54bb7d8797d368917f4748f4b17f78cb63257f /numpy/lib/arraysetops.py | |
parent | cba15d5ec3472ac167bdfe06f32dc07d6bbabd4d (diff) | |
download | numpy-5c213e98bf7721de20e6bc938eaa40349cba883e.tar.gz |
MAINT: Make `setxor1d' a bit clearer and speed it up
Diffstat (limited to 'numpy/lib/arraysetops.py')
-rw-r--r-- | numpy/lib/arraysetops.py | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/numpy/lib/arraysetops.py b/numpy/lib/arraysetops.py index a454b8725..aa3a05e12 100644 --- a/numpy/lib/arraysetops.py +++ b/numpy/lib/arraysetops.py @@ -375,12 +375,8 @@ def setxor1d(ar1, ar2, assume_unique=False): return aux aux.sort() -# flag = ediff1d( aux, to_end = 1, to_begin = 1 ) == 0 flag = np.concatenate(([True], aux[1:] != aux[:-1], [True])) -# flag2 = ediff1d( flag ) == 0 -# flag2 = flag[1:] == flag[:-1] -# return aux[flag2] - return aux[np.logical_and(flag[1:], flag[:-1])] + return aux[flag[1:] & flag[:-1]] def in1d(ar1, ar2, assume_unique=False, invert=False): |