Fast pairwise combinations in NumPy

--

Pairwise combinations in NumPy.

Instead of using Python’sitertools.combinatios(arr, r=2) you can achieve the same goal by generating the upper triangle of an (n, n) array and excluding the diagonal (k=1). Benchmark below.

Benchmark itertools.combinations and numpy.

--

--