How would you transpose a binary matrix?

前端 未结 7 980
-上瘾入骨i
-上瘾入骨i 2020-12-16 02:13

I have binary matrices in C++ that I repesent with a vector of 8-bit values.

For example, the following matrix:

1 0 1 0 1 0 1
0 1 1 0 0 1 1
0 0 0 1 1         


        
相关标签:
7条回答
  • 2020-12-16 03:12

    This is a bit late, but I just stumbled across this interchange today. If you look at Hacker's Delight, 2nd Edition,there are several algorithms for efficiently transposing Boolean arrays, starting on page 141.

    They are quite efficient: a colleague of mine obtained a factor about 10X speedup compared to naive coding, on an X86.

    0 讨论(0)
提交回复
热议问题