Changeset 8982 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceLinear.cs
- Timestamp:
- 12/01/12 19:02:47 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceLinear.cs
r8931 r8982 48 48 } 49 49 50 public void SetParameter(double[] hyp) {51 if ( hyp.Length > 0) throw new ArgumentException("No hyperparameters are allowed for the linear covariance function.");50 public void SetParameter(double[] p) { 51 if (p.Length > 0) throw new ArgumentException("No parameters are allowed for the linear covariance function."); 52 52 } 53 53 54 public double GetCovariance(double[,] x, int i, int j, IEnumerable<int> columnIndices) { 55 return Util.ScalarProd(x, i, j, 1, columnIndices); 56 } 57 58 public IEnumerable<double> GetGradient(double[,] x, int i, int j, IEnumerable<int> columnIndices) { 59 yield break; 60 } 61 62 public double GetCrossCovariance(double[,] x, double[,] xt, int i, int j, IEnumerable<int> columnIndices) { 63 return Util.ScalarProd(x, i, xt, j, 1.0 , columnIndices); 54 public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, IEnumerable<int> columnIndices) { 55 if (p.Length > 0) throw new ArgumentException("No parameters are allowed for the linear covariance function."); 56 // create functions 57 var cov = new ParameterizedCovarianceFunction(); 58 cov.Covariance = (x, i, j) => Util.ScalarProd(x, i, j, 1, columnIndices); 59 cov.CrossCovariance = (x, xt, i, j) => Util.ScalarProd(x, i, xt, j, 1.0 , columnIndices); 60 cov.CovarianceGradient = (x, i, j) => Enumerable.Empty<double>(); 61 return cov; 64 62 } 65 63 }
Note: See TracChangeset
for help on using the changeset viewer.