コード例 #1
0
        private MultivariableRecord InitializeKey(TKey key)
        {
            MultivariableRecord newRec = new MultivariableRecord(numberOfVariables, statisticsToCollect);

            Data.Add(key, newRec);
            return(newRec);
        }
コード例 #2
0
 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);
 }
コード例 #3
0
 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);
 }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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);
        }