title: manipulation of 2d-array in openmp
body: <p>I write a loop of the 2d-array 'charge_density'. One specific element of this 2d-array is changed by adding a number to its original value every time. I'd like to speed this process up by openmp, but the reduction command  only support scale number. How should I solve this problem? This is a dll file which I use in ctypes for Python. Parameters of this function are from python. Here is my code:</p>
  <pre><code>void charge_distribute(double charge_density[][256], double position[][2], double x_range[], double y_range[], double x_step, double y_step)
  {
      
      int column_index_left=0, column_index_right=0, row_index_up=0, row_index_down=0;
      int i = 0;
  #pragma omp parallel for default(none) shared(x_step,y_step,position,x_range,y_range) private(column_index_left,column_index_right,row_index_up,row_index_down) reduction(+:charge_density)
      for (i = 0; i &lt; 100000; i++)
      {
          column_index_left = ((position[i][0] - x_range[0])) / x_step;
          column_index_right = column_index_left + 1;
          row_index_up = ((position[i][1] - y_range[0])) / y_step;
          row_index_down = row_index_up + 1;
          charge_density[row_index_up][column_index_left] = charge_density[row_index_up][column_index_left]+(1 - fabs(x_range[column_index_left] - position[i][0]) / x_step) * (1 - fabs(y_range[row_index_up] - position[i][1]) / y_step);
          charge_density[row_index_up][column_index_right] = charge_density[row_index_up][column_index_right]+(1 - fabs(x_range[column_index_right] - position[i][0]) / x_step) * (1 - fabs(y_range[row_index_up] - position[i][1]) / y_step);
          charge_density[row_index_down][column_index_left] = charge_density[row_index_down][column_index_left]+(1 - fabs(x_range[column_index_left] - position[i][0]) / x_step) * (1 - fabs(y_range[row_index_down] - position[i][1]) / y_step);
          charge_density[row_index_down][column_index_right] = charge_density[row_index_down][column_index_right]+(1 - fabs(x_range[column_index_right] - position[i][0]) / x_step) * (1 - fabs(y_range[row_index_down] - position[i][1]) / y_step);
  
  
  
      }
  </code></pre>
  <p>}</p>