flopscope.

flopscope.numpy.setxor1d

fnp.setxor1d(ar1, ar2, assume_unique=False)[flopscope source][numpy source]

Find the set exclusive-or of two arrays.

Adapted from NumPy docs np.setxor1d

Areacore
Typecustom
NumPy Refnp.setxor1d
Cost
per-operation
Flopscope Context

Symmetric set difference; cost = (n+m)*ceil(log2(n+m)).

Return the sorted, unique values that are in only one (not both) of the input arrays.

Parameters

ar1, ar2:array_like

Input arrays.

assume_unique:bool

If True, the input arrays are both assumed to be unique, which can speed up the calculation. Default is False.

Returns

setxor1d:ndarray

Sorted 1D array of unique values that are in only one of the input arrays.

Examples

>>> import flopscope.numpy as fnp
>>> a = flops.array([1, 2, 3, 2, 4])
>>> b = flops.array([2, 3, 5, 7, 5])
>>> flops.setxor1d(a,b)
array([1, 4, 5, 7])