Changeset 8827
 Timestamp:
 10/22/12 14:37:46 (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs
r8678 r8827 56 56 57 57 public static double SqrDist(double[,] x, int i, int j, double[] scale, IEnumerable<int> columnIndices = null) { 58 return SqrDist(x, i, x, j, scale );58 return SqrDist(x, i, x, j, scale, columnIndices); 59 59 } 60 60 … … 62 62 double ss = 0.0; 63 63 if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1)); 64 int scaleIndex = 0; 64 65 foreach (int k in columnIndices) { 65 66 double d = x[i, k]  xt[j, k]; 66 ss += d * d * scale[k] * scale[k]; 67 ss += d * d * scale[scaleIndex] * scale[scaleIndex]; 68 scaleIndex++; 67 69 } 68 70 return ss; … … 87 89 double sum = 0.0; 88 90 if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1)); 91 int scaleIndex = 0; 89 92 foreach (int k in columnIndices) { 90 sum += x[i, k] * scale[k] * xt[j, k] * scale[k]; 93 sum += x[i, k] * scale[scaleIndex] * xt[j, k] * scale[scaleIndex]; 94 scaleIndex++; 91 95 } 92 96 return sum;
Note: See TracChangeset
for help on using the changeset viewer.