Talk:Hamming weight

Latest comment: 3 years ago by Klbrain in topic Merge from Minimum weight

Hamming weight of a CRC polynomial edit

This paper, koopman04_crc_poly_embedded.pdf by Koopman and Chakravarty is using Hamming weight to mean something completely different than popcount. And they use Hamming weight as a quality measurement on CRC polynomials. On page 2 in the paper they write: "A Hamming weight N is the number of errors, out of all possible message corruptions, that is undetected by a CRC using a particular polynomial. A set of Hamming weights captures performance for different numbers of bits corrupted in a message at a particular data word length, with each successively longer data word length having set of Hamming weights with higher values. The first non-zero Hamming weight determines a code’s Hamming Distance."

Jorgen.karlsson (talk) 21:11, 26 November 2016 (UTC)Reply

--- edit

Horrible!!

Please, symplify! it is for readers, not only for "copy/paste" testing programmers.


I disagree. The definition and background are clear and concise. Additional background is provided in the links and references. The advanced information is well-presented for anyone with a good grasp of arithmetic. The software examples are immediately useful to the people most likely to have a serious interest in this topic. 64.175.33.56 15:46, 15 November 2007 (UTC) PictographerReply

Fast division edit

If you have fast division (or you want to calculate the population count of a constant at compile time) then you can replace the last few stages by taking the remainder of the division by 255 i.e.

int popcount_3(uint64 x) {
    x -= (x >> 1) & m1;
    x = (x & m2) + ((x >> 2) & m2);
    x = (x + (x >> 4)) & m4;
    return x % 255;
}

or, an alternative version as a single-line C-style #define

#define popcount_4(x) (((x) & h01) + (((x) >> 1) & h01) + (((x) >> 2) & h01) + (((x) >> 3) & h01) + (((x) >> 4) & h01) + (((x) >> 5) & h01) + (((x) >> 6) & h01) % 127)  —Preceding unsigned comment added by 80.175.250.218 (talk) 17:15, 13 March 2009 (UTC)Reply 

Should someone make note that in the example given, "Hello World" is counting the space character (ASCII 32) and not the null character (ASCII 0) as having 0 Hamming weight? 131.122.52.166 (talk) 06:37, 22 March 2011 (UTC)Reply

Isolating one bit edit

As Wegner (1960) described,[3] the lowest-order nonzero bit of a word x may be found as the exclusive or of x with x − 1:
I don't have access to the reference, but the quote would seem to be inaccurate. As a four-bit example, (0100) ^ (0011) = (0111), which does not seem to isolate one bit. x & -x would seem to be a better method.
--50.47.202.254 (talk) 17:07, 23 June 2011 (UTC)Reply

What Wegner actually says is that (rewritten symbolically) x&(x-1) eliminates the low order bit from x. He doesn't mention exclusive ors. —David Eppstein (talk) 19:04, 23 June 2011 (UTC)Reply

Is lookup method faster? edit

It's said: If we are allowed greater memory usage, we can calculate the Hamming weight faster than the above methods, but unfortunately it's not true. The real-world benchmarks show that lookup table is slower than alternative approaches (even these described in the article), due to current CPU's architecture. The cited sentence should rather use word "simpler" instead of "faster". 195.66.98.6 (talk) 08:25, 22 March 2016 (UTC)Reply

External links modified edit

Hello fellow Wikipedians,

I have just modified one external link on Hamming weight. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 18 January 2022).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 18:22, 28 October 2017 (UTC)Reply

Merge from Minimum weight edit

I don't think we need a separate article with two sentences about the minimum value of the Hamming weight... --Piotr Konieczny aka Prokonsul Piotrus| reply here 03:28, 1 July 2020 (UTC)Reply

Will switch that page to a dab now that     Y Merger complete. Klbrain (talk) 14:59, 20 February 2021 (UTC)Reply