Logic functions#

Truth value testing#

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

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

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

Tests whether any array elements along a given axis evaluate to True.

union1d(arr1, arr2)

Find the union of two arrays.

Array contents#

isfinite

Tests finiteness elementwise.

isinf

Tests if each element is the positive or negative infinity.

isnan

Tests if each element is a NaN.

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.

isfortran(a)

Returns True if the array is Fortran contiguous but not C contiguous.

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(element)

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

Logic operations#

logical_and

Computes the logical AND of two arrays.

logical_or

Computes the logical OR of two arrays.

logical_not

Computes the logical NOT of an array.

logical_xor

Computes the logical XOR of two arrays.

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 equal within a tolerance.

array_equal(a1, a2[, equal_nan])

Returns True if two arrays are element-wise exactly equal.

array_equiv(a1, a2)

Returns True if all elements are equal or shape consistent, i.e., one input array can be broadcasted to create the same shape as the other.

greater

Tests elementwise if x1 > x2.

greater_equal

Tests elementwise if x1 >= x2.

less

Tests elementwise if x1 < x2.

less_equal

Tests elementwise if x1 <= x2.

equal

Tests elementwise if x1 == x2.

not_equal

Tests elementwise if x1 != x2.