in reply to Re: better algorithm: bitwise reordering
in thread better algorithm: bitwise reordering

Apologies for the lack of clarity. I neglected to mention that after swapping the rows I also reordered the columns so that they were in ascending order of the bitwise representation of their stars. So before:

. . . x * * * (row 2, bit value 4) . . . * * * * (row 1, bit value 2) . * * . . . * (row 0, bit value 1) 0 1 1 2 6 6 7 (bitwise column values)
after swapping rows 0 and 1:
. . . x * * * (still row 2) . * * . . . * (was row 0, now row 1) . . . * * * * (was row 1, now row 0) 0 2 2 1 5 5 7 (new bitwise column values)
and after reordering columns:
. x . . * * * . . * * . . * . * . . * * * 0 1 2 2 5 5 7 (new bitwise column values)

Similarly the second swap gives columns (0, 1, 4, 4, 3, 3, 7), and reordering the columns gives (0, 1, 3, 3, 4, 4, 7).

Does that make it any clearer?

Hugo

Replies are listed 'Best First'.
Re^3: better algorithm: bitwise reordering
by tilly (Archbishop) on Aug 25, 2004 at 20:06 UTC
    That makes it a lot clearer - for a start I realize that you're counting rows from the bottom up, not the top down!