Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example to use python encoder/decoder #2

Open
FranzForstmayr opened this issue Jul 16, 2021 · 1 comment
Open

Example to use python encoder/decoder #2

FranzForstmayr opened this issue Jul 16, 2021 · 1 comment

Comments

@FranzForstmayr
Copy link

Hi,

I expected to use the encoder/decoder as followed

ldpc = LDPC(...)
x = np.random.randint(0,2, 128) # generate some random bits
enc = ldpc.encode(x)
x_r = ldpc.decode(enc)[0]

The decode method delivers float values, however it's not obvious how to get the decoded bits out of the stream.

Could you please clarify if this is possible?

Thanks!
Franz

@heat1q
Copy link
Owner

heat1q commented Aug 19, 2021

Hi,
the decode method operates on the actual log-likelihood-ratios (LLRs). In other words, you have to first calculate the LLRs for the input (usually a codeword + some noise). The decoder then outputs the decode LLRs which you can then use for decision making (depending on your channel).

See also:

    def decode(self, llr_in: np.array, early_term=True, iters=50, dec_type="BP") -> np.array:
        """Decode array of input LLRs.
        Args:
            llr_in (np.array): Input LLR, length n (transmitted)
            early_term (bool, optional): Terminate decoding if codeword 
            is valid. Defaults to True.
            iters (int, optional): Number of iterations. Defaults to 50.
            dec_type (str, optional): Type of decoding. See libldpc documentation
            Defaults to "BP".
        Returns:
            np.array: Output LLR, length n (transmitted)
        """
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants