for</span></tt> loop&#8212;a <em>very</em>
inefficient enterprise, particularly in CVX. A far better approach
is to extend the <tt class="docutils literal"><span class="pre">huber</span></tt> function to handle vector inputs. This is, in
fact, rather simple to do: we simply create a <em>multiobjective</em> version
of the problem:</p>
<div class="highlight-none"><div class="highlight"><pre>function cvx_optval = huber( x )
sx = size( x );
cvx_begin
    variables w( sx ) v( sx );
    minimize( w .^ 2 + 2 * v )