Implement multiple duplicate treatments
There are multiple possible ways to treat duplicates in the sorted numpy arrays. The treatment should be selectable via an optinal arguemnt.
For merging:
- Default: Keep all duplicates.
- Keep only duplicates from different arrays, i.e. the sequence
.., x, a, a, z, ..
in an array is treated as a singlea
. The result contains each number at most twice. - Keep duplicates from the same array, i.e. merging
.., x, a, a, a, z, ..
, and.., s, a, t, ..
results in threea
s in the merged array; merging.., x, a, z, ..
, and.., s, a, t, ..
results in a singlea
. - Remove all duplicates. All numbers in the returned array are unique.
For intersecting:
- Keep all duplicates, i.e. intersecting
.., x, a, a, a, z, ..
and.., s, a, t, ..
results in threea
s. The greater number of duplicates (here three) determines the number of duplicates in the result. -
Default: Keep duplicates only if duplicated in both arrays, i.e. intersecting
.., x, a, a, a, z, ..
and.., s, a, t, ..
results in a singlea
s; intersecting.., x, a, a, a, z, ..
and.., s, a, a, t, ..
results in a twoa
s. The smaller number of duplicates (here two) determines the number of duplicates in the result. - Remove all duplicates. All numbers in the returned array are unique.
Edited by Frank Sauerburger