title: How to compute a fast outer product between two matrices, in Matlab?
body: <p>I have two n-by-m matrices, <code>A</code> and <code>B</code>. I want to create a new matrix <code>C</code> which is something like:</p>
  
  <pre><code>for i = 1:n
      C = C + outerProduct(A(i,:), B(i,:));
  end
  </code></pre>
  
  <p>i.e. <code>C</code> is a matrix of size m x m, the sum of all outer products of the rows of <code>A</code> and <code>B</code>. </p>
  
  <p>Is there a fast way to do it without a for loop (given that for loops are notoriously slow in Matlab)?</p>