Changeset 13784 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceLinearArd.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/CovarianceLinearArd.cs
r13721 r13784 90 90 cov.CrossCovariance = (x, xt, i, j) => Util.ScalarProd(x, i, xt, j, inverseLength, columnIndices); 91 91 if (fixedInverseLength) 92 cov.CovarianceGradient = (x, i, j) => Enumerable.Empty<double>();92 cov.CovarianceGradient = (x, i, j) => new double[0]; 93 93 else 94 94 cov.CovarianceGradient = (x, i, j) => GetGradient(x, i, j, inverseLength, columnIndices); … … 96 96 } 97 97 98 private static I Enumerable<double> GetGradient(double[,] x, int i, int j, double[] inverseLength, int[] columnIndices) {98 private static IList<double> GetGradient(double[,] x, int i, int j, double[] inverseLength, int[] columnIndices) { 99 99 int k = 0; 100 var g = new List<double>(columnIndices.Length); 100 101 for (int c = 0; c < columnIndices.Length; c++) { 101 102 var columnIndex = columnIndices[c]; 102 yield return -2.0 * x[i, columnIndex] * x[j, columnIndex] * inverseLength[k] * inverseLength[k];103 g.Add(-2.0 * x[i, columnIndex] * x[j, columnIndex] * inverseLength[k] * inverseLength[k]); 103 104 k++; 104 105 } 106 return g; 105 107 } 106 108 }
Note: See TracChangeset
for help on using the changeset viewer.