title: Fast rotation/transformation matrix multiplications
body: <p>I am looking for the most efficient way to do <code>matrix * matrix</code> and <code>matrix * vector</code> operations for 3x3 rotation and 4x4 transformation matrices in C#.</p>
  
  <p>I currently store my matrices in multidimensional arrays (<code>new double[3,3]</code>, <code>new double[4,4]</code>). I am not totally adverse to changing that but if possible I would like to keep the syntax. My current multiplication using the 3 standard nested for loops works fine but can be a bottleneck.</p>
  
  <p>My thoughts so far:</p>
  
  <ul>
  <li>Optimized algorithms like Strassen are not practical for these sizes</li>
  <li>Parallelisation does not make much sense either at the level of a single 4x4 multiplication; better done at a higher level.</li>
  <li>multidimensional arrays are (were?) slower in c# due to less efficient boundary checks, however this can be overcome with unsafe pointer arithmetic. (I am not sure how current this information is)</li>
  <li>rotation matrices are symmetric, there might be a way to exploit that?</li>
  <li>the biggest gains can probably be achieved by using cache-locality, making sure that values that are close together in memory are accessed together; but I am unsure how to do this.</li>
  </ul>
  
  <p>So before I hack together my own solution using unsafe, fixed and 3 for loops, is there already a tested and optimized solution for this standard problem out there?</p>
  
  <p>Or are there other optimizations that I have overlooked?</p>