I have a code like the following and I wish to vectorize it. I analyzed the whole code using an intel advisor. It says I cant vectorize this because it has math functions in it. It of course points out towards the sin and cos function used inside the loop.
How to vectorize this loop without using intel short vector math library?
Code:
for (size_t j = 0; j < NA; ++j) {
esf = sfs[j];
x = p_data[3 * j];
y = p_data[3 * j + 1];
z = p_data[3 * j + 2];
p = x * qx + y * qy + z * qz;
Ar += esf * cos(p);
Ai += esf * sin(p);
}