Loading [MathJax]/extensions/TeX/boldsymbol.js

 

 

 

Automatic vectorization and vectorization inhibitors, function calls

Calls to programmer defined functions ruin vectorization. However, calls to intrinsic functions like \sin{x} , \cos{x} , \exp{x} etc are allowed since they are normally efficiently vectorized. The following example is fully vectorizable

  for (int i = 0; i < n; i++) {
      a[i] = log10(i)*cos(i);
  }

Similarly, inline functions defined by the programmer, allow for vectorization since the function statements are glued into the actual place where the function is called.