Fastest way to negate some booleans in an array

Just use views and this becomes much more efficient:

@views map!(!,A[2:2:end],A[2:2:end])

Or use broadcasting, even faster:

A[2:2:end] .= .!(@view A[2:2:end])
3 Likes