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/CovarianceMaternIso.cs

    r12009 r13981  
    111111    }
    112112
    113     public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, IEnumerable<int> columnIndices) {
     113    public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, int[] columnIndices) {
    114114      double inverseLength, scale;
    115115      int d = DParameter.Value.Value;
     
    122122        double dist = i == j
    123123                       ? 0.0
    124                        : Math.Sqrt(Util.SqrDist(x, i, j, Math.Sqrt(d) * inverseLength, columnIndices));
     124                       : Math.Sqrt(Util.SqrDist(x, i, j, columnIndices, Math.Sqrt(d) * inverseLength));
    125125        return scale * m(d, dist);
    126126      };
    127127      cov.CrossCovariance = (x, xt, i, j) => {
    128         double dist = Math.Sqrt(Util.SqrDist(x, i, xt, j, Math.Sqrt(d) * inverseLength, columnIndices));
     128        double dist = Math.Sqrt(Util.SqrDist(x, i, xt, j, columnIndices, Math.Sqrt(d) * inverseLength));
    129129        return scale * m(d, dist);
    130130      };
     
    155155    }
    156156
    157 
    158     private static IEnumerable<double> GetGradient(double[,] x, int i, int j, int d, double scale, double inverseLength, IEnumerable<int> columnIndices,
     157    private static IList<double> GetGradient(double[,] x, int i, int j, int d, double scale, double inverseLength, int[] columnIndices,
    159158      bool fixedInverseLength, bool fixedScale) {
    160159      double dist = i == j
    161160                   ? 0.0
    162                    : Math.Sqrt(Util.SqrDist(x, i, j, Math.Sqrt(d) * inverseLength, columnIndices));
     161                   : Math.Sqrt(Util.SqrDist(x, i, j, columnIndices, Math.Sqrt(d) * inverseLength));
    163162
    164       if (!fixedInverseLength) yield return scale * dm(d, dist);
    165       if (!fixedScale) yield return 2 * scale * m(d, dist);
     163      var g = new List<double>(2);
     164      if (!fixedInverseLength) g.Add(scale * dm(d, dist));
     165      if (!fixedScale) g.Add(2 * scale * m(d, dist));
     166      return g;
    166167    }
    167168  }
Note: See TracChangeset for help on using the changeset viewer.