Skip to main content
. Author manuscript; available in PMC: 2012 Jun 1.
Published in final edited form as: Parallel Comput. 2011 June-July;37(6-7):261–278. doi: 10.1016/j.parco.2011.04.002

Algorithm 7.

[combinations] = RADIXSORT(R(1), combinations, width)

Input:
R(1)bit pattern matrix used to generate new candidates
combinations – pairs of column indices which generate new candidates
width – width of the sequence of bits over which elementary radix sort is performed
Output:
combinations – reordered pairs of indices so that corresponding columns are sorted
1: r ⇐ size(R(1), 1)
2: col_length ⇐ number of machine words in r bits
3: for i = 1 to col_length do
4:  factor ⇐ rwidth {number of sequences of length width in current word}
5: for j = 1 to factor do
6:   counting ⇐ zeros (1, 2width)
7:   for k = 1 to length(combinations) do
8:     (ii, jj) ⇐ combinationsk
9:    aa ⇐ R,ii(1) or R,jj(1)
10:    aa ⇐ (aa shl j · width) and (2width − 1)
11:    countingaa ⇐ countingaa + 1
12:   end for
13:   for k = 1 to 2width do
14:    countingk ⇐ countingk + countingk−1
15:   end for
16:   for k = length(combinations) downto 1 do
17:     (ii, jj) ⇐ combinations(k)
18:    aa ⇐ R,ii(1) or R,jj(1)
19:    aa ⇐ (aa shl j · width) and 2width − 1
20:    combinations_sorted[countingaa − 1] ⇐ combinationsk
21:    countingaacountingaa − 1
22:   end for
23:   combinations ⇐ combinations_sorted
24: end for
25: end for