Skip to content

Commit 5ae822c

Browse files
committed
Avoid vmapreduce on Windows
1 parent 528b5ae commit 5ae822c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Utils.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ end
7676
# Fastest way to check for NaN in an array.
7777
# Thanks @mikmore https://discourse.julialang.org/t/fastest-way-to-check-for-inf-or-nan-in-an-array/76954/33?u=milescranmer
7878
is_bad_array(x) = !is_good_array(x)
79-
is_good_array(x) = isempty(x) || vmapreduce(xi -> xi * zero(xi), +, x) == zero(eltype(x))
79+
@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
8083

8184
isgood(x::T) where {T<:Number} = !(isnan(x) || !isfinite(x))
8285
isgood(x) = true

0 commit comments

Comments
 (0)