title: How to calculate hamming distance between 1d and 2d array without loop
body: <p>A is a 1d array with shape 100, B is a 2d array with shape (50000, 100). I want to calculate hamming distance between A and B, and get an array X with shape 50000.</p>
  
  <p>I can do it with a loop:</p>
  
  <pre><code>for i in range(50000):
      X[i] = np.count_nonzero(A != B[j,:])
  </code></pre>
  
  <p>I'd like to know can I skip the loop or do something to make it faster?</p>