 dLds, S2] = loss_cp(cost, m, s)
</pre><h2>Code<a name="2"></a></h2><pre class="codeinput"><span class="keyword">if</span> isfield(cost,<span class="string">'width'</span>); cw = cost.width; <span class="keyword">else</span> cw = 1; <span class="keyword">end</span>
<span class="keyword">if</span> ~isfield(cost,<span class="string">'expl'</span>) || isempty(cost.expl); b = 0; <span class="keyword">else</span> b =  cost.expl; <span class="keyword">end</span>

<span class="comment">% 1. Some precomputations</s