c, then
direct computation is a far more efficient way to compute the result
than solving a QP. (What is more, the multiobjective version cannot be
used with numeric inputs.) One solution is to place both versions in one
file, with an appropriate test to select the proper version to use:</p>
<div class="highlight-none"><div class="highlight"><pre>function cvx_optval = huber( x )
if isnumeric( x ),
    xa   = abs( x );
    flag = xa &lt; 1;
    cvx_optval = flag .* xa.^2 + (~flag) * (2*xa-1);
else,
    sx = 