bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / _external / array_api_extra / _delegation / setdiff1d
function
scipy._external.array_api_extra._delegation:setdiff1d
source: build-install/usr/lib/python3.14/site-packages/scipy/_external/array_api_extra/_delegation.py:1088
Signature
def setdiff1d(x1: Array | complex, x2: Array | complex, /, assume_unique: bool = False, xp: ArrayNamespace | None = None) → ArraySummary
Find the set difference of two arrays.
Extended Summary
Return the unique values in x1 that are not in x2.
Parameters
x1: array | int | float | complex | boolInput array.
x2: arrayInput comparison array.
assume_unique: boolIf
True, the input arrays are both assumed to be unique, which can speed up the calculation. Default isFalse.xp: array_namespace, optionalThe standard-compatible namespace for
x1andx2. Default: infer.
Returns
: array1D array of values in
x1that are not inx2. The result is sorted whenassume_uniqueisFalse, but otherwise only sorted if the input is sorted.
Examples
import array_api_strict as xp import array_api_extra as xpx⚠
Traceback (most recent call last):
File "<doctest scipy._external.array_api_extra._delegation:setdiff1d[0]>", line 1, in <module>
import array_api_extra as xpx
ModuleNotFoundError: No module named 'array_api_extra'
x1 = xp.asarray([1, 2, 3, 2, 4, 1]) x2 = xp.asarray([3, 4, 5, 6]) xpx.setdiff1d(x1, x2, xp=xp)⚠
Traceback (most recent call last):
File "<doctest scipy._external.array_api_extra._delegation:setdiff1d[0]>", line 1, in <module>
xpx.setdiff1d(x1, x2, xp=xp)
^^^
NameError: name 'xpx' is not defined
Aliases
scipy.differentiate.xpx.setdiff1d