title: Log-sum-exp trick on a sparse matrix in scipy
body: <p>What's the best way to apply something like <code>scipy.misc.logsumexp</code> to a sparse matrix (for instance a <code>scipy.sparse.csr_matrix</code>), specifying one axis?</p>
  
  <p>The point is to leave the zeros out from the computation.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>It is better to specify that I'm looking for something that performs the <a href="http://machineintelligence.tumblr.com/post/4998477107/the-log-sum-exp-trick" rel="nofollow">log-sum-exp trick</a>, doing a simply succession of exp elem-wise, summing the rows and doing a log elem-wise is trivial in <code>scipy.sparse</code>. Less trivial is computing in a clean way the max along rows and subtracting it as each element in the a sparse matrix row is subtracted the corresponding max vector elem (retaining a sparse matrix in the end).</p>