Changeset 14029 for branches/crossvalidation-2434/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceMaternIso.cs
- Timestamp:
- 07/08/16 14:40:02 (8 years ago)
- Location:
- branches/crossvalidation-2434
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/crossvalidation-2434
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceMaternIso.cs
r12012 r14029 111 111 } 112 112 113 public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, IEnumerable<int>columnIndices) {113 public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, int[] columnIndices) { 114 114 double inverseLength, scale; 115 115 int d = DParameter.Value.Value; … … 122 122 double dist = i == j 123 123 ? 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)); 125 125 return scale * m(d, dist); 126 126 }; 127 127 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)); 129 129 return scale * m(d, dist); 130 130 }; … … 155 155 } 156 156 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, 159 158 bool fixedInverseLength, bool fixedScale) { 160 159 double dist = i == j 161 160 ? 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)); 163 162 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; 166 167 } 167 168 }
Note: See TracChangeset
for help on using the changeset viewer.