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 ⇐
{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 ⇐
or
|
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 ⇐
or
|
19: |
aa ⇐ (aa shl j · width) and 2width − 1 |
20: |
combinations_sorted[countingaa − 1] ⇐ combinationsk
|
21: |
countingaa ⇐ countingaa − 1 |
22: |
end for
|
23: |
combinations ⇐ combinations_sorted
|
24: |
end for
|
25: |
end for |