title: Python, Numpy: all UNIQUE combinations of a numpy.array() vector
body: <p>I want to get all <strong>unique</strong> combinations of a numpy.array vector (or a pandas.Series). I used itertools.combinations but it's very <em>slow</em>. For an array of size (1000,) it takes many hours. Here is my code using itertools (actually I use combination differences):</p>
  
  <pre><code>def a(array):
      temp = pd.Series([])
      for i in itertools.combinations(array, 2):
          temp = temp.append(pd.Series(np.abs(i[0]-i[1])))
      temp.index=range(len(temp))
      return temp
  </code></pre>
  
  <p>As you see there is no <strong>repetition</strong>!!
  The <a href="https://stackoverflow.com/a/1235363/5188208">sklearn.utils.extmath.cartesian</a> is really fast and good but it provides repetitions which I do not want! I need help rewriting above function without using itertools and much more speed for large vectors.</p>