- Timestamp:
- 11/20/12 14:04:29 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs
r8827 r8933 48 48 double ss = 0.0; 49 49 if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1)); 50 foreach (int kin columnIndices) {51 double d = x[i, k] - xt[j, k];50 foreach (int columnIndex in columnIndices) { 51 double d = x[i, columnIndex] - xt[j, columnIndex]; 52 52 ss += d * d; 53 53 } … … 63 63 if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1)); 64 64 int scaleIndex = 0; 65 foreach (int kin columnIndices) {66 double d = x[i, k] - xt[j, k];65 foreach (int columnIndex in columnIndices) { 66 double d = x[i, columnIndex] - xt[j, columnIndex]; 67 67 ss += d * d * scale[scaleIndex] * scale[scaleIndex]; 68 68 scaleIndex++; 69 69 } 70 // must be at the end of scale after iterating over columnIndices 71 if (scaleIndex != scale.Length) 72 throw new ArgumentException("Lengths of scales and covariance functions does not match."); 70 73 return ss; 71 74 } … … 77 80 double sum = 0.0; 78 81 if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1)); 79 foreach (int kin columnIndices) {80 sum += x[i, k] * xt[j, k];82 foreach (int columnIndex in columnIndices) { 83 sum += x[i, columnIndex] * xt[j, columnIndex]; 81 84 } 82 85 return scale * scale * sum; … … 90 93 if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1)); 91 94 int scaleIndex = 0; 92 foreach (int kin columnIndices) {93 sum += x[i, k] * scale[scaleIndex] * xt[j, k] * scale[scaleIndex];95 foreach (int columnIndex in columnIndices) { 96 sum += x[i, columnIndex] * scale[scaleIndex] * xt[j, columnIndex] * scale[scaleIndex]; 94 97 scaleIndex++; 95 98 } 99 // must be at the end of scale after iterating over columnIndices 100 if (scaleIndex != scale.Length) 101 throw new ArgumentException("Lengths of scales and covariance functions does not match."); 102 96 103 return sum; 97 104 }
Note: See TracChangeset
for help on using the changeset viewer.