pan class="n">A</span> <span class="o">+</span> <span class="n">resid</span><span class="p">[:,</span><span class="kc">None</span><span class="p">])</span><span class="o">.</span><span class="n">norm</span><span class="p">(</span><span class="n">dim</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>

            <span class="c1"># Choose smallest norm from among columns of A not already chosen.</span>
            <span class="c1"># Such a vector represents the best greedy choice