Open 10v1 opened 5 months ago
I have written some code during my study (expect a PR soon).
The calculation of Hamming weight is 1000x faster than the current method.
sage: B = random_boolean_function(28)
sage: %time B.hamming_weight()
CPU times: user 4.42 ms, sys: 64 µs, total: 4.48 ms
Wall time: 4.5 ms
134213651
For sparse Boolean polynomials, I have practically calculated the Hamming weight of some polynomials with more than 64 variables, and about 2^16 terms.
Problem Description
sage: B = random_boolean_function(28) sage: %time sum(B.truth_table()) CPU times: user 4.16 s, sys: 388 ms, total: 4.54 s Wall time: 4.55 s 134213651