how to calculate XOR (dyadic) convolution with time complexity O(n log n)

烂漫一生 提交于 2021-02-08 11:46:16

问题


enter image description here

“⊕” is the bitwise XOR operation.

I think Karatsuba’s algorithm may be used to solve the problem, but when I try to use XOR instead of "+" in the Karatsuba’s algorithm, it is tough to get the sub-problem.


回答1:


The convolution theorem gives you

F(C) = F(A) . F(B)

where F is a Fourier-related transform, in this case the Hadamard transform, and . is point-wise multiplication. Using the fast Walsh–Hadamard transform, you can compute F(A), F(B), and finally C (using the inverse), in O(n log n) operations. The point-wise multiplication is simply O(n).



来源:https://stackoverflow.com/questions/53591757/how-to-calculate-xor-dyadic-convolution-with-time-complexity-on-log-n

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!