Element-Wise SIMD Math
Add and multiply whole vectors at once.
Math on Whole Vectors
The best part of SIMD is that arithmetic works on the entire vector at once. One operation touches every lane together.
Adding Two Vectors
Add two SIMD values and each lane is added to its matching lane. This is called element-wise addition.
var a = SIMD[DType.int32, 4](1, 2, 3, 4)
var b = SIMD[DType.int32, 4](10, 20, 30, 40)
var c = a + bAll lessons in this course
- Meet the SIMD Type
- Element-Wise SIMD Math
- Choosing a SIMD Width
- Vectorizing a Loop