GithubHelp home page GithubHelp logo

hichamjanati / pyldpc Goto Github PK

View Code? Open in Web Editor NEW
119.0 119.0 32.0 1.95 MB

Creation of LDPC codes & simulation of coding and decoding binary data. Applications to sound and image files.

License: BSD 3-Clause "New" or "Revised" License

Python 96.88% Makefile 3.12%

pyldpc's People

Contributors

lingr7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pyldpc's Issues

Square image, problem in decoding process

image

Hi! Thanks for creating this library!

I've got this error when decoding one 128x128 RGB image after encoding/transmission.
Code rate (R) = 1/3
n = 9213 (= 3 * (width_RGB * 24bits) - 3 = 3*(128*24) - 3 = 9213
k = 3072
d_v = 2
d_c = 3
seed = 42
systematic=True and sparse=True

Could anyone please help me with this error?
Thanks in advance!

possible speedup?

Have you considered this modified method to compute Lr in decoder?
It may offer some speedup, although I haven't tested it.

def phi0(x):
    x = abs(x)
    if (x < 9.08e-5 ):
        return( 10 );
    else:
        return -log (tanh (x/2))

def G(Lq):
    X = sum (phi0(e) for e in Lq)
    s = np.prod(np.sign(Lq))
    return s * phi0(X)

Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated.

python3-numpy-1.21.5-1.fc35.x86_64

When running I get:

/home/nbecker/.local/lib/python3.10/site-packages/pyldpc/utils.py:151: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
  bits = np.array(bits)
/home/nbecker/.local/lib/python3.10/site-packages/pyldpc/utils.py:152: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.

Missing function to encode without noise

The function to encode a given message WITHOUT adding noise seems to be missing. How can I encode a message that is meant to be transmitted over a real medium? The medium itself will add plenty of noise, I don't need any extra added.

Support CuPy arrays?

Hi, thank you for creating this library.

Would LDPC encoding-decoding benefit from GPU acceleration (for large batches of messages)?

what is the mean of function parity_check_matrix?

Did the funcition builds a regular Parity-Check Matrix H?
But why the Matrix i get is not a Parity-Check Matrix,such as
[1 0 1 0 0 0 0 1 1 1 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 1 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 1 0 0 0 1 0 0 1 0 0 1 0 0 1]
[0 0 0 0 0 0 0 0 0 1 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 1 1 0 0 1 0 0 0 1 1]
[0 0 0 0 0 0 0 0 1 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 1 0 0 0 1 1 0 1 0 0 0 1 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0 1 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

Unable to decode message even with just 1 bit flip in encoded msg

Hello

I am using dv = 4, dc = 5, n = 20, which gives k = 7.
I generate a message of length 7, encode them using ldpc encode, with snr=100000 [since I don't want to add noise]. I then simulate errors in communication by randomly flipping 1 bit of the encoded message.
But, I am unable to decode this message correctly!

Here's the code:
`seed = np.random.RandomState(42)

H, G = make_ldpc(n, d_v, d_c, systematic=True, sparse=True)

input_msg = np.random.randint(2, size=k)

enc_msg = encode(G, input_msg, snr, seed=seed)

dec_msg = get_message(G, decode(H, enc_msg, snr)) # works correctly

flip_ind = np.random.randint(0, len(enc_msg) - 1 )

enc_msg[flip_ind] = -1.0 * enc_msg[flip_ind] # change 1 to -1 and vice versa, to simulate bit flip due to communication errors

flipped_dec_msg = get_message(G, decode(H, enc_msg, snr)) # this is wrong
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.