  <span class="n">itercount</span> <span class="o">+=</span> <span class="mi">1</span>

        <span class="c1"># using Tr(X.T Y) = Sum[ij](Xij * Yij)</span>
        <span class="c1"># P.T * C</span>
        <span class="c1"># P_ij = u_i * v_j * K_ij</span>
        <span class="n">pity</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">multiply</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">multiply</span><span cl