hichamjanati / pyldpc Goto Github PK
View Code? Open in Web Editor NEWCreation of LDPC codes & simulation of coding and decoding binary data. Applications to sound and image files.
License: BSD 3-Clause "New" or "Revised" License
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
CodingMatrix for now does not work with H matrix in CSR form
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.
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.
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!
All the example/tutorial links return 404
Line 34 in 2eeea26
*
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]
From the https://github.com/hichamjanati/pyldpc/blob/master/pyldpc/code.py
d_c: int, Number of bits in the same parity-check equation. d_c Must be
greater or equal to d_v and must divide n.
and then:
if d_c <= d_v:
raise ValueError("""d_c must be greater than d_v.""")
So what version is correct?
The parity check matrix has to be of shape (n-k), where n is the LDPC block length and k is the information codeword length.
However, the code generates different shapes if I am not wrong.
Setting n to 20, d_v to 4, and d_c to 5 yields H of shape (ceil(n*d_v/d_c), n) which is (16, 20), and G with shape (20, 7)!?
Do not forget that for each generator matrix G of shape (k,n) there exist parity check matrix H of shape ((n-k),n).
Hi, thank you for creating this library.
Would LDPC encoding-decoding benefit from GPU acceleration (for large batches of messages)?
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)
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
`
Thanks for your work. It seems that the encoder uses BPSK modulation in default. Where should I change the code to use QPSK modulation?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.