sxfun(@rdivide,gpmodel.inputs,exp(X(1:D,i)'));
    K(:,:,i) = exp(2*X(D+1,i)-maha(inp,inp)/2);
    <span class="keyword">if</span> isfield(gpmodel,<span class="string">'nigp'</span>)
      L = chol(K(:,:,i) + exp(2*X(D+2,i))*eye(n) + diag(gpmodel.nigp(:,i)))';
    <span class="keyword">else</span>
      L = chol(K(:,:,i) + exp(2*X(D+2,i))*eye(n))';
    <span class="keyword">end</span>
    iK(:,:,i) = L'\(L\eye(n));
    beta(:,i) = L'\(L\gpmodel.targets(:,i));
  <span class="keyword">end</span>
<span class="