Can your C compiler vectorize a scalar product? – Daniel Lemire's blog
If you have spent any time at all on college-level mathematics, you have probably heard of the scalar product: float scalarproduct(float * array1, float * array2, size_t length) { float sum = 0.0f; for (size_t i = 0; i < length; ++i) { sum += array1[i] * array2[i]; } return sum; } Most people who … Continue reading Can your C compiler vectorize a scalar product?