Ignore:
Timestamp:
04/22/16 13:47:35 (5 years ago)
Author:
pfleck
Message:

#2591 Made the creation of a GaussianProcessModel faster by avoiding additional iterators during calculation of the hyperparameter gradients.
The gradients of the hyperparameters are now calculated in one sweep and returned as IList, instead of returning an iterator (with yield return).
This avoids a large amount of Move-calls of the iterator, especially for covariance functions with a lot of hyperparameters.
Besides, the signature of the CovarianceGradientFunctionDelegate is changed, to return an IList instead of an IEnumerable to avoid unnececary ToList or ToArray calls.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs

    r13721 r13784  
    239239        for (int i = 0; i < n; i++) {
    240240          for (int j = 0; j < i; j++) {
    241             var g = cov.CovarianceGradient(x, i, j).ToArray();
     241            var g = cov.CovarianceGradient(x, i, j);
    242242            for (int k = 0; k < covGradients.Length; k++) {
    243243              covGradients[k] += lCopy[i, j] * g[k];
     
    245245          }
    246246
    247           var gDiag = cov.CovarianceGradient(x, i, i).ToArray();
     247          var gDiag = cov.CovarianceGradient(x, i, i);
    248248          for (int k = 0; k < covGradients.Length; k++) {
    249249            // diag
Note: See TracChangeset for help on using the changeset viewer.