/2 - iR*V(d,i)/2 ...
      - V(:,i)*iR(d,:)/2 -iR(:,d)*V(:,i)'/2;
    kdX(:,i,d) = bsxfun(@times,v(:,d),v(:,d));
  end % d
  
  dVdt(:,i,:,i) = c*tliK;
  kdX(:,i,D+1) = 2*ones(1,n);                       % pre-computation for later
  
end % i
dMdm = V';                                                % derivatives w.r.t m
dVdm = 2*permute(dMds,[2 1 3]);


% 3) predictive covariance matrix (non-central moments)
for i = 1:E
  K2 = K(:,:,i)+exp(2*X(D+2,i))*eye(n);
  ii = bsxfun(@rdivide,inp,exp(2*X(1:D,i)'));
 