Open
Conversation
The encoding table does not match the standard Hamming(7,4) codes ... it needs an explanation https://www.gaussianwaves.com/2008/05/hamming-codes-how-it-works/
Owner
|
Hi @supergohan, Thank you very much for this contribution. I don't recall how I choose the encoding table. Could you add a more explicit comment? Best regards, |
Author
|
Dear Benoit,
Thank you for contacting me. After spending more time looking at the
Hamming (7,4) code, I have found the following two links
[1] https://www.gaussianwaves.com/2008/05/hamming-codes-how-it-works/
[2] https://michaeldipperstein.github.io/hamming.html#download ;
https://github.com/michaeldipperstein/hamming
The last link [2] describes the theory that supports the encoding and
decoding table in HammingEncodePolicy.hpp. I am not sure if you could
extend the functionality so it could support encoding with Matrices (the
code is in github). That will enhance the library as it opens the use of
other Hamming codes .
I got confused with the definition of the encoding matrix H as it was
defined differently in [1] and [2]. However, the implementation is fine (I
have attached a Matlab programme)
On another note, StreamUtils is really useful and I reckon adding the CRC
functionality of https://github.com/RobTillaart/CRCwill be great for
network communications.
Thank you again for your great work.
Best Wishes,
Angel
El lun, 21 feb 2022 a las 8:16, Benoît Blanchon ***@***.***>)
escribió:
Hi @supergohan <https://github.com/supergohan>,
Thank you very much for this contribution.
I don't recall how I choose the encoding table.
I tried to look at the linked document, but I don't think it really helps.
Could you add a more explicit comment?
Best regards,
Benoit
—
Reply to this email directly, view it on GitHub
<#18 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG65E5IOYOXEQPMB42L7PPTU4HYHJANCNFSM5OZRHPBA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
clear all;
close all;
clc;
%https://www.gaussianwaves.com/2008/05/hamming-codes-how-it-works/
%https://michaeldipperstein.github.io/hamming.html#download
%Hamming encoder (7,4) -- p1 p2 p3 d1 d2 d3 d4
% https://en.wikipedia.org/wiki/Hamming_code
% p3 p2 p1 d1 d2 d3 d4
G=[0 1 1 1 0 0 0;
1 0 1 0 1 0 0;
1 1 0 0 0 1 0;
1 1 1 0 0 0 1];%generator matrix - (7,4) Hamming code
%inputs with 4 bits
dec=0:15;
% convert the input to binary
bin = dec2bin(dec,4); %it returns a string
% the string has a binary number
binn=double(bin)-double('0'); % convert the string into a number
%find the Hamming code, with the code generator matrix
RES=mod(binn*G,2)
%The number is converter to a string
result=num2str(RES)
for i=1:16
requiredString(i,:) = regexprep(result(i,:), '\s+', '') %white spaces are removed
end
%This is the result
dec2hex(bin2dec(requiredString))
%program to generate all possible codewords for (7,4) Hamming code
m=de2bi(0:1:15,'left-msb');%list of all numbers from 0 to 2ˆk
codebook=mod(m*G,2) %list of all possible codewords
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The encoding table does not match the standard Hamming(7,4) codes ... it needs an explanation
https://www.gaussianwaves.com/2008/05/hamming-codes-how-it-works/