亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? 005r.c

?? LDPC碼在AWGN信道下的譯碼程序(c語(yǔ)言)
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
  total_iterations += loop;  return ret;}double R(double a, double b)				// function for check node operation{  return 2.0 * atanh(tanh(a/2.0)*tanh(b/2.0));}double sign(double a){  if (a == 0) return 0.0;  if (a > 0) return 1.0;  if (a < 0) return -1.0;}double min(double a, double b){  if (a > b) return b;  else return a;}double minsumR(double a, double b)				// function for check node operation of min-sum algotithm{  return sign(a) * sign(b) * min(fabs(a),fabs(b));}void init_dec(FILE *fp){/**********************************************************************************/// initialization of BP decoder/**********************************************************************************/  int i,j;  int v;  int *counter;  double a,b;  int tmp;// read parity check matrix   fscanf(fp,"%d %d\n",&n,&m);	// n:code length, m:number of parity checks  fscanf(fp,"%d %d\n",&rmax,&cmax); // rmax:maximum number of row weight				    // cmax:maximum number of column weight  row_weight = malloc(sizeof(int)*m); // array for row weight profile  for (i = 0; i <= m-1; i++) fscanf(fp,"%d",&row_weight[i]);  col_weight = malloc(sizeof(int)*n); // array for column weight profile  for (i = 0; i <= n-1; i++) fscanf(fp,"%d",&col_weight[i]);  counter = malloc(sizeof(int)*n);   for (i=0; i <= n-1; i++) counter[i] = 0;    row_list = malloc(sizeof(int*)*m); // parity check matrix in row form  for (i=0;i<=m-1;i++) row_list[i] = malloc(sizeof(int)*rmax);  col_list_r = malloc(sizeof(int*)*n);   for (i=0;i<=n-1;i++) col_list_r[i] = malloc(sizeof(int)*cmax);  col_list_c = malloc(sizeof(int*)*n);   for (i=0;i<=n-1;i++) col_list_c[i] = malloc(sizeof(int)*cmax);// set up for parity check matrix  for (j = 0; j <= m-1; j++) {    for (i = 0; i <= row_weight[j]-1; i++) {      fscanf(fp,"%d",&v);      v--;      row_list[j][i] = v;      col_list_r[v][counter[v]] = j;      col_list_c[v][counter[v]] = i;      counter[v]++;    }  }  punc_ptn = malloc(sizeof(int) * n); // puncture pattern (0:no puncture, 1:puncture)  if (puncture == ON)    for (i = 0; i<=n-1; i++) fscanf(fp,"%d",&punc_ptn[i]);  else     for (i = 0; i<=n-1; i++) punc_ptn[i] = 0;  if (met == ON) {    vnode_type = malloc(sizeof(int)*n);    fscanf(fp,"%d",&tmp);    for (i = 0; i<=m-1; i++) fscanf(fp,"%d",&tmp);    fscanf(fp,"%d",&num_vnode_type);        for (i = 0; i<=n-1; i++) fscanf(fp,"%d",&vnode_type[i]);    vnode_errors = malloc(sizeof(int)*num_vnode_type);    for (i = 0; i <= num_vnode_type-1; i++) vnode_errors[i] = 0;  }  // set up for BP related global variables  alpha = malloc(sizeof(int*)*m); // check to variable message  for (i=0;i<=m-1;i++) alpha[i] = malloc(sizeof(int)*rmax);  beta  = malloc(sizeof(int*)*m); // variable to check message  for (i=0;i<=m-1;i++) beta[i] = malloc(sizeof(int)*rmax);  tmp_bit = malloc(sizeof(int)*n); // tentative decoding result				// set up of table for check node operation  R_tbl = malloc(sizeof(int*) * ASIZE);  for (i = 0; i <= ASIZE-1; i++) {    R_tbl[i] = malloc(sizeof(int) * ASIZE);  }  for (i = LB2; i <= UB2; i++) {    for (j = LB2; j <= UB2; j++) {      a = DELTA * i;      b = DELTA * j;      if (minsum == 1) 	R_tbl[i+UB][j+UB] = quantize(minsumR(a,b));      else	R_tbl[i+UB][j+UB] = quantize(R(a,b));    }  }  qLLR = malloc(sizeof(int)*n);	// quantized LLR  forward = malloc(sizeof(int)*rmax);  backward= malloc(sizeof(int)*rmax);}/**********************************************************************************/// simulation status and result report functions/**********************************************************************************/void report_result2(FILE *out){  fprintf(out,"%4.3f %7.6e %7.6e %d %d %d %d %5.2f %d %d\n",	  snr,	  (double)error_bits/total_bits,	  (double)error_blocks/total_blocks,	   error_bits,	  total_bits,	  error_blocks,	  total_blocks,	  (double)total_iterations/total_blocks,	  n,	  m	  );}void report_result(FILE *out){  fprintf(out,"%4.3f %7.6e %7.6e %d %d %d %d %5.2f var=%4.3f sdv=%4.3f mis=%d seed=%d mitr=%d n=%d m=%d r=%4.3f depth=%d DLETA=%4.3e range=%4.3e config=%s scond=%d serr=%d target=%4.3e log=%d punc=%d met=%d msum=%d norm=%4.3f pchk=%d\n",	  snr,	  (double)error_bits/total_bits,	  (double)error_blocks/total_blocks,	  error_bits,	  total_bits,	  error_blocks,	  total_blocks,	  (double)total_iterations/total_blocks,	  channel_var,	  sqrt(channel_var),	  total_miscorrection,	  seed,	  max_itr,	  n,	  m,	  code_rate,	  quantization_level,	  DELTA,	  UB2*DELTA,	  filename,	  stop_condition,	  stop_errors,	  target_error_prob,	  error_logging,	  puncture,	  met,	  minsum,	  norm_factor,	  parity_check	  );}/**********************************************************************************/// simulation functions/**********************************************************************************/void make_received_word(double *r){  int i;  for (i = 0; i <= n-1; i++) {    r[i] = 1.0-2.0*cword[i] + nrnd(channel_var);  }}void simulation_loop(){  int i,j;  int sum;  int ret;// set up of initial condition  cword = malloc(sizeof(int)*n);  rword = malloc(sizeof(double)*n);  LLR = malloc(sizeof(double)*n);  total_blocks = 0;  total_bits = 0;  error_blocks = 0;  error_bits = 0;  total_iterations = 0;  total_miscorrection = 0;  while(1) {    total_blocks++;    total_bits += n;    if (encoding == 1) {      gen_info_seq(cword);      encode_word(cword);    }     else for (i = 0; i <= n-1;i++) cword[i] = 0;    //for (i =0; i <= n-1; i++) printf("%d",cword[i]);printf("\n");    //printf("parity = %d\n",parity_check_func(cword));    make_received_word(rword);    for (i = 0; i <= n-1; i++) LLR[i] = 2.0 * rword[i]/channel_var;    ret = quantized_BP(LLR);    sum = 0;    for(i = 0; i <= n-1;i++) {      if (encoding == 1) tmp_bit[i] ^= cword[i];      if (punc_ptn[i] == 0) sum += tmp_bit[i];      if (met == ON) 	vnode_errors[vnode_type[i]] += tmp_bit[i];    }    error_bits += sum;    if (sum != 0) {      error_blocks++;      if (error_logging==1) {	for (j=0; j<=n-1;j++) fprintf(error_log,"%d ",tmp_bit[j]);	fprintf(error_log,"(error_weight=%d)\n",sum);      }    }    if ((ret == 0)&&(sum != 0)) total_miscorrection++;    if (display_result == 1) report_result(stderr); // full report    if (display_result == 2) report_result2(stderr); // brief report    if ((error_bits >= stop_errors)&&(stop_condition==BIT)&&(total_blocks>=100)) break;    if ((error_blocks >= stop_errors)&&(stop_condition==BLOCK)) break;    if ((total_bits >= stop_errors/target_error_prob)&&(stop_condition==BIT)) {      fprintf(stdout, "stop by target_error_prob conditon\n");      break;    }    if ((total_blocks >= stop_errors/target_error_prob)&&(stop_condition==BLOCK)) {      fprintf(stdout, "stop by target_error_prob conditon\n");      break;    }    if ((total_bits >= 10/target_error_prob)&&(error_bits==0)&&(stop_condition==BIT)) {      fprintf(stdout, "stop by early stop condition\n");      break;    }    if ((total_blocks >= 10/target_error_prob)&&(error_blocks==0)&&(stop_condition==BLOCK)) {      fprintf(stdout, "stop by early stop condition\n");      break;    }    if ((stop_condition >=2)&&(total_blocks >stop_condition)) break;  }}void terminate_program(char *s){    fprintf(stderr,"%s\n",s);    exit(-1);}void read_config_file(FILE *fp){// set up for simulation parameters  FILE *hfile,*encoder;  char str1[MAX_STR_LEN],str2[MAX_STR_LEN];  int i;  fscanf(fp,"%s",str1);  if (strcmp(str1,"matrix_file")!=0) terminate_program("error in matrix_file\n");  fscanf(fp,"%s",str2);		// parity check matrix file (spmat form)  if ((hfile = fopen(str2,"r")) == NULL) {    fprintf(stderr,"Can't open %s.\n",str2);    exit(-1);  }  fscanf(fp,"%s",str1);  if (strcmp(str1,"code_rate")!=0) terminate_program("error in code_rate\n");  fscanf(fp,"%lf",&code_rate);	// code rate of the target LDPC code  if ((code_rate<0) || (code_rate>1)) terminate_program("invalid code rate\n");  fscanf(fp,"%s",str1);  if (strcmp(str1,"quantize_depth")!=0) terminate_program("error in quantize_depth\n");  fscanf(fp,"%d",&quantization_level); // quantization depth  if ((quantization_level<2) || (quantization_level>20))     terminate_program("invalid quantization_level\n");  ASIZE = (1 << quantization_level)-1; // number of quantization levels  DELTA = 102.4/(ASIZE+1);	// quatization step  LB = -(ASIZE-1)/2;		  UB = (ASIZE-1)/2;  LB2 = -(ASIZE-1)/4;		// lower bound of quantized value  UB2 = (ASIZE-1)/4;		// upper bound of quantized value  fscanf(fp,"%s",str1);  if (strcmp(str1,"max_iteration")!=0) terminate_program("error in max_iteration\n");  fscanf(fp,"%d",&max_itr);	// maximum number of iterations in BP  if (max_itr < 0) terminate_program("invalid max_itr\n");  fscanf(fp,"%s",str1);  if (strcmp(str1,"random_seed")!=0) terminate_program("error in random_seed\n");  fscanf(fp,"%d",&seed);	// seed of random number generator  srand48(seed);		// set up random seed  fscanf(fp,"%s",str1);  if (strcmp(str1,"display")!=0) terminate_program("error in display\n");  fscanf(fp,"%d",&display_result); // flag for display mode of simulation status				   // 0:no display, 1:full display, 2:simple display  fscanf(fp,"%s",str1);  if (strcmp(str1,"stop_condition")!=0) terminate_program("error in stop_condition\n");  fscanf(fp,"%d",&stop_condition); // stop condition of simulation				   // 0:bit errors, 1:block errors, 				   // other positive number: number of loops  if (stop_condition < 0) terminate_program("invalid stop_condition\n");  fscanf(fp,"%s",str1);  if (strcmp(str1,"stop_errors")!=0) terminate_program("error in stop_errors\n");  fscanf(fp,"%d",&stop_errors);	// When the number of errors reaches stop_errors,				// simulation loop is terminated.  if (stop_errors < 0)     terminate_program("invalid stop_errors\n");  fscanf(fp,"%s",str1);  if (strcmp(str1,"target_prob")!=0) terminate_program("error in target_prob\n");  fscanf(fp,"%lf",&target_error_prob); // target error probability  if (target_error_prob < 0.0)     terminate_program("invalid target_error_prob\n");  fscanf(fp,"%s",str1);  if (strcmp(str1,"error_logging")!=0) terminate_program("error in error_loging\n");  fscanf(fp,"%d",&error_logging); // error logging switch 0 or 1  if ((error_logging!=0)&&(error_logging!=1))     terminate_program("invalid error_logging\n");  if(error_logging == 1) {    if ((error_log = fopen("error_log","w")) == NULL) {      fprintf(stderr,"Can't open %s.\n","error_log");      exit(-1);    }    fprintf(stderr,"error logging starts.\n");  }  fscanf(fp,"%s",str1);  if (strcmp(str1,"puncture")!=0) terminate_program("error in puncture\n");  fscanf(fp,"%d",&puncture);	// Are there puncture bits? 0 or 1  if ((puncture!=0)&&(puncture!=1))     terminate_program("invalid puncture\n");  fscanf(fp,"%s",str1);  if (strcmp(str1,"multi_edge_type")!=0) terminate_program("error in multi_edge_type\n");  fscanf(fp,"%d",&met);		// Is it a multi-edge type LDPC code? 0 or 1  if ((met!=0)&&(met!=1))     terminate_program("invalid met\n");  fscanf(fp,"%s",str1);  if (strcmp(str1,"min-sum")!=0) terminate_program("error in min-sum\n");  fscanf(fp,"%d",&minsum);	// switch of min-sum algorithm 0 or 1				// if minsum == 1, then simulation with min-sum algorithm				// otherwise simulation with sum-product algortihm  if ((minsum!=0)&&(minsum!=1))     terminate_program("invalid minsum\n");  fscanf(fp,"%s",str1);  if (strcmp(str1,"norm_factor")!=0) terminate_program("error in norm_factor\n");  fscanf(fp,"%lf",&norm_factor); // normalization factor for min-sum algorithm				 // if normalization == 0, then no normalization				 // See papers of normalized-BP by Prof.Fossorier.  if (norm_factor < 0.0)     terminate_program("invalid norm_factor\n");  fscanf(fp,"%s",str1);  if (strcmp(str1,"parity_check")!=0) terminate_program("error in parity_check\n");  fscanf(fp,"%d",&parity_check); // switch of parity check in BP algortihm, 0 or 1  if ((parity_check!=0)&&(parity_check!=1))     terminate_program("invalid parity_check\n");  #ifdef TEST2  encoding = 1;  printf("encoding is ON\n");  fscanf(fp,"%s",str1);  if ((encoder = fopen(str1,"r")) == NULL) {    fprintf(stderr,"Can't open %s.\n",str1);    exit(-1);  }  read_encfile(encoder);  //print_encfile(encoder);  #endif  init_dec(hfile);		// initialization of decoder}/**********************************************************************************/// main /**********************************************************************************/int main(int argc,char **argv){  FILE *fp;			// pointer for configuration file  int i;#ifdef TEST1/*Test for quantized_BP()-----------------------------------------------------------------6.3.spmat------------------6 33 23 2 31 1 2 2 1 11 2 3 3 44 5 61 0 0 0 0 1------------------log posterior probability ratio (by double-precision BP)    4.0554    0.5884    0.2407    1.0694    1.6060    2.2915    3.9537    0.2780    1.7111    1.7111    1.5387    2.2338    4.3974    1.6925    1.7111    1.7111    2.0840    2.7033    4.3974    1.6925    1.7111    1.7111    2.0840    2.7033    4.3974    1.6925    1.7111    1.7111    2.0840    2.7033*/  double r[] = {1.620803,0.264281,-0.031637,-0.127654,0.746347,1.003543};   int qlevel;  channel_var = 0.794328;  printf("basic test\n");  fp = fopen("6.3.spmat","r");  qlevel = 10;  ASIZE = (1 << qlevel)-1;   DELTA = 102.4/(ASIZE+1);  LB = -(ASIZE-1)/2;		  UB = (ASIZE-1)/2;  LB2 = -(ASIZE-1)/4;		  UB2 = (ASIZE-1)/4;		  puncture = OFF;  met = OFF;  parity_check = OFF;  max_itr = 10;  init_dec(fp);  LLR = malloc(sizeof(int)*6);  for (i = 0;i <= 5; i++) LLR[i] = 2.0*r[i]/channel_var;  quantized_BP(LLR);  exit(0);//-----------------------------------------------------------------#endif// user interface  if (argc != 3) {    printf("usage: awgn_simulator config_file snr\n");				// snr: Eb/N0    exit(-1);  }  if ((fp = fopen(argv[1],"r")) == NULL) {    fprintf(stderr,"Can't open %s.\n",argv[1]);    exit(-1);  }  filename =argv[1];		// filename of configuration file  snr = atof(argv[2]);		// get signal to noise ratio  read_config_file(fp);		// reading configulation file  channel_var = 0.5 * (1.0/pow(10.0,snr/10.0))/code_rate;// simulation and report  simulation_loop();		// main simulation loop  report_result(stdout);	// print out the simulation result  if (error_logging==ON) report_result(error_log);				// for multi-edge type  if (met == ON) {    printf("# number of bit errors for each variable node type\n");    printf("# ");    for (i=0;i<=num_vnode_type-1;i++) printf("%d ",vnode_errors[i]);    printf("\n");    printf("# bit error probability for each variable node type\n");    printf("# ");    for (i=0;i<=num_vnode_type-1;i++) printf("%16.12e ",(double)vnode_errors[i]/total_bits);    printf("\n");  }  return 0;}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区三区视频在线 | 久久久精品日韩欧美| 国产精品 日产精品 欧美精品| 久久精品日韩一区二区三区| 不卡一卡二卡三乱码免费网站| 亚洲夂夂婷婷色拍ww47| 精品久久久久久无| 欧美体内she精高潮| 韩国成人精品a∨在线观看| 亚洲品质自拍视频| 久久一区二区三区四区| 欧美一区三区二区| 色综合视频在线观看| 粉嫩欧美一区二区三区高清影视| 五月天视频一区| 国产精品日韩精品欧美在线| 欧美一级夜夜爽| 欧美视频第二页| 色婷婷激情久久| 99re这里只有精品6| 中文字幕日本乱码精品影院| 91精品国产一区二区三区蜜臀 | 亚洲精品综合在线| 精品国产乱码久久久久久久| 欧美日韩一级二级| 在线精品亚洲一区二区不卡| 高清久久久久久| 成人免费毛片a| 日本丰满少妇一区二区三区| 成人app软件下载大全免费| 国产suv精品一区二区6| 国产成人自拍网| 97精品超碰一区二区三区| 99re热视频精品| 欧美日本一区二区| 日韩一区二区电影网| 久久久国际精品| |精品福利一区二区三区| 亚洲一本大道在线| 韩日欧美一区二区三区| 成人天堂资源www在线| 97久久精品人人做人人爽50路| 99久久精品国产麻豆演员表| 在线观看av一区| 日韩三级中文字幕| 久久这里只有精品视频网| 久久精品视频在线免费观看| 亚洲欧美另类小说视频| 成人亚洲一区二区一| 91黄色激情网站| 日韩欧美亚洲国产另类 | 国产精品美女久久久久av爽李琼| 久久久久久久一区| 午夜精品aaa| 成人免费观看视频| 日韩美女一区二区三区四区| 亚洲视频精选在线| 国产在线看一区| 在线不卡a资源高清| 亚洲免费色视频| 国产一区二区视频在线| 91麻豆精品国产91久久久资源速度| 国产女人水真多18毛片18精品视频| 五月天国产精品| 色中色一区二区| 中文字幕亚洲一区二区va在线| 精品在线一区二区三区| 欧美日韩在线播放三区| 国产精品人成在线观看免费| 激情久久五月天| 欧美变态口味重另类| 亚洲aaa精品| 在线电影一区二区三区| 亚洲成人777| 欧美日韩国产小视频| 五月天亚洲婷婷| 欧美乱妇23p| 免费高清视频精品| 精品播放一区二区| 激情欧美一区二区| 国产日韩欧美亚洲| 成人免费高清在线观看| 国产精品国产a| 一本色道久久综合亚洲aⅴ蜜桃| 亚洲欧洲精品成人久久奇米网| 国产精品香蕉一区二区三区| 国产无人区一区二区三区| 国产高清亚洲一区| 国产精品你懂的在线欣赏| 91视频在线看| 亚洲二区视频在线| 在线不卡中文字幕播放| 日韩不卡免费视频| 久久精品欧美一区二区三区不卡| heyzo一本久久综合| 亚洲国产cao| 精品国产123| 成人h动漫精品一区二区| 中文字幕一区二区在线播放| 18成人在线观看| 久久99精品国产.久久久久久| 日韩欧美一区二区免费| av成人动漫在线观看| 午夜日韩在线观看| 久久亚洲综合色一区二区三区| av中文字幕亚洲| 麻豆精品一区二区av白丝在线| 日韩电影在线一区| 久久精品一二三| 欧美一区二区啪啪| 色婷婷激情综合| 成人毛片在线观看| 国产一区二区精品久久99| 亚洲小说春色综合另类电影| 国产午夜精品理论片a级大结局| 欧美人妇做爰xxxⅹ性高电影| 国产一区二区三区在线观看免费| 亚洲国产一区二区视频| 综合中文字幕亚洲| 国产精品丝袜在线| 国产亚洲精品bt天堂精选| 91精品国产综合久久小美女| 91福利小视频| 色综合久久中文字幕| 波多野结衣亚洲| 成人18视频在线播放| 国产高清久久久| 精品一区二区免费视频| 激情图片小说一区| 国产一区二区三区国产| 国产乱码字幕精品高清av| 久久97超碰国产精品超碰| 精品系列免费在线观看| 久久精品国产99久久6| 久久av资源网| 国产美女精品在线| 成人黄色小视频| 91免费观看国产| 69成人精品免费视频| 日韩欧美成人午夜| 中文字幕欧美日韩一区| 中文字幕国产一区| 亚洲一线二线三线久久久| 五月婷婷综合网| 国内一区二区在线| 91免费国产在线观看| 日韩一区二区免费电影| 久久久久久久久免费| 亚洲精品国产一区二区精华液| 日精品一区二区| 国产成人免费在线视频| 在线看不卡av| 久久久精品综合| 亚洲午夜免费视频| 国产一区二区三区免费| 欧美自拍丝袜亚洲| 久久久www成人免费毛片麻豆| 国产精品亲子伦对白| 午夜精品一区二区三区电影天堂 | 国产99久久久国产精品潘金| 在线免费av一区| 国产精品国产三级国产普通话蜜臀| 亚洲一区精品在线| 国产成人午夜精品影院观看视频 | 日本一区二区在线不卡| 日韩国产高清在线| 欧美羞羞免费网站| 中文字幕在线观看不卡视频| 日韩成人一区二区| 欧美日精品一区视频| 国产亚洲污的网站| 久久不见久久见中文字幕免费| 在线播放中文一区| 一区二区理论电影在线观看| 99re亚洲国产精品| 久久精品免视看| 狠狠色综合色综合网络| 欧美精品一级二级三级| 一区二区三区日韩精品视频| 久久亚洲捆绑美女| 亚洲男人的天堂在线aⅴ视频| 成人黄色777网| 精品国产一区二区三区不卡| 日韩成人一区二区三区在线观看| 在线观看av不卡| 成人欧美一区二区三区在线播放| 美女免费视频一区二区| 欧美日韩精品一区二区三区四区| 日韩一区二区精品| 亚洲午夜视频在线| 欧美一区二区网站| 久久99久久99精品免视看婷婷 | 亚洲第一福利视频在线| 色婷婷av一区二区三区软件| 一级特黄大欧美久久久| 7777精品伊人久久久大香线蕉经典版下载| 一区二区三区日韩精品| 91精品国产欧美一区二区18| 欧美性色欧美a在线播放| 国产真实乱偷精品视频免|