array_api_extra.union1d

array_api_extra.union1d(a, b, /, *, xp=None)

Find the union of two arrays.

Return the unique, sorted array of values that are in either of the two input arrays.

Parameters:
  • a (Array) – Input arrays. They are flattened internally if they are not already 1D.

  • b (Array) – Input arrays. They are flattened internally if they are not already 1D.

  • xp (array_namespace, optional) – The standard-compatible namespace for a and b. Default: infer.

Returns:

Unique, sorted union of the input arrays.

Return type:

Array