逻辑函数#

真值测试#

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

测试给定轴上所有数组元素是否都为 True.

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

测试给定轴上是否存在任何数组元素计算结果为 True.

Array contents#

isfinite(x, /[, out, where, casting, order, ...])

逐个元素地测试有限性(非无穷大且非非数字).

isinf(x, /[, out, where, casting, order, ...])

逐个元素地测试正无穷或负无穷.

isnan(x, /[, out, where, casting, order, ...])

逐个元素地测试 NaN 并将结果作为布尔数组返回.

isnat(x, /[, out, where, casting, order, ...])

逐个元素地测试 NaT (非时间) 并将结果作为布尔数组返回.

isneginf(x[, out])

逐个元素地测试负无穷,返回布尔数组结果.

isposinf(x[, out])

逐个元素地测试正无穷,返回布尔数组结果.

Array type testing#

iscomplex (x)

返回一个布尔数组,如果输入元素是复数,则为 True.

iscomplexobj (x)

检查复数类型或复数数组.

isfortran (a)

检查数组是否为 Fortran 连续但不是 C 连续.

isreal (x)

返回一个布尔数组,如果输入元素是实数,则为 True.

isrealobj (x)

如果 x 不是复数类型或复数数组,则返回 True.

isscalar (element)

如果 element 的类型是标量类型,则返回 True.

逻辑运算#

logical_and(x1, x2, /[, out, where, ...])

逐个元素计算 x1 AND x2 的真值.

logical_or(x1, x2, /[, out, where, casting, ...])

逐个元素计算 x1 OR x2 的真值.

logical_not (x, /[, out, where, casting, ...])

逐个元素计算 NOT x 的真值.

logical_xor (x1, x2, /[, out, where, ...])

按元素计算 x1 XOR x2 的真值.

比较#

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

如果两个数组在容差范围内按元素方式相等,则返回 True.

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

返回一个布尔数组,其中两个数组在容差范围内按元素相等.

array_equal (a1, a2[, equal_nan])

如果两个数组具有相同的形状和元素,则为 True,否则为 False.

array_equiv (a1, a2)

如果输入数组的形状一致且所有元素相等,则返回 True.

greater (x1, x2, /[, out, where, casting, ...])

逐元素返回 (x1 > x2) 的真值.

greater_equal (x1, x2, /[, out, where, ...])

逐元素返回 (x1 >= x2) 的真值.

less (x1, x2, /[, out, where, casting, ...])

按元素方式返回 (x1 < x2) 的真值.

less_equal (x1, x2, /[, out, where, casting, ...])

按元素方式返回 (x1 <= x2) 的真值.

equal (x1, x2, /[, out, where, casting, ...])

按元素返回 (x1 == x2).

not_equal (x1, x2, /[, out, where, casting, ...])

逐个元素返回 (x1 != x2).