Logic functions#

Truth value testing#

all(a[, axis, out, keepdims, where])

Test whether all array elements along a given axis evaluate to True.

any(a[, axis, out, keepdims, where])

Test whether any array element along a given axis evaluates to True.

Array contents#

isfinite(*args[, out, where, casting, ...])

Test element-wise for finiteness (not infinity and not Not a Number).

isinf(*args[, out, where, casting, order, dtype])

Test element-wise for positive or negative infinity.

isnan(*args[, out, where, casting, order, dtype])

Test element-wise for NaN and return result as a boolean array.

isneginf(x[, out])

Test element-wise for negative infinity, return result as bool array.

isposinf(x[, out])

Test element-wise for positive infinity, return result as bool array.

Array type testing#

iscomplex(x)

Returns a bool array, where True if input element is complex.

iscomplexobj(x)

Check for a complex type or an array of complex numbers.

isreal(x)

Returns a bool array, where True if input element is real.

isrealobj(x)

Return True if x is a not complex type or an array of complex numbers.

isscalar(x)

Returns True if the type of element is a scalar type.

Logic operations#

logical_and(*args[, out, where, casting, ...])

Compute the truth value of x1 AND x2 element-wise.

logical_or(*args[, out, where, casting, ...])

Compute the truth value of x1 OR x2 element-wise.

logical_not(*args[, out, where, casting, ...])

Compute bit-wise inversion, or bit-wise NOT, element-wise.

logical_xor(*args[, out, where, casting, ...])

Compute the truth value of x1 XOR x2, element-wise.

Comparison#

allclose(a, b[, rtol, atol, equal_nan])

Returns True if two arrays are element-wise equal within a tolerance.

isclose(a, b[, rtol, atol, equal_nan])

Returns a boolean array where two arrays are element-wise equal within a tolerance.

array_equal(a1, a2[, equal_nan])

True if two arrays have the same shape and elements, False otherwise.

greater(*args[, out, where, casting, order, ...])

Return the truth value of (x1 > x2) element-wise.

greater_equal(*args[, out, where, casting, ...])

Return the truth value of (x1 >= x2) element-wise.

less(*args[, out, where, casting, order, dtype])

Return the truth value of (x1 < x2) element-wise.

less_equal(*args[, out, where, casting, ...])

Return the truth value of (x1 =< x2) element-wise.

equal(*args[, out, where, casting, order, dtype])

Return (x1 == x2) element-wise.

not_equal(*args[, out, where, casting, ...])

Return (x1 != x2) element-wise.