We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
vmapreduce
1 parent 528b5ae commit 5ae822cCopy full SHA for 5ae822c
src/Utils.jl
@@ -76,7 +76,10 @@ end
76
# Fastest way to check for NaN in an array.
77
# Thanks @mikmore https://discourse.julialang.org/t/fastest-way-to-check-for-inf-or-nan-in-an-array/76954/33?u=milescranmer
78
is_bad_array(x) = !is_good_array(x)
79
-is_good_array(x) = isempty(x) || vmapreduce(xi -> xi * zero(xi), +, x) == zero(eltype(x))
+@generated function is_good_array(x)
80
+ Sys.iswindows() && return :(sum(xi -> xi * zero(xi), x) == zero(eltype(x)))
81
+ return :(isempty(x) || vmapreduce(xi -> xi * zero(xi), +, x) == zero(eltype(x)))
82
+end
83
84
isgood(x::T) where {T<:Number} = !(isnan(x) || !isfinite(x))
85
isgood(x) = true
0 commit comments