There's probably a simple explanation for this but I can't see it. I have some code I'm trying to speed up with SIMD instructions. This is the original function:
func near_zero() -> Bool {
let s = 1e-8
return (abs(e[0]) < s) && (abs(e[1]) < s) && (abs(e[2]) < s)
}
This was my attempt:
func near_zero() -> Bool {
let s = 1e-8
return simd_all(abs(v) .< s)
}
but I'm getting an error:
No exact matches in call to global function 'simd_all'
What am I missing here?
(Assuming v is a SIMD3<Double>)
The .< operator produces a SIMDMask, not a SIMD3<Double>. Use all instead of simd_all to operate on SIMDMasks.
return all(abs(v) .< s)