Hello. Let me reword your description to demonstrate my understanding of it:
You have a matrix of data whose elements are either 0 or 1. The matrix is x-million rows by 720 columns. You want to start by forming all column 2-tuples (minus tuples where both elements are identical). There are 517,680 such tuples (it might suffice to look at the 258,840 pairs, but for now I'll keep it as tuples). Let's suppose that the columns (10 and 98) are such that compared to the other 517,679 tuples (10, 98) has the biggest difference between the number of 1s in column 10 vs. the number of 1s in column 98, e.g., maybe there are 1 million 1s in column 10 and only 15 1s in column 98, and that difference of 999,985 is the greatest difference among all tuples (there might be ties, but ignore that for the time being); also note this accounts for the comparison between (98, 10), which would be -999,985. Next, remove all tuples containing either column 10 or 98, and repeat the analysis until there are no more tuples. The result will be 360 pairs sorted in descending order using Cx-Cy of (Cx, Cy) as the sorting key.
Here is the pseudo-code:
1) [Initialize] Set 'm' to the x-million by 720 matrix.
2) [Simplify] Count the number of 1s in each column and set 'a' to the result.
3) Form all 2-tuples of 'a'. We now have a set of (cx, cy).
4) Convert (cx, cy) into (cx-cy, cx, cy).
5) Set (t,u,v) to (cx-cy, cx, cy).
...no more chars left. Contact me for the rest.
-Don