title: Most effective way to compute the pairwise minimum between a numpy array and a csr_matrix
body: <p>I have an numpy array <code>V</code> with a shape of <code>(1, 1000)</code>. I also have a csr_matrix <code>M</code> with a shape of <code>(100000, 1000)</code>. For every row <code>m</code> in <code>M</code>, I want to compute the pairwise minimum between <code>V</code> and <code>m</code>, and store all the results in a new matrix, and I want to do it efficiently. The final result should also be a matrix with a shape of <code>(100000, 1000)</code>.</p>
  <p>Some approaches that I considered/tried:</p>
  <ul>
  <li>Iterate over each row of <code>M</code> with a for loop. This works, but it is quite slow.</li>
  <li>Convert <code>M</code> to a matrix: <code>numpy.minimum(V, M.toarray())</code> which takes a huge amount of memory.</li>
  <li><code>numpy.minimum(V, M)</code> does not work. I get an error which says: <code>Comparing a sparse matrix with a scalar less than zero using &gt;= is inefficient</code>.</li>
  </ul>
  <p>What would be a good and efficient way to do this without taking too much memory or time?</p>