Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/02/16 14:38:40 (8 years ago)
Author:
gkronber
Message:

#2591: merged r13438 (#2541), r13721, r13724, r13784, r13891 from trunk to stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Algorithms.DataAnalysis

  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceRationalQuadraticArd.cs

    r12009 r13981  
    121121    }
    122122
    123     public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, IEnumerable<int> columnIndices) {
     123    public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, int[] columnIndices) {
    124124      double scale, shape;
    125125      double[] inverseLength;
     
    144144    }
    145145
    146     private static IEnumerable<double> GetGradient(double[,] x, int i, int j, IEnumerable<int> columnIndices, double scale, double shape, double[] inverseLength,
     146    private static IList<double> GetGradient(double[,] x, int i, int j, int[] columnIndices, double scale, double shape, double[] inverseLength,
    147147      bool fixedInverseLength, bool fixedScale, bool fixedShape) {
    148148      double d = i == j
     
    151151      double b = 1 + 0.5 * d / shape;
    152152      int k = 0;
     153      var g = new List<double>(columnIndices.Length + 2);
    153154      if (!fixedInverseLength) {
    154155        foreach (var columnIndex in columnIndices) {
    155           yield return
     156          g.Add(
    156157            scale * Math.Pow(b, -shape - 1) *
    157             Util.SqrDist(x[i, columnIndex] * inverseLength[k], x[j, columnIndex] * inverseLength[k]);
     158            Util.SqrDist(x[i, columnIndex] * inverseLength[k], x[j, columnIndex] * inverseLength[k]));
    158159          k++;
    159160        }
    160161      }
    161       if (!fixedScale) yield return 2 * scale * Math.Pow(b, -shape);
    162       if (!fixedShape) yield return scale * Math.Pow(b, -shape) * (0.5 * d / b - shape * Math.Log(b));
     162      if (!fixedScale) g.Add(2 * scale * Math.Pow(b, -shape));
     163      if (!fixedShape) g.Add(scale * Math.Pow(b, -shape) * (0.5 * d / b - shape * Math.Log(b)));
     164      return g;
    163165    }
    164166  }
Note: See TracChangeset for help on using the changeset viewer.