Matlab: fast way to sum ones in binary numbers with Sparse structure?

前端 未结 7 934
滥情空心
滥情空心 2021-01-07 16:11

Most answers only address the already-answered question about Hamming weights but ignore the point about find and dealing with the sparsity. Apparently the

7条回答
  •  不知归路
    2021-01-07 16:25

    The bitcount FEX contribution offers a solution based on the lookup table approach, but is better optimized. It runs more than twice as fast as the bit twiddling method (i.e. the fastest pure-MATLAB method reported by Amro) over a 1 million uint32 vector, using R2015a on my old laptop.

提交回复
热议问题