bundles / scipy 1.17.1 / scipy / _lib / array_api_extra / _delegation / setdiff1d
function
scipy._lib.array_api_extra._delegation:setdiff1d
Signature
def setdiff1d ( x1 : Array | complex , x2 : Array | complex , / , assume_unique : bool = False , xp : ModuleType | None = None ) → Array Summary
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⚠
x1 = xp.asarray([1, 2, 3, 2, 4, 1]) x2 = xp.asarray([3, 4, 5, 6]) xpx.setdiff1d(x1, x2, xp=xp)⚠
Aliases
-
scipy.differentiate.xpx.setdiff1d