title: Convert 1x1 sparse matrix to scalar
body: <p>The dot product of a row and column in a matrix is a 1x1 <code>csr_matrix</code>. How can I efficiently convert that to a scalar? Right now I use <code>sum</code>. <code>M</code> below is a square matrix:</p>
  
  <pre><code>dot_product_result = csr_matrix.sum(M.getrow(3).dot(M.getcol(5)))
  </code></pre>
  
  <p><a href="http://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.lil_matrix.html" rel="nofollow">Here's the <code>lil_matrix</code> documentation.</a></p>
  
  <p><strong>UPDATE</strong> When I try the solution below, I get this error:</p>
  
  <pre><code>    raise NotImplementedError('adding a nonzero scalar to a '
  NotImplementedError: adding a nonzero scalar to a sparse matrix is not supported
  </code></pre>
  
  <p>This is the actual code I'm using:</p>
  
  <pre><code> e = rating - Q.getrow(mid).dot(P.getcol(uid))[0]
   iteration_error += e
  </code></pre>
  
  <p>I initialize <code>iteration_error</code> to 0.0.</p>