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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? 005r.c

?? LDPC碼在AWGN信道下的譯碼程序(c語言)
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
/***********************************************************************************  	FILENAME: awgn_simulator.c	version 1.5	(C) Tadashi Wadayama, 2003        An LDPC code simulator based on quantized-BP algorithm for AWGN chanel*********************************************************************************        ChangeLog:	Aug. 14, 2003 : start	Aug. 17, 2003 : min-sum algorithm	Aug. 18, 2003 : encoding	Aug. 23, 2003 : output format change, bug fix of str[], addition of  "puncture" 	Aug. 23, 2003 : range of "loop", tie break rule, check node update, interger-BP	Aug. 24, 2003 : comments, error handling in read_config_file()	Aug. 24, 2003 : TEST1,TEST2********************************************************************************** How to compile*********************************************************************************	gcc -O2 -o awgn_simulator awgn_simulator.c -lm	with -D TEST1: test for quantized_BP()	with -D TEST2: test for simulation with encoding**********************************************************************************  How to run*********************************************************************************    awgn_simulator filename_of_configuration_file snr    Example: awgn_simulator config 1.0**********************************************************************************  Configuation file format*********************************************************************************Example:--------------------------------------------------------matrix_file 	9974.5000 code_rate	0.4987quantize_depth	10max_iteration	100random_seed	1display		1stop_condition 	1stop_errors	100target_prob	1e-5error_logging	0puncture	0multi_edge_type	0min-sum		0norm_factor	0.0parity_check	1--------------------------------------------------------NOTE:	matrix_file 	: low density parity check matrix in spmat form	code_rate	: code rate of target code	quantize_depth	: quantization depth (recommendation: 8--13 bits )			  decoding performance depends on the depth	max_itreation	: maximum number of iterations in BP 	random_seed	: seed of radom number generator	display		: display mode of simulation status during simulation	                  0: no display, 1: full display, 2: simple display	stop_condition 	: conditions for  termination of simulation                          0: bit error, 1: block errors 			  if stop_condition >=2, simulation will terminates after			  stop_condition-loops.	stop_errors	: number of errors enough to stop simulation	target_prob	: target error probability you wish to obtain	error_logging	: error logging switch	puncture	: switch for puncture	                  0: no puncture, 1:puncture			  if puncture == 1, spmat file must contain			  puncture pattern after matrix definition	multi_edge_type	: switch for multi-edge type	                  usullaly, set to zero.	min-sum		: switch for BP algorithm                          0:sum-product, 1:min-sum	norm_factor	: normalization factor for min-sum algorithm	parity_check	: parity ckeck switch	                0: no parity check in BP, 1:perform parity check in BP**********************************************************************************  simulation status and report format (See also report_result2(), report_result())*********************************************************************************snr pb pB #ebits #bits #eblks #blks aveitr var sdv mis seed mitr n m r depth DLETA range config scond serr target log punc met msum norm pchk	snr   : signal to noise ratio Eb/N0	pb    : bit error probability after decoding 	pB    : block error probability after decoding 	#ebits: number of error bits	#bits : number of total bits generated	#eblks: number of error blocks	#blks : number of total blocks generated	aveitr: average number of iterations per block	var   : variance of Gaussian noise	sdv   : standard deviation of Gaussian noise	mis   : number of miscorrected blocks	seed  : seed of random number generator	mitr  : maximum number of iterations	n     : code length	m     : number of parity constraints	r     : code rate	depth : bit depth of quantization	DELTA : quantization step	range : range of quantized messsage	config: file name of configuration file	scond : 	        0->simulation stops when #ebits reaches to  serr	        1->simulation stops when #eblks reaches to  serr	serr  : number of errors enough to stop a simulation	target: target error probability	log   : logging for error blocks	punc  : puncture	met   : multi-edge type	msum  : min-sum algorithm	norm  : normalization factor	pchk  : parity check in BP algorithm**********************************************************************************"spmat form" for sparce parity check matrix*********************************************************************************Example (Do not include "#...." in a spmat file.)16 12	                          # code_length number_of_parity_check_constraint4 3                               # largest_row_weight largest_column_weight4 4 4 4 4 4 4 4 4 4 4 4           # row_weight_profile3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3   # column_weight_profile3 8 10 13                         # parity check matrix(caution:colum # started from 1!)4 7 9 132 5 7 104 6 11 143 9 15 161 6 9 104 8 12 152 6 12 161 7 14 163 5 12 142 11 13 151 5 8 11                    The above spmat format corresponds to the following matrix:164 0 0 1 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 1 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0If puncture = 1, append puncture pattern like 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0to the bottom of a spmat file. In the above example, 1st, 2nd and 3rd bit will be punctured.*//**********************************************************************************/// Inlucde files and macros/**********************************************************************************/#include <stdio.h>#include <stdlib.h>#include <math.h>#define OFF 0#define ON 1#define BIT 0#define BLOCK 1#define MAX_STR_LEN 100/**********************************************************************************/// Global variables/**********************************************************************************///-------------------------------------for quantized_BP()int *tmp_bit;		// tentetative decision bitint **alpha;		// check to variable messageint **beta;		// variable to check messageint n;			// code lengthint m;			// number of constraintsint rmax;		// maximum number of row weightint cmax;		// maximum number of column weightint *row_weight;	// row weightsint *col_weight;	// column weightsint **row_list;		// row list of parity check matrixint **col_list_r;	// column list 1int **col_list_c;	// column list 1int LB,UB,LB2,UB2;	// upper and lower bound for quantized messagesint ASIZE;		// number of quantization levelsdouble DELTA;		// quantization step sizeint **R_tbl;		// table for check node operationdouble *LLR;		// array for received LLR valuesint *qLLR;		// quantized LLR valuesint *forward;		// forward array for check node operationint *backward;		// backward array for check node operationint max_itr;		// maximum number of iterations in BP//-------------------------------------for simulation_loop()double code_rate;	// code rateint total_iterations;	// total number of iterationsint seed;		// seed for random number generatorint quantization_level;	// quantization depthchar *filename;		// filename of configuration fileint total_blocks;	// total number of tested blocksint total_bits;		// total number of tested bitsint error_blocks;	// number of error blocksint error_bits;		// number of error bitsint total_miscorrection; // number of mis corrected blocksint display_result;	 // display switchint stop_condition;	 // stop conditionint stop_errors;	 // number of errors for stop conditionint error_logging;	 // error logging switchdouble target_error_prob; // target error probabilityint *punc_ptn;		 // puncture patternint puncture;		 // puncture switchint met;		 // multi-edge type switchint *vnode_type;	 // variable node typeint num_vnode_type;	 // number of variable node typeFILE *error_log;	 // error log fileint *vnode_errors;	 // number of variable node errorsint minsum;		 // min-sum algorithm switchdouble norm_factor;	 // normalization factorint parity_check;	 // parity check switchint encoding;//-------------------------------------for encodingint e_n;                // code lengthint e_m;		// number of parity symbolsint e_rmax;		// maximum number of row weightint e_cmax;		// maximum number of column weightint *e_row_weight;	// row weightsint *e_col_weight;	// column weightsint **e_row_list;	// parity check matrix//-------------------------------------channel dependent parametersint *cword;             // sent codeworddouble *rword;		// received word at receiverdouble channel_var;     // channel variancedouble snr;		// signal to noise ratio (Eb/N0)/**********************************************************************************/// encoding functions (used only for TEST2)/**********************************************************************************/void read_encfile(FILE *fp){  int i,j;  int v;  fscanf(fp,"%d %d\n",&e_n,&e_m);  fscanf(fp,"%d %d\n",&e_rmax,&e_cmax);  e_row_weight = malloc(sizeof(int)*e_m);  for (i = 0; i <= e_m-1; i++) fscanf(fp,"%d",&e_row_weight[i]);  e_col_weight = malloc(sizeof(int)*e_n);  for (i = 0; i <= e_n-1; i++) fscanf(fp,"%d",&e_col_weight[i]);  e_row_list = malloc(sizeof(int*)*e_m);  for (i=0;i<=e_m-1;i++) e_row_list[i] = malloc(sizeof(int)*e_rmax);  for (j = 0; j <= e_m-1; j++) {    for (i = 0; i <= e_row_weight[j]-1; i++) {      fscanf(fp,"%d",&v);      v--;      e_row_list[j][i] = v;    }  }}void print_encfile(){  int i,j;  printf("encoder file ----------------------\n");  printf("%d %d\n",e_n,e_m);  printf("%d %d\n",e_rmax,e_cmax);  for (i=0;i<=e_m-1;i++) {    for (j=0;j<=e_row_weight[i]-1;j++)  printf("%d ",e_row_list[i][j]+1);    printf("\n");  }}void gen_info_seq(int *seq){  int i;  for (i = 0; i <= m-1; i++) seq[i] = 0;  for (i = m; i <= n-1; i++) {    if (drand48() > 0.5) seq[i] = 1;    else seq[i] = 0;  }  return;}void print_seq(int *seq){  int i;  for (i = 0; i <= n-1; i++) printf("%d ",seq[i]);  printf("\n");}void encode_word(int* word){  int i,j;  int parity;  for (j = m-1; j >= 0; j--) {    parity = 0;    for (i = 1; i <= e_row_weight[j]-1; i++)       parity += word[e_row_list[j][i]];    word[j] = parity % 2;  }}int parity_check_func(int *seq){  int i,j;  int flag,parity;  flag = 0;  for (i=0; i <= m-1; i++) {    parity = 0;    for (j=0; j <= row_weight[i]-1; j++)       parity = (parity + seq[row_list[i][j]]) % 2;    if (parity == 1) flag = -1;  }  return flag;}void print_spmat(){  int i,j;  printf("----------------------\n");  printf("%d %d\n",n,m);  printf("%d %d\n",rmax,cmax);  for (i=0;i<=m-1;i++) {    for (j=0;j<=row_weight[i]-1;j++) printf("%d ",row_list[i][j]);    printf("\n");  }  for (i=0;i<=n-1;i++) printf("%d",punc_ptn[i]);  printf("\n");}/**********************************************************************************/// functions for quantized BP algorithm/**********************************************************************************/double nrnd(double var)				// gaussian random number generator{  static int sw = 0;  static double r1, r2, s;  if (sw == 0) {    sw = 1;    do {      r1 = 2 * drand48() - 1;      r2 = 2 * drand48() - 1;      s = r1 * r1 + r2 * r2;    } while (s > 1 || s == 0);    s = sqrt(-2 * log(s) / s);    return r1 * s * sqrt(var);  } else {    sw = 0;    return r2 * s * sqrt(var);  }}int quantize(double v){  int idx;  if (v >= DELTA/2.0) idx = (int)floor(v/DELTA + 0.5);  if (v <= -DELTA/2.0) idx = (int)ceil(v/DELTA - 0.5);  if ((v < DELTA/2.0) && (v > -DELTA/2.0)) idx = 0;  if (v > UB2*DELTA) idx = UB2;  if (v < LB2*DELTA) idx = LB2;  return idx;}int quantized_BP(double *llr) {  int i,j,k;  int sum;  int loop;  int posterior;  int a,b;  int flag,parity,ret;  int beta_tmp;  int rwm1;				// initialization of alpha  for (i=0; i <= m-1; i++) {    for (j=0; j <= row_weight[i]-1; j++) {      alpha[i][j] = 0;    }  }  for (i = 0; i <= n-1; i++) qLLR[i] = quantize(llr[i]);  ret = -1;  for (loop = 0; loop <= max_itr-1; loop++) { // start of iteration     				// variable node operation    for (i = 0; i <= n-1; i++) {      sum = 0;      for (k = 0; k <= col_weight[i]-1; k++) 	sum += alpha[col_list_r[i][k]][col_list_c[i][k]];      for (j = 0; j <= col_weight[i]-1; j++) {		if (punc_ptn[i] == 0) 	  beta_tmp = qLLR[i] + sum-alpha[col_list_r[i][j]][col_list_c[i][j]];	else 	  beta_tmp = sum-alpha[col_list_r[i][j]][col_list_c[i][j]];	if ((minsum == ON) && (norm_factor > 0.0)) 	  beta_tmp = quantize((double)beta_tmp * DELTA/norm_factor);	if (beta_tmp < LB2) beta_tmp = LB2;	if (beta_tmp > UB2) beta_tmp = UB2;	beta[col_list_r[i][j]][col_list_c[i][j]] = beta_tmp;      }			      if (punc_ptn[i] == 0) 	posterior = qLLR[i] + sum;      else 	posterior = sum;#ifdef TEST1      printf("%f ",posterior * DELTA);#endif      if (posterior > 0) tmp_bit[i] = 0;      if (posterior < 0) tmp_bit[i] = 1;      if (posterior == 0) {	if (drand48() < 0.5) tmp_bit[i] = 0;	else tmp_bit[i] = 1;      }    }				#ifdef TEST1    printf("\n");#endif 				// check node operation (using table lookup)    for (i = 0; i <= m-1; i++) {       rwm1 = row_weight[i]-1;				// foward computation      for (k = 0; k <= rwm1; k++) { 	if (k == 0) {	  a = beta[i][k];	}	else {	  b = beta[i][k];	  a = R_tbl[a+UB][b+UB];	}	forward[k] = a;      }				// backward computation      for (k = rwm1; k >= 0 ; k--) { 	if (k == rwm1) {	  a = beta[i][k];	}	else {	  b = beta[i][k];	  a = R_tbl[a+UB][b+UB];	}	backward[k] = a;      }				// update of alpha       for (k = 0; k <= rwm1; k++) { 	if (k == 0) alpha[i][k] = backward[1];	else if (k == rwm1) alpha[i][k] = forward[rwm1-1];	else alpha[i][k] = R_tbl[forward[k-1]+UB][backward[k+1]+UB];      }    }							/* parity check */    if (parity_check == ON) {      flag = 0;      for (i=0; i <= m-1; i++) {	parity = 0;	for (j=0; j <= row_weight[i]-1; j++) 	  parity = (parity + tmp_bit[row_list[i][j]]);	if (parity % 2 == 1) flag = 1;      }      if (flag == 0) {	ret = 0;	break;      }    }  }	

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲v精品v日韩v欧美v专区| 久久亚洲私人国产精品va媚药| 中文字幕欧美三区| 国产精品亚洲成人| 国产欧美日韩视频在线观看| 风流少妇一区二区| 亚洲视频一区在线观看| 欧美亚洲一区三区| 爽爽淫人综合网网站| 日韩欧美久久一区| 丁香六月综合激情| 亚洲人精品一区| 欧美精选一区二区| 久久99国产精品免费| 久久久精品人体av艺术| 91麻豆免费看| 日韩精品一二三四| 久久精品视频一区| 99免费精品在线观看| 亚洲v日本v欧美v久久精品| 欧美一级高清片| av不卡在线观看| 日本一不卡视频| 国产精品久久久久久久久免费丝袜 | 午夜精品123| 日韩三级免费观看| 99久久99久久久精品齐齐| 亚州成人在线电影| 国产亚洲一区二区在线观看| 色8久久精品久久久久久蜜| 日本一不卡视频| 亚洲精品中文在线观看| 欧美成人精品1314www| 91伊人久久大香线蕉| 蜜桃av一区二区| 成人欧美一区二区三区在线播放| 欧美伦理视频网站| 99久久久无码国产精品| 青青草国产精品97视觉盛宴| 国产精品久久久久影院| 欧美一级电影网站| 欧美专区亚洲专区| 成人av在线资源| 精品亚洲免费视频| 亚洲成人精品在线观看| 国产精品久久久久天堂| 日韩视频一区二区在线观看| 在线视频一区二区免费| 国产成人av福利| 久久成人免费电影| 亚洲va天堂va国产va久| 最好看的中文字幕久久| 久久久久99精品国产片| 一区二区久久久| 国产亚洲短视频| 欧美tickle裸体挠脚心vk| 欧美日韩精品一区二区三区四区 | 色偷偷88欧美精品久久久| 国产美女精品人人做人人爽| 日本一不卡视频| 偷拍与自拍一区| 亚洲大片精品永久免费| 亚洲欧美一区二区久久 | 亚洲精品国产一区二区三区四区在线| 精品伦理精品一区| 日韩视频中午一区| 这里只有精品电影| 欧美精品一级二级三级| 欧美伊人久久大香线蕉综合69| www.亚洲人| 99久久精品免费| 成人午夜视频网站| 成人午夜视频免费看| 成人小视频在线| eeuss国产一区二区三区| 国产成人8x视频一区二区| 国产99久久久精品| 不卡在线视频中文字幕| 成人激情动漫在线观看| av男人天堂一区| 99久久国产综合色|国产精品| 丁香激情综合五月| 91视频观看视频| 色婷婷精品大在线视频| 91国产成人在线| 色女孩综合影院| 欧美日韩精品一区二区| 这里只有精品免费| 日韩欧美专区在线| 国产亚洲精品7777| 亚洲欧洲国产日本综合| 亚洲永久精品大片| 喷水一区二区三区| 国产成人亚洲综合a∨婷婷| 波多野结衣亚洲| 欧美网站大全在线观看| 日韩欧美成人一区二区| 久久精品综合网| 亚洲欧洲精品一区二区三区不卡| 亚洲欧美色综合| 午夜成人在线视频| 国产一区二区三区在线观看免费 | 一区二区三区欧美久久| 亚洲成人av一区二区| 奇米精品一区二区三区四区| 国产成人免费在线| 99久久精品免费| 欧美一区二区三区视频| 久久久精品黄色| 亚洲人成网站精品片在线观看| 亚洲国产wwwccc36天堂| 久99久精品视频免费观看| 不卡高清视频专区| 91精品婷婷国产综合久久| 喷水一区二区三区| 9色porny自拍视频一区二区| 欧美三区免费完整视频在线观看| 欧美一区二区三区四区高清| 国产精品久久久久国产精品日日| 亚洲国产精品久久人人爱蜜臀| 国模娜娜一区二区三区| 在线日韩一区二区| 国产亚洲一区二区三区四区| 一区二区三区在线观看国产| 极品少妇xxxx精品少妇| 色婷婷精品久久二区二区蜜臂av | 欧美日韩精品欧美日韩精品一| 精品国产制服丝袜高跟| 亚洲一区二区三区在线看| 国产99久久久国产精品潘金| 91精品一区二区三区久久久久久 | 日本精品视频一区二区| www国产精品av| 亚洲国产aⅴ成人精品无吗| 国产91对白在线观看九色| 51久久夜色精品国产麻豆| 国产精品不卡视频| 九九热在线视频观看这里只有精品| 99精品视频中文字幕| 国产亚洲欧美日韩日本| 麻豆一区二区在线| 欧美日韩dvd在线观看| 亚洲精品v日韩精品| 成人一道本在线| 精品国产露脸精彩对白| 天天av天天翘天天综合网 | 石原莉奈在线亚洲二区| 91捆绑美女网站| 欧美国产视频在线| 黄色日韩三级电影| 日韩一区二区免费视频| 日韩高清一区二区| 欧美日韩高清一区二区不卡| 亚洲人成影院在线观看| zzijzzij亚洲日本少妇熟睡| 国产欧美日韩麻豆91| 国产一区二区在线电影| 欧美电视剧免费观看| 青青草国产成人99久久| 欧美精品一级二级三级| 天天综合色天天综合| 一区二区三区在线影院| 91免费看`日韩一区二区| 中文字幕一区二区三区不卡在线| 国产一区不卡精品| 精品99一区二区| 久久99精品一区二区三区三区| 欧美精品久久天天躁| 日韩av中文字幕一区二区三区| 欧美日韩三级视频| 天天综合日日夜夜精品| 这里是久久伊人| 久久99精品视频| 久久综合一区二区| 国产精品2024| 亚洲欧洲精品天堂一级| 在线免费精品视频| 午夜精品免费在线| 日韩你懂的在线播放| 久草在线在线精品观看| 国产日韩欧美不卡| 91免费国产在线观看| 亚洲成人av在线电影| 日韩欧美视频一区| 福利一区二区在线| 亚洲一区日韩精品中文字幕| 4438x亚洲最大成人网| 久久er99精品| 亚洲图片你懂的| 欧美久久久久久久久久| 国产精品资源在线看| 亚洲欧洲色图综合| 欧美高清视频一二三区 | 日本欧美一区二区三区| 久久久五月婷婷| 91久久香蕉国产日韩欧美9色| 亚洲6080在线| 国产女同互慰高潮91漫画| 91黄视频在线| 久久激情五月激情|