title: Use OpenMP in C++11 to find the maximum of the calculated values
body: <p>I am looking to find the maximum of the calculated values inside of a for loop and also store its corresponding index, <strong><em>max_calc_value</em></strong> and <strong><em>i_max</em></strong> here, below is my pseudo code. I was wondering if it is possible to do a certain kind of reduction here:</p>
  
  <pre><code>double max_calc_value = -DBL_MAX; // minimum double value
  #pragma omp parallel for
  for (int i = 20; i &lt; 1000; i++) {
      this_value = my_slow_function(large_double_vector_array, param1*i, .., param5+i);
      if (this_value &gt; max_calc_value){
          max_calc_value = this_value;
          i_max = i;
      }
  }
  </code></pre>