title: How to matrix-multiply two sparse SciPy matrices and produce a dense Numpy array efficiently?
body: <p>I'd like to matrix-multiply two sparse SciPy matrices. However, the result is not sparse, so I'd like to store it as a NumPy array.</p>
  <p>Is it possible to do this efficiently, that is without creating a &quot;sparse&quot; matrix first and then converting it? I'm free to choose any input format (whichever is more efficient).</p>
  <hr />
  <p>An example: the product of two 10000x10000 99% sparse matrices with randomly distributed zeros will be dense:</p>
  <pre><code>n = 10_000
  a = np.random.randn(n, n) * (np.random.randint(100, size=(n, n)) == 0)
  b = np.random.randn(n, n) * (np.random.randint(100, size=(n, n)) == 0)
  c = a.dot(b)
  np.count_nonzero(c) / c.size # should be 0.63
  </code></pre>