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.

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.

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.

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.