Matrix transpose and population count
问题 I have a square boolean matrix M of size N, stored by rows and I want to count the number of bits set to 1 for each column. For instance for n=4: 1101 0101 0001 1001 M stored as { { 1,1,0,1}, {0,1,0,1}, {0,0,0,1}, {1,0,0,1} }; result = { 2, 2, 0, 4}; I can obviously transpose the matrix M into a matrix M' popcount each row of M'. Good algorithms exist for matrix transposition and popcounting through bit manipulation. My question is: would it be possible to "merge" such algorithms into a