Lcrypto / BP-decoder-for-NB_LDPC-codes

Non Binary-LDPC sum-product decoder (flooding and layered) using FFT (QSPA-FFT)
13 stars 8 forks source link

help #1

Open zuozuoaaaaaa opened 3 years ago

zuozuoaaaaaa commented 3 years ago

when i use this in my mfsk project,the Decoding results were zeros. i want to know why can lead to this result. the out_llrs were NaN. QQ截图20210625170039

Lcrypto commented 3 years ago

First of all check frozen bit sequence that it correct read (should be written in inverse order).

zuozuoaaaaaa commented 3 years ago

Is the input of decoder(named pp) based log-domain ?

i want to know if the decoder  is based log_BP or just probability domain. thank you very much for you reply

------------------ 原始邮件 ------------------ 发件人: "Lcrypto/BP-decoder-for-NB_LDPC-codes" @.>; 发送时间: 2021年7月9日(星期五) 上午8:38 @.>; @.**@.>; 主题: Re: [Lcrypto/BP-decoder-for-NB_LDPC-codes] help (#1)

First of all check frozen bit sequence that it correct read (should be written in inverse order).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Lcrypto commented 3 years ago

If you not change decoder currently use min sum under llrs. Below decoder

double jac_xor_approx_bp( double a, double b) { double minimum = MIN(fabs(a), fabs(b)); if((a >= 0.0 && b < 0.0) || (a < 0.0 && b >= 0.0)) { minimum *= -1.0; } double difference= fabs(a - b); double sum= fabs(a + b); //double log_probability_ratio = minimum + log(1.0+exp(-sum)) - log(1.0+exp(-difference)); double log_probability_ratio = minimum + log((1.0+exp(-sum))/(1.0+exp(-difference))); //if(log_probability_ratio==0.) //{ // printf("\n stop\n"); //} return log_probability_ratio;
}

for(int k=1; k<=N/2;k++){ LLR_upd(phi,k);

                }
                }

                    for(phi=1; phi<=m;phi++){

                for(int k=1; k<=N/2;k++){
                    R_upd(phi,k);

                }
                }

And core function

//M1 representation of Arikan tanner's based on Pamuk's An FPGA Implementation Architecture for Decoding of Polar Codes // it has level upper interconnection of z-shape subgraph connected to first N/2 index ON EVERY Layers void LLR_upd(long i, long j){
L_BP[i][j] = jac_xor_approx_bp(L_BP[i+1][2j-1],L_BP[i+1][2j]+B_BP[i][j+N/2]); L_BP[i][j+N/2] = jac_xor_approx_bp(B_BP[i][j], L_BP[i+1][2j-1]) + L_BP[i+1][2j] ; //if row and columns start from 1

//printf("\n LLR update L_BP[%d][%d]  = xor(L_BP[%d][%d],L_BP[%d][%d]+B_BP[%d][%d]  = %f ", i, j, i+1,  2*j-1,i+1,2*j,i,j+N/2, L_BP[i][j] );
//printf("\n LLR update L_BP[%d][%d]  = xor(B_BP[%d]][%d]], L_BP[%d]][%d]]) + L_BP[%d]][%d]]   = %f ", i,j+N/2, i, j ,i+1,2*j-1,i+1,2*j ,L_BP[i][j+N/2]  );

//getchar();

} void R_upd(long i, long j){
B_BP[i+1][2j-1] = jac_xor_approx_bp(B_BP[i][j], L_BP[i+1][2j]+B_BP[i][j+N/2]) ; B_BP[i+1][2j] = jac_xor_approx_bp(B_BP[i][j], L_BP[i+1][2j-1] ) + B_BP[i][j+N/2] ; //printf("\n R update B_BP[%d][%d] = jac_xor_approx_bp(B_BP[%d][%d], L_BP[%d][%d]+B_BP[%d][%d] = %f", i+1,2j-1, i, j, i+1, 2j, i,j+N/2, B_BP[i+1][2j-1] ); //printf("\n R update B_BP[%d][%d] = jac_xor_approx_bp(B_BP[%d][%d], L_BP[%d][%d] ) + B_BP[%d][%d] = %f", i+1,2j, i, j, i+1, 2j-1, i, j+N/2, B_BP[i+1][2j] );

//getchar();

}

zuozuoaaaaaa commented 2 years ago

I'm sorry to bother you.I read your email to me,Could you please send me the whole code.Because I noticed that the calculation in the code was a little different from the article I was reading. So I need you to modify the complete code.Thank you very much.You will be of great help to me in self-learning LDPC.

------------------ 原始邮件 ------------------ 发件人: "Lcrypto/BP-decoder-for-NB_LDPC-codes" @.>; 发送时间: 2021年7月19日(星期一) 晚上8:34 @.>; @.**@.>; 主题: Re: [Lcrypto/BP-decoder-for-NB_LDPC-codes] help (#1)

If you not change decoder currently use min sum under llrs. Below decoder

double jac_xor_approx_bp( double a, double b) { double minimum = MIN(fabs(a), fabs(b)); if((a >= 0.0 && b < 0.0) || (a < 0.0 && b >= 0.0)) { minimum *= -1.0; } double difference= fabs(a - b); double sum= fabs(a + b); //double log_probability_ratio = minimum + log(1.0+exp(-sum)) - log(1.0+exp(-difference)); double log_probability_ratio = minimum + log((1.0+exp(-sum))/(1.0+exp(-difference))); //if(log_probability_ratio==0.) //{ // printf("\n stop\n"); //} return log_probability_ratio; }

for(int k=1; k<=N/2;k++){ LLR_upd(phi,k); } } for(phi=1; phi<=m;phi++){ for(int k=1; k<=N/2;k++){ R_upd(phi,k); } }
And core function

//M1 representation of Arikan tanner's based on Pamuk's An FPGA Implementation Architecture for Decoding of Polar Codes // it has level upper interconnection of z-shape subgraph connected to first N/2 index ON EVERY Layers void LLR_upd(long i, long j){ L_BP[i][j] = jac_xor_approx_bp(L_BP[i+1][2j-1],L_BP[i+1][2j]+B_BP[i][j+N/2]); L_BP[i][j+N/2] = jac_xor_approx_bp(B_BP[i][j], L_BP[i+1][2j-1]) + L_BP[i+1][2j] ; //if row and columns start from 1 //printf("\n LLR update L_BP[%d][%d] = xor(L_BP[%d][%d],L_BP[%d][%d]+B_BP[%d][%d] = %f ", i, j, i+1, 2j-1,i+1,2j,i,j+N/2, L_BP[i][j] ); //printf("\n LLR update L_BP[%d][%d] = xor(B_BP[%d]][%d]], L_BP[%d]][%d]]) + L_BP[%d]][%d]] = %f ", i,j+N/2, i, j ,i+1,2j-1,i+1,2j ,L_BP[i][j+N/2] ); //getchar();
} void R_upd(long i, long j){ B_BP[i+1][2j-1] = jac_xor_approx_bp(B_BP[i][j], L_BP[i+1][2j]+B_BP[i][j+N/2]) ; B_BP[i+1][2j] = jac_xor_approx_bp(B_BP[i][j], L_BP[i+1][2j-1] ) + B_BP[i][j+N/2] ; //printf("\n R update B_BP[%d][%d] = jac_xor_approx_bp(B_BP[%d][%d], L_BP[%d][%d]+B_BP[%d][%d] = %f", i+1,2j-1, i, j, i+1, 2j, i,j+N/2, B_BP[i+1][2j-1] ); //printf("\n R update B_BP[%d][%d] = jac_xor_approx_bp(B_BP[%d][%d], L_BP[%d][%d] ) + B_BP[%d][%d] = %f", i+1,2j, i, j, i+1, 2j-1, i, j+N/2, B_BP[i+1][2j] ); //getchar();
}

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.