Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/generic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1358,8 +1358,15 @@ ishermitian(x::Number) = (x == conj(x))
_iszero(V) = iszero(V)
# A Base.FastContiguousSubArray view of a StridedArray
FastContiguousSubArrayStrided{T,N,P<:StridedArray,I<:Tuple{AbstractUnitRange, Vararg{Any}}} = Base.SubArray{T,N,P,I,true}
# using mapreduce instead of all permits vectorization
_iszero(V::FastContiguousSubArrayStrided) = mapreduce(iszero, &, V, init=true)
# Reducing over the entire array instead of calling `all` within `iszero` permits vectorization
# The loop is equivalent to a mapreduce, but is faster to compile
function _iszero(V::FastContiguousSubArrayStrided)
ret = true
for i in eachindex(V)
ret &= iszero(@inbounds V[i])
end
ret
end

"""
istriu(A::AbstractMatrix, k::Integer = 0) -> Bool
Expand Down