keyword">end</span>

k = zeros(n,E); M = zeros(E,1); V = zeros(D,E); S = zeros(E);

inp = bsxfun(@minus,gpmodel.inputs,m');                    <span class="comment">% centralize inputs</span>

<span class="comment">% 2) Compute predicted mean and inv(s) times input-output covariance</span>
<span class="keyword">for</span> i=1:E
  iL = diag(exp(-X(1:D,i))); <span class="comment">% inverse length-scales</span>
  in = inp*iL;
  B = iL*s*iL+eye(D);

  t = in/B;
  l = exp(-sum(in.*t,2)/2); lb = l.*beta(:,i);
  t