title: How to rewrite array from row-order to column-order?
body: <p>I have this double for-loop, where I have both row-order and column-order array indexing, which should be bad for performance.</p>
  
  <pre><code>  for (int row = 0; row &lt; height; row++) {
      for (int col = 0; col &lt; width; col++) {
  
        /* Column-major order */
        d = array_a[col*height +row];
  
        if (d &lt; 0) { d = 0; }
  
        /* Row-major order */
        /* Map from x=0,y=0 at buttom left corner to
           0,0 at top left corner */
        array_b[width*(height-1 -row) + col] = d;
  
      }
    }
  </code></pre>
  
  <p>Is there an approach/method on how to rewrite from one to the other?</p>
  
  <p>When I try to rewrite the last to column-order, the data becomes skewed. Can't it be rewritten?</p>
  
  <p>Sandra</p>