Changeset 2285 for trunk/sources/HeuristicLab.DataAnalysis
- Timestamp:
- 08/13/09 17:28:07 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.DataAnalysis/3.2/Dataset.cs
r2223 r2285 27 27 using System.Globalization; 28 28 using System.Text; 29 using System.Linq; 29 30 30 31 namespace HeuristicLab.DataAnalysis { … … 78 79 get { return scalingOffset; } 79 80 set { 80 if (value.Length != scalingOffset.Length) 81 if (value.Length != scalingOffset.Length) 81 82 throw new ArgumentException("Length of scaling offset array doesn't match number of variables"); 82 scalingOffset = value; } 83 scalingOffset = value; 84 } 83 85 } 84 86 … … 98 100 get { return samples; } 99 101 set { 102 variableNames = Enumerable.Range(1, columns).Select(x => "Var" + x.ToString("###")).ToArray(); 100 103 scalingFactor = new double[columns]; 101 104 scalingOffset = new double[columns]; … … 115 118 } 116 119 117 public Dataset() { 120 public Dataset() 121 : this(new double[,] { { 0.0 } }) { 122 } 123 124 public Dataset(double[,] samples) { 118 125 Name = "-"; 119 variableNames = new string[] { "Var0" }; 120 Columns = 1; 121 Rows = 1; 122 Samples = new double[1]; 123 scalingOffset = new double[] { 0.0 }; 124 scalingFactor = new double[] { 1.0 }; 125 cachedValuesInvalidated = true; 126 Rows = samples.GetLength(0); 127 Columns = samples.GetLength(1); 128 double[] values = new double[Rows * Columns]; 129 int i = 0; 130 for (int row = 0; row < Rows; row++) { 131 for (int column = 0; column < columns; column++) { 132 values[i++] = samples[row, column]; 133 } 134 } 135 Samples = values; 126 136 fireChangeEvents = true; 127 137 } 128 138 129 130 139 131 140 public string GetVariableName(int variableIndex) {
Note: See TracChangeset
for help on using the changeset viewer.