span class="keyword">if</span> ~isfield(opts,<span class="string">'tol_'</span>)
    opts.tol_ = 1e-2;
<span class="keyword">end</span>

<span class="keyword">if</span> ~isfield(opts,<span class="string">'max_iter'</span>)
    opts.max_iter = 2000;
<span class="keyword">end</span>
</pre><h2 id="4">Compute the first term of the gradient that won&#8217;t change throughout the function</h2><pre class="codeinput">h = A'*Y - opts.lambda;
</pre><h2 id="5">Assert that the dimensions of the input corresponds to an 