not_equal¶
- not_equal(x1: array, x2: array, /) array ¶
Computes the truth value of
x1_i != x2_i
for each elementx1_i
of the input arrayx1
with the respective elementx2_i
of the input arrayx2
.- Parameters:
x1 (array) – first input array. May have any data type.
x2 (array) – second input array. Must be compatible with
x1
(see Broadcasting).
- Returns:
out (array) – an array containing the element-wise results. The returned array must have a data type of
bool
.
Notes
Special Cases
For real-valued floating-point operands,
If
x1_i
isNaN
orx2_i
isNaN
, the result isTrue
.If
x1_i
is+infinity
andx2_i
is-infinity
, the result isTrue
.If
x1_i
is-infinity
andx2_i
is+infinity
, the result isTrue
.If
x1_i
is a finite number,x2_i
is a finite number, andx1_i
does not equalx2_i
, the result isTrue
.In the remaining cases, the result is
False
.
For complex floating-point operands, let
a = real(x1_i)
,b = imag(x1_i)
,c = real(x2_i)
,d = imag(x2_i)
, andIf
a
,b
,c
, ord
isNaN
, the result isTrue
.In the remaining cases, the result is the logical OR of the equality comparison between the real values
a
andc
(real components) and between the real valuesb
andd
(imaginary components), as described above for real-valued floating-point operands (i.e.,a != c OR b != d
).
Note
For discussion of complex number equality, see Complex Numbers.
Changed in version 2022.12: Added complex data type support.