os(n,D);
bdX = zeros(n,E,D); kdX = zeros(n,E,D+1);

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

<span class="comment">% 2) compute predicted mean and input-output covariance</span>
<span class="keyword">for</span> i = 1:E
  <span class="comment">% first some useful intermediate terms</span>
  K2 = K(:,:,i)+exp(2*X(D+2,i))*eye(n);                         <span class="comment">% K + sigma^2*I</span>
  inp2 = bsxfun(@rdivide,input,exp(X(1:D,i)'));
  ii = bsxfun(@rd