lass="n">K</span><span class="p">,</span> <span class="n">v</span><span class="p">))</span>

            <span class="c1"># determine error every now and then</span>
            <span class="k">if</span> <span class="n">itercount</span> <span class="o">%</span> <span class="mi">5</span><span class="p">:</span>
                <span class="n">error</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">((</span><span class="n">u</span> <span