File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 7575
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
78- is_bad_array (x, V :: Val{unroll} = Val (16 )) where {unroll} = ! is_good_array (x, V )
79- function is_good_array (x:: AbstractArray{T} , V :: Val{unroll} = Val (16 )) where {unroll,T}
78+ is_bad_array (x, :: Val{unroll} = Val (16 )) where {unroll} = ! is_good_array (x, Val (unroll) )
79+ function is_good_array (x:: AbstractArray{T} , :: Val{unroll} = Val (16 )) where {unroll,T}
8080 isempty (x) && return true
8181 _zero = zero (T)
8282
8383 # Vectorized segment
8484 vectorized_segment = eachindex (x)[begin : unroll: (end - unroll + 1 )]
8585 empty_vectorized_segment = isempty (vectorized_segment)
8686 if ! empty_vectorized_segment
87- mask = ntuple (i -> _zero, V )
87+ mask = ntuple (i -> _zero, Val (unroll) )
8888 cumulator = mask
8989 for i in vectorized_segment
90- batch = ntuple (j -> @inbounds (x[i + (j - 1 )]), V )
90+ batch = ntuple (j -> @inbounds (x[i + (j - 1 )]), Val (unroll) )
9191 cumulator = muladd .(mask, batch, cumulator)
9292 end
9393 cumulator == mask || return false
You can’t perform that action at this time.
0 commit comments