|
1 | | -# Logic functions |
| 1 | +# 逻辑函数 |
2 | 2 |
|
3 | | -## Truth value testing |
| 3 | +## 真值测试 |
4 | 4 |
|
5 | | -method | description |
| 5 | +方法 | 描述 |
6 | 6 | ---|--- |
7 | | -[all](https://numpy.org/devdocs/reference/generated/numpy.all.html#numpy.all)(a[, axis, out, keepdims]) | Test whether all array elements along a given axis evaluate to True. |
8 | | -[any](https://numpy.org/devdocs/reference/generated/numpy.any.html#numpy.any)(a[, axis, out, keepdims]) | Test whether any array element along a given axis evaluates to True. |
| 7 | +[all](https://numpy.org/devdocs/reference/generated/numpy.all.html#numpy.all)(a[, axis, out, keepdims]) | 测试是否沿给定轴的所有数组元素求值为True。 |
| 8 | +[any](https://numpy.org/devdocs/reference/generated/numpy.any.html#numpy.any)(a[, axis, out, keepdims]) | 测试沿给定轴的任何数组元素的求值是否为True。 |
9 | 9 |
|
10 | | -## Array contents |
| 10 | +## 数组内容 |
11 | 11 |
|
12 | | -method | description |
| 12 | +方法 | 描述 |
13 | 13 | ---|--- |
14 | | -[isfinite](https://numpy.org/devdocs/reference/generated/numpy.isfinite.html#numpy.isfinite)(x, /[, out, where, casting, order, …]) | Test element-wise for finiteness (not infinity or not Not a Number). |
15 | | -[isinf](https://numpy.org/devdocs/reference/generated/numpy.isinf.html#numpy.isinf)(x, /[, out, where, casting, order, …]) | Test element-wise for positive or negative infinity. |
16 | | -[isnan](https://numpy.org/devdocs/reference/generated/numpy.isnan.html#numpy.isnan)(x, /[, out, where, casting, order, …]) | Test element-wise for NaN and return result as a boolean array. |
17 | | -[isnat](https://numpy.org/devdocs/reference/generated/numpy.isnat.html#numpy.isnat)(x, /[, out, where, casting, order, …]) | Test element-wise for NaT (not a time) and return result as a boolean array. |
18 | | -[isneginf](https://numpy.org/devdocs/reference/generated/numpy.isneginf.html#numpy.isneginf)(x[, out]) | Test element-wise for negative infinity, return result as bool array. |
19 | | -[isposinf](https://numpy.org/devdocs/reference/generated/numpy.isposinf.html#numpy.isposinf)(x[, out]) | Test element-wise for positive infinity, return result as bool array. |
| 14 | +[isfinite](https://numpy.org/devdocs/reference/generated/numpy.isfinite.html#numpy.isfinite)(x, /[, out, where, casting, order, …]) | 逐一测试有限性(不是无穷大还是不是数字)。 |
| 15 | +[isinf](https://numpy.org/devdocs/reference/generated/numpy.isinf.html#numpy.isinf)(x, /[, out, where, casting, order, …]) | 逐元素测试正无穷大或负无穷大。 |
| 16 | +[isnan](https://numpy.org/devdocs/reference/generated/numpy.isnan.html#numpy.isnan)(x, /[, out, where, casting, order, …]) | 对NaN逐个元素进行测试,并将结果作为布尔数组返回。 |
| 17 | +[isnat](https://numpy.org/devdocs/reference/generated/numpy.isnat.html#numpy.isnat)(x, /[, out, where, casting, order, …]) | 对NaT(不是时间)逐个元素进行测试,然后将结果作为布尔数组返回。 |
| 18 | +[isneginf](https://numpy.org/devdocs/reference/generated/numpy.isneginf.html#numpy.isneginf)(x[, out]) | 逐项测试负无穷大,将结果作为布尔数组返回。 |
| 19 | +[isposinf](https://numpy.org/devdocs/reference/generated/numpy.isposinf.html#numpy.isposinf)(x[, out]) | 对正无穷大逐个元素进行测试,以布尔数组形式返回结果。 |
20 | 20 |
|
21 | | -## Array type testing |
| 21 | +## 数组类型测试 |
22 | 22 |
|
23 | | -method | description |
| 23 | +方法 | 描述 |
24 | 24 | ---|--- |
25 | | -[iscomplex](https://numpy.org/devdocs/reference/generated/numpy.iscomplex.html#numpy.iscomplex)(x) | Returns a bool array, where True if input element is complex. |
26 | | -[iscomplexobj](https://numpy.org/devdocs/reference/generated/numpy.iscomplexobj.html#numpy.iscomplexobj)(x) | Check for a complex type or an array of complex numbers. |
27 | | -[isfortran](https://numpy.org/devdocs/reference/generated/numpy.isfortran.html#numpy.isfortran)(a) | Check if the array is Fortran contiguous but not C contiguous. |
28 | | -[isreal](https://numpy.org/devdocs/reference/generated/numpy.isreal.html#numpy.isreal)(x) | Returns a bool array, where True if input element is real. |
29 | | -[isrealobj](https://numpy.org/devdocs/reference/generated/numpy.isrealobj.html#numpy.isrealobj)(x) | Return True if x is a not complex type or an array of complex numbers. |
30 | | -[isscalar](https://numpy.org/devdocs/reference/generated/numpy.isscalar.html#numpy.isscalar)(num) | Returns True if the type of num is a scalar type. |
| 25 | +[iscomplex](https://numpy.org/devdocs/reference/generated/numpy.iscomplex.html#numpy.iscomplex)(x) | 返回布尔数组,如果输入元素复杂,则返回True。 |
| 26 | +[iscomplexobj](https://numpy.org/devdocs/reference/generated/numpy.iscomplexobj.html#numpy.iscomplexobj)(x) | 检查复杂类型或复杂数字数组。 |
| 27 | +[isfortran](https://numpy.org/devdocs/reference/generated/numpy.isfortran.html#numpy.isfortran)(a) | 检查数组是否是Fortran连续的,而不是C连续的。 |
| 28 | +[isreal](https://numpy.org/devdocs/reference/generated/numpy.isreal.html#numpy.isreal)(x) | 返回布尔数组,如果输入元素为实,则返回True。 |
| 29 | +[isrealobj](https://numpy.org/devdocs/reference/generated/numpy.isrealobj.html#numpy.isrealobj)(x) | 如果x是非复数类型或复数数组,则返回True。 |
| 30 | +[isscalar](https://numpy.org/devdocs/reference/generated/numpy.isscalar.html#numpy.isscalar)(num) | 如果num的类型是标量类型,则返回True。 |
31 | 31 |
|
32 | | -## Logical operations |
| 32 | +## 逻辑运算 |
33 | 33 |
|
34 | | -method | description |
| 34 | +方法 | 描述 |
35 | 35 | ---|--- |
36 | | -[logical_and](https://numpy.org/devdocs/reference/generated/numpy.logical_and.html#numpy.logical_and)(x1, x2, /[, out, where, …]) | Compute the truth value of x1 AND x2 element-wise. |
37 | | -[logical_or](https://numpy.org/devdocs/reference/generated/numpy.logical_or.html#numpy.logical_or)(x1, x2, /[, out, where, casting, …]) | Compute the truth value of x1 OR x2 element-wise. |
38 | | -[logical_not](https://numpy.org/devdocs/reference/generated/numpy.logical_not.html#numpy.logical_not)(x, /[, out, where, casting, …]) | Compute the truth value of NOT x element-wise. |
39 | | -[logical_xor](https://numpy.org/devdocs/reference/generated/numpy.logical_xor.html#numpy.logical_xor)(x1, x2, /[, out, where, …]) | Compute the truth value of x1 XOR x2, element-wise. |
| 36 | +[logical_and](https://numpy.org/devdocs/reference/generated/numpy.logical_and.html#numpy.logical_and)(x1, x2, /[, out, where, …]) | 按元素计算x1和x2的真值。 |
| 37 | +[logical_or](https://numpy.org/devdocs/reference/generated/numpy.logical_or.html#numpy.logical_or)(x1, x2, /[, out, where, casting, …]) | 按元素计算x1或x2的真值。 |
| 38 | +[logical_not](https://numpy.org/devdocs/reference/generated/numpy.logical_not.html#numpy.logical_not)(x, /[, out, where, casting, …]) | 计算非x元素的真值。 |
| 39 | +[logical_xor](https://numpy.org/devdocs/reference/generated/numpy.logical_xor.html#numpy.logical_xor)(x1, x2, /[, out, where, …]) | 按元素计算x1 XOR x2的真值。 |
40 | 40 |
|
41 | | -## Comparison |
| 41 | +## 对照 |
42 | 42 |
|
43 | | -method | description |
| 43 | +方法 | 描述 |
44 | 44 | ---|--- |
45 | | -[allclose](https://numpy.org/devdocs/reference/generated/numpy.allclose.html#numpy.allclose)(a, b[, rtol, atol, equal_nan]) | Returns True if two arrays are element-wise equal within a tolerance. |
46 | | -[isclose](https://numpy.org/devdocs/reference/generated/numpy.isclose.html#numpy.isclose)(a, b[, rtol, atol, equal_nan]) | Returns a boolean array where two arrays are element-wise equal within a tolerance. |
47 | | -[array_equal](https://numpy.org/devdocs/reference/generated/numpy.array_equal.html#numpy.array_equal)(a1, a2) | True if two arrays have the same shape and elements, False otherwise. |
48 | | -[array_equiv](https://numpy.org/devdocs/reference/generated/numpy.array_equiv.html#numpy.array_equiv)(a1, a2) | Returns True if input arrays are shape consistent and all elements equal. |
49 | | -[greater](https://numpy.org/devdocs/reference/generated/numpy.greater.html#numpy.greater)(x1, x2, /[, out, where, casting, …]) | Return the truth value of (x1 > x2) element-wise. |
50 | | -[greater_equal](https://numpy.org/devdocs/reference/generated/numpy.greater_equal.html#numpy.greater_equal)(x1, x2, /[, out, where, …]) | Return the truth value of (x1 >= x2) element-wise. |
51 | | -[less](https://numpy.org/devdocs/reference/generated/numpy.less.html#numpy.less)(x1, x2, /[, out, where, casting, …]) | Return the truth value of (x1 < x2) element-wise. |
52 | | -[less_equal](https://numpy.org/devdocs/reference/generated/numpy.less_equal.html#numpy.less_equal)(x1, x2, /[, out, where, casting, …]) | Return the truth value of (x1 =< x2) element-wise. |
53 | | -[equal](https://numpy.org/devdocs/reference/generated/numpy.equal.html#numpy.equal)(x1, x2, /[, out, where, casting, …]) | Return (x1 == x2) element-wise. |
54 | | -[not_equal](https://numpy.org/devdocs/reference/generated/numpy.not_equal.html#numpy.not_equal)(x1, x2, /[, out, where, casting, …]) | Return (x1 != x2) element-wise. |
| 45 | +[allclose](https://numpy.org/devdocs/reference/generated/numpy.allclose.html#numpy.allclose)(a, b[, rtol, atol, equal_nan]) | 如果两个数组在公差范围内按元素方式相等,则返回True。 |
| 46 | +[isclose](https://numpy.org/devdocs/reference/generated/numpy.isclose.html#numpy.isclose)(a, b[, rtol, atol, equal_nan]) | 返回一个布尔数组,其中两个数组在公差范围内按元素方式相等。 |
| 47 | +[array_equal](https://numpy.org/devdocs/reference/generated/numpy.array_equal.html#numpy.array_equal)(a1, a2) | 如果两个数组具有相同的形状和元素,则为True,否则为False。 |
| 48 | +[array_equiv](https://numpy.org/devdocs/reference/generated/numpy.array_equiv.html#numpy.array_equiv)(a1, a2) | 如果输入数组的形状一致且所有元素均相等,则返回True。 |
| 49 | +[greater](https://numpy.org/devdocs/reference/generated/numpy.greater.html#numpy.greater)(x1, x2, /[, out, where, casting, …]) | 按元素返回(x1 > x2)的真值。 |
| 50 | +[greater_equal](https://numpy.org/devdocs/reference/generated/numpy.greater_equal.html#numpy.greater_equal)(x1, x2, /[, out, where, …]) | 按元素返回(x1 >= x2)的真值。 |
| 51 | +[less](https://numpy.org/devdocs/reference/generated/numpy.less.html#numpy.less)(x1, x2, /[, out, where, casting, …]) | 按元素返回(x1 < x2)的真值。 |
| 52 | +[less_equal](https://numpy.org/devdocs/reference/generated/numpy.less_equal.html#numpy.less_equal)(x1, x2, /[, out, where, casting, …]) | 按元素返回(x1 =< x2)的真值。 |
| 53 | +[equal](https://numpy.org/devdocs/reference/generated/numpy.equal.html#numpy.equal)(x1, x2, /[, out, where, casting, …]) | 按元素返回(x1 == x2)。 |
| 54 | +[not_equal](https://numpy.org/devdocs/reference/generated/numpy.not_equal.html#numpy.not_equal)(x1, x2, /[, out, where, casting, …]) | 按元素返回(x1 != x2)。 |
0 commit comments