Ejemplo n.º 1
0
        private static IList <double> GetGradient(double[,] x, int i, int j, int[] columnIndices, double scale, ParameterizedCovarianceFunction cov,
                                                  bool fixedScale)
        {
            var gr = new List <double>((!fixedScale ? 1 : 0) + cov.CovarianceGradient(x, i, j).Count);

            if (!fixedScale)
            {
                gr.Add(2 * scale * cov.Covariance(x, i, j));
            }
            foreach (var g in cov.CovarianceGradient(x, i, j))
            {
                gr.Add(scale * g);
            }
            return(gr);
        }
Ejemplo n.º 2
0
 private static IEnumerable <double> GetGradient(double[,] x, int i, int j, IEnumerable <int> columnIndices, double scale, ParameterizedCovarianceFunction cov,
                                                 bool fixedScale)
 {
     if (!fixedScale)
     {
         yield return(2 * scale * cov.Covariance(x, i, j));
     }
     foreach (var g in cov.CovarianceGradient(x, i, j))
     {
         yield return(scale * g);
     }
 }
Ejemplo n.º 3
0
 private static IEnumerable<double> GetGradient(double[,] x, int i, int j, IEnumerable<int> columnIndices, double scale, ParameterizedCovarianceFunction cov,
   bool fixedScale) {
   if (!fixedScale) {
     yield return 2 * scale * cov.Covariance(x, i, j);
   }
   foreach (var g in cov.CovarianceGradient(x, i, j))
     yield return scale * g;
 }
Ejemplo n.º 4
0
 private static IList<double> GetGradient(double[,] x, int i, int j, int[] columnIndices, double scale, ParameterizedCovarianceFunction cov,
   bool fixedScale) {
   var gr = new List<double>((!fixedScale ? 1 : 0) + cov.CovarianceGradient(x, i, j).Count);
   if (!fixedScale) {
     gr.Add(2 * scale * cov.Covariance(x, i, j));
   }
   foreach (var g in cov.CovarianceGradient(x, i, j))
     gr.Add(scale * g);
   return gr;
 }