Changeset 13784 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSquaredExponentialArd.cs
- Timestamp:
- 04/22/16 13:47:35 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSquaredExponentialArd.cs
r13721 r13784 122 122 123 123 // order of returned gradients must match the order in GetParameterValues! 124 private static I Enumerable<double> GetGradient(double[,] x, int i, int j, int[] columnIndices, double scale, double[] inverseLength,124 private static IList<double> GetGradient(double[,] x, int i, int j, int[] columnIndices, double scale, double[] inverseLength, 125 125 bool fixedInverseLength, bool fixedScale) { 126 126 double d = i == j … … 129 129 130 130 int k = 0; 131 var g = new List<double>((!fixedInverseLength ? columnIndices.Length : 0) + (!fixedScale ? 1 : 0)); 131 132 if (!fixedInverseLength) { 132 133 for (int c = 0; c < columnIndices.Length; c++) { 133 134 var columnIndex = columnIndices[c]; 134 135 double sqrDist = Util.SqrDist(x[i, columnIndex] * inverseLength[k], x[j, columnIndex] * inverseLength[k]); 135 yield return scale * Math.Exp(-d / 2.0) * sqrDist;136 g.Add(scale * Math.Exp(-d / 2.0) * sqrDist); 136 137 k++; 137 138 } 138 139 } 139 if (!fixedScale) yield return 2.0 * scale * Math.Exp(-d / 2.0); 140 if (!fixedScale) g.Add(2.0 * scale * Math.Exp(-d / 2.0)); 141 return g; 140 142 } 141 143 }
Note: See TracChangeset
for help on using the changeset viewer.