def intersect1d(ar1, ar2, assume_unique=False):
if not assume_unique:<EOL><INDENT>ar1 = unique(ar1)<EOL>ar2 = unique(ar2)<EOL><DEDENT>aux = np.concatenate((ar1, ar2))<EOL>aux.sort()<EOL>return aux[:-<NUM_LIT:1>][aux[<NUM_LIT:1>:] == aux[:-<NUM_LIT:1>]]<EOL>
Find the intersection of two arrays.

Return the sorted, unique values that are in 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
-------
intersect1d : ndarray
    Sorted 1D array of common and unique elements.

See Also
--------
numpy.lib.arraysetops : Module with a number of other functions for
                        performing set operations on arrays.

Examples
--------
>>> np.intersect1d([1, 3, 4, 3], [3, 1, 2, 1])
array([1, 3])