Changeset 13784 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSpectralMixture.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/CovarianceSpectralMixture.cs
r13721 r13784 181 181 182 182 // order of returned gradients must match the order in GetParameterValues! 183 private static I Enumerable<double> GetGradient(double[,] x, int i, int j, int maxQ, double[] weight, double[] frequency, double[] lengthScale, int[] columnIndices,183 private static IList<double> GetGradient(double[,] x, int i, int j, int maxQ, double[] weight, double[] frequency, double[] lengthScale, int[] columnIndices, 184 184 bool fixedWeight, bool fixedFrequency, bool fixedLengthScale) { 185 185 double[] tau = Util.GetRow(x, i, columnIndices).Zip(Util.GetRow(x, j, columnIndices), (xi, xj) => xi - xj).ToArray(); 186 186 int numberOfVariables = lengthScale.Length / maxQ; 187 187 188 var g = new List<double>((!fixedWeight ? maxQ : 0) + (!fixedFrequency ? maxQ * columnIndices.Length : 0) + (!fixedLengthScale ? maxQ * columnIndices.Length : 0)); 188 189 if (!fixedWeight) { 189 190 // weight … … 198 199 idx++; 199 200 } 200 yield return k;201 g.Add(k); 201 202 } 202 203 } … … 213 214 Math.Sin(2 * Math.PI * tau[idx] * frequency[q * numberOfVariables + c]); 214 215 idx++; 215 yield return weight[q] * k;216 g.Add(weight[q] * k); 216 217 } 217 218 } … … 229 230 f2(tau[idx], frequency[q * numberOfVariables + c]); 230 231 idx++; 231 yield return weight[q] * k;232 g.Add(weight[q] * k); 232 233 } 233 234 } 234 235 } 236 237 return g; 235 238 } 236 239 }
Note: See TracChangeset
for help on using the changeset viewer.