Calculating Hamming weight efficiently in matlab

后端 未结 9 1527
你的背包
你的背包 2020-12-09 11:46

Given a MATLAB uint32 to be interpreted as a bit string, what is an efficient and concise way of counting how many nonzero bits are in the string?

I have a working

9条回答
  •  佛祖请我去吃肉
    2020-12-09 11:48

    Unless this is a MATLAB implementation exercise, you might want to just take your fast C++ implementation and compile it as a mex function, once per target platform.

提交回复
热议问题