"keyword">end</span> <span class="comment">% d</span>

  dMdi(i,:,:) = c*(tlbdi - tlb);
  dMdt(i,:,i) = c*liK';
  dMdX(i,1:D,i) = cdX.*sum(beta(:,i).*l) + c.*dslb;
  v = bsxfun(@rdivide,inp,exp(X(1:D,i)'));
  k(:,i) = 2*X(D+1,i)-sum(v.*v,2)/2;
  V(:,i) = t'*lb*c;                                   <span class="comment">% input-output covariance</span>

  <span class="keyword">for</span> d = 1:D
    dVds(d,i,:,:) = c*bsxfun(@times,t,t(:,d))'*tlb/2 - iR*V(d,i)/2 <span class="keyword">...</span>
      - V(:,i)*