Skip to content

Commit 493f680

Browse files
committed
Explicit loop in _iszero for strided views
1 parent 925acef commit 493f680

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/generic.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,13 @@ _iszero(V) = iszero(V)
13591359
# A Base.FastContiguousSubArray view of a StridedArray
13601360
FastContiguousSubArrayStrided{T,N,P<:StridedArray,I<:Tuple{AbstractUnitRange, Vararg{Any}}} = Base.SubArray{T,N,P,I,true}
13611361
# using mapreduce instead of all permits vectorization
1362-
_iszero(V::FastContiguousSubArrayStrided) = mapreduce(iszero, &, V, init=true)
1362+
function _iszero(V::FastContiguousSubArrayStrided)
1363+
ret = true
1364+
for i in eachindex(V)
1365+
ret &= iszero(@inbounds V[i])
1366+
end
1367+
ret
1368+
end
13631369

13641370
"""
13651371
istriu(A::AbstractMatrix, k::Integer = 0) -> Bool

0 commit comments

Comments
 (0)