private MultivariableRecord InitializeKey(TKey key) { MultivariableRecord newRec = new MultivariableRecord(numberOfVariables, statisticsToCollect); Data.Add(key, newRec); return(newRec); }
private double[,] DataRow(MultivariableRecord record) { double[,] res = new double[variableNames.Length, statisticsNames.Length]; for (int i = 0; i < variableNames.Length; ++i) { double[] stats = record.GetVariableStatistics(i); for (int j = 0; j < statisticsNames.Length; ++j) { res[i, j] = stats[j]; } } return(res); }
private double[] SummaryLine(MultivariableRecord record) { double[] res = new double[1 + statisticsNames.Length * variableNames.Length]; res[0] = record.NumberOfSamples; for (int i = 0; i < variableNames.Length; ++i) { double[] stats = record.GetVariableStatistics(i); for (int j = 0; j < statisticsNames.Length; ++j) { res[1 + i * statisticsNames.Length + j] = stats[j]; } } return(res); }
public void AddSample(TKey key, double[] sampleData) { Debug.Assert(sampleData != null); Debug.Assert(sampleData.Length == numberOfVariables); if (Data.ContainsKey(key)) { Data[key].AddSample(sampleData); } else { MultivariableRecord newRec = InitializeKey(key); newRec.AddSample(sampleData); } }
private string CSVLine(TKey key, MultivariableRecord record, string format) { string res = ""; foreach (string name in key.GetRow()) { res += name + csvSeparator; } double[] lineData = SummaryLine(record); Debug.Assert(lineData.Length >= 1); for (int i = 0; i < lineData.Length - 1; ++i) { res += lineData[i].ToString(format) + csvSeparator; } res += lineData[lineData.Length - 1] + newline; return(res); }