title: Loop-Tiling to Rotate a Matrix
body: <p>I'm trying to write a function to rotate an image matrix using the loop-tiling technique. However, I'm running into some issues with getting it to work properly. </p>
  
  <p>EDIT:
  Here's my updated code that works, but only when n is a multiple of the block size. How would I go about handling varying matrix sizes? Right now, I'm just using square blocks, and it works very well for those square blocks. How would I go about changing this to use rectangular blocks based on the size of the array I'm given. Specifically, if I'm given an n x n array, how do I choose the rectangular block dimensions to split it up into?</p>
  
  <pre><code>  //Block size to tune
    int block = 20;
    int i1, j1, k1,  i, j, k;
  
    for(i1 = 0; i1 &lt; n; i1 += block) {
      for(j1 = 0; j1&lt; n; j1 += block) {
              for(i = i1; i &lt; i1 + block; i++){
                  for(j = j1; j &lt; j1 + block; j++){
                      dest[getInd(j, i, n)] = src[getInd(i, n - 1 - j, n)]; 
  
                  }
              }
          }
      }
  </code></pre>
  
  <p>}</p>