Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8827


Ignore:
Timestamp:
10/22/12 14:37:46 (12 years ago)
Author:
gkronber
Message:

#1902: fixed bugs concerning masking covariance function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs

    r8678 r8827  
    5656
    5757    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);
    5959    }
    6060
     
    6262      double ss = 0.0;
    6363      if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1));
     64      int scaleIndex = 0;
    6465      foreach (int k in columnIndices) {
    6566        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++;
    6769      }
    6870      return ss;
     
    8789      double sum = 0.0;
    8890      if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1));
     91      int scaleIndex = 0;
    8992      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++;
    9195      }
    9296      return sum;
Note: See TracChangeset for help on using the changeset viewer.