es(d))==1);
    <span class="keyword">end</span>; <span class="keyword">end</span>
<span class="keyword">end</span>
f = S;

<span class="keyword">function</span> [f, df] = conT5(s, policy, m)                                  <span class="comment">% dCds</span>
d = length(m);
v(tril(ones(d))==1) = s; s = reshape(v,d,d); s = s+s'-diag(diag(s));
<span class="keyword">if</span> nargout &lt; 2
    [M, S, C] = policy.fcn(policy, m, s);
<span class="keyword">else</span>
    [M, S, C, dMdm, dSdm, dCdm, dMds, dSds, 