all
Tests whether all input array elements evaluate to True
along a specified axis.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
input array. |
required | |
axis
|
axis or axes along which to perform a logical AND reduction. By default, a logical AND
reduction is performed over the entire array.
If a tuple of integers, logical AND reductions are performed over multiple axes.
A valid |
None
|
|
keepdims
|
If |
False
|
Returns:
Name | Type | Description |
---|---|---|
out |
array
|
if a logical AND reduction was performed over the entire array, the returned array is a
zero-dimensional array containing the test result; otherwise, the returned array is a
non-zero-dimensional array containing the test results.
The returned array has a data type of |
Special Cases
-
Positive infinity, negative infinity, and NaN evaluate to
True
. -
If
x
has a complex floating-point data type, elements having a non-zero component (real or imaginary) evaluate toTrue
. -
If
x
is an empty array or the size of the axis (dimension) along which to evaluate elements is zero, the test result isTrue
.
Examples:
>>> a = sparse.COO.from_numpy(np.array([[0, 1], [2, 0]]))
>>> o = sparse.all(a, axis=1)
>>> o.todense()
array([False, False])
Source code in sparse/numba_backend/_common.py
2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 |
|