title: Calculating an array in LINQ C#
body: <p>I would like to calculate the correlation matrix using linq, with a single phrase. How can I do that (if it is possible)? </p>
  
  <p>Assume I have already an array of size N called volatilites and Returns is a jagged array, with N arrays all of the same size.</p>
  
  <p>I am also using:</p>
  
  <pre><code>using stats = MathNet.Numerics.Statistics.ArrayStatistics
  </code></pre>
  
  <p>and this is the code that I want to make in LINQ:</p>
  
  <pre><code>double[,] correlation_matrix = new double[N,N];
  for (int i=0; i&lt;N;i++){
      for (int j = i + 1; j &lt; N; j++){
          correlation_matrix [i,j]= stats.Covariance(Returns[i], Returns[j]) / (volatilities[i] * volatilities[j]); // stores it to check values       
      }
  }
  </code></pre>
  
  <p>thanks!</p>