public void FinishAndProcess() { try { var priceData = new DenseMatrix(symbols.Length, numTicks); for (int j = 0; j < symbols.Length; j++) { SortedList <DateTime, Tick> d = mktData[j].data.Data; for (int k = 0; k < d.Count; k++) { priceData[j, k] = d.Values[k].BidClose; } } for (int i = 0; i < symbols.Length; i++) { for (int j = 0; j < symbols.Length; j++) { double[] pDatai = priceData.Row(i).ToArray(); double[] pDataj = priceData.Row(j).ToArray(); switch (cType) { case CovarianceType.LogReturn: { pDatai = priceData.Row(i).ToArray().LogRateOfReturn(); pDataj = priceData.Row(j).ToArray().LogRateOfReturn(); break; } case CovarianceType.RawReturn: { pDatai = priceData.Row(i).ToArray().RawRateOfReturn(); pDataj = priceData.Row(j).ToArray().RawRateOfReturn(); break; } } correlation[i, j] = StatisticsExtension.Correlation(pDatai, pDataj); covariance[i, j] = StatisticsExtension.Covariance((DenseVector)priceData.Row(i), (DenseVector)priceData.Row(j)); } } Visualize.GenerateHeatMatrix(symbols, correlation, "C:\\Users\\Ethan\\Work\\QuantSysdata.html"); Console.WriteLine("Finished Generating Correlation Matrix."); } catch (Exception e) { Console.WriteLine(e.Message); } }