title: Efficiently compute pairwise equal for NumPy arrays
body: <p>Given two NumPy arrays, say:</p>
  
  <pre><code>import numpy as np
  import numpy.random as rand
  
  n = 1000
  x = rand.binomial(n=1, p=.5, size=(n, 10))
  y = rand.binomial(n=1, p=.5, size=(n, 10))
  </code></pre>
  
  <p>Is there a more efficient way to compute <code>X</code> in the following:</p>
  
  <pre><code>X = np.zeros((n, n))
  for i in range(n):
      for j in range(n):
          X[i, j] = 1 * np.all(x[i] == y[j])
  </code></pre>