> To turn the Hadamard matrix in the nicely-ordered flavor showcased earlier, we need to sort the rows based on their sequency. I’m not aware of an algorithm more elegant than counting the number of zero crossings
By staring at the matrix, I guessed a pattern and algorithm already known according to https://en.wikipedia.org/wiki/Walsh_matrix:
> The sequency ordering of the rows of the Walsh matrix can be derived from the ordering of the Hadamard matrix by first applying the bit-reversal permutation and then the Gray-code permutation: