title: Fold by column in Math Net numerics, keeping track of number of columns
body: <p>Using Math.Net numerics, I would like to do a task:</p>
  
  <p>Fold through each column, and multiply that column's value by the index of my vector.  The problem is, none of the folding functions yield a counter...and counting within the folding functions is problematic...and for loops are death for this kind of thing...</p>
  
  <p>Anyhow, ideally I would do something like:</p>
  
  <pre class="lang-ml prettyprint-override"><code>points.FoldByColumn(fun i acc x -&gt; acc &lt;- acc + x * coefficients_array.[i])
  |&gt; Array.map(fun x -&gt; x + coefficients_array.[coefficients_array.length-1])
  </code></pre>
  
  <p>(this is written in F# syntax).  </p>
  
  <p>The statement is exactly equivalent to this statement in Python using Numpy broadcasting:</p>
  
  <pre class="lang-py prettyprint-override"><code>return (self.model_coefs[:-1] * points).sum(axis = 1) + self.model_coefs[-1]
  </code></pre>
  
  <p>What it is doing is multiplying a set of points by their linear regression coefficients, and turning them into a single predicted point.</p>
  
  <p>(Or am I really just crazy to try to do this stuff on .NET??)</p>