📄 parameter_sets.h
字号:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <math.h>
///////////////////////////////////////////////////////////////////////////////
// Define consts here below
//#define DEBUG
#define DP1
//#define DP2
///////////////////////////////////////////////////////////////////////////////
// Define structs here below
struct Complex
{
double real;
double imag;
};
struct LinkNode
{
int rowIdx;
int colIdx;
double rMsg[2];
double qMsg[2];
struct LinkNode * rowPtr;
struct LinkNode * colPtr;
};
struct BasicParaS
{
int codeK; // K parameter, number of info bits
int codeN; // N parameter, length of code words
int codeM; // M parameter, number of check bits
double r; //码率的倒数
int basicH[12][24];
int expandedH[12][24];
int typeModu; //调制方式
int typeDecode; //译码方式
int maxIter; //译码器的最大迭代次数
int noiseMode; //Eb/No或SNR
// int numFrames; //
float Eb_No[20]; //每个Eb/No的值
int nFrames[20]; //每个点的帧数
int numModuOut;
int bitsPerSym;
int numCols; // numCols is the number of columns of base H matrix
int numRows; // numRows is the number of rows of base H matrix
int numInBits; // numInBits is the number of input bits of encoder including padding bits
int numOutBits; // numOutBits is the number of output bits of encoder including tail bits
int numVar; // number of variables, equal to the numInBits
int numChk; // number of checks, equal to the (numOutBits-numInBits)
int zfactor; // Z parameter, expansion factor
struct LinkNode * * rowLink;
struct LinkNode * * colLink;
int maxRetrans; //The maximum number of retransmissions
int codeType;
int typeH;
int numSymOut;
int totalNumFrames;
double numIter; //迭代总次数
};
///////////////////////////////////////////////////////////////////////////////
// List the declarations of functions here below
int DispInitParaF(struct BasicParaS * ctrl);
int LoadBasicMatrixF(struct BasicParaS * ctrl);
int ExpandMatrixF(struct BasicParaS * ctrl);
int * GenerateInputF(struct BasicParaS * ctrl);
int * EncodingF(struct BasicParaS * ctrl, int * input, int numRetrans);
struct Complex * ModulatingF(struct BasicParaS * ctrl, int * input, int numRetrans);
int ChanAwgnF(struct BasicParaS * ctrl, struct Complex * input, double Eb_No_dB);
double * DemodulatingF (struct BasicParaS * ctrl, struct Complex * input, double Eb_No_dB);
int SumProductF(struct BasicParaS * ctrl, double * prob1);
int LogSumProductF(struct BasicParaS * ctrl, double * c);
int MinSumF(struct BasicParaS * ctrl, double * c);
int DecodingF(struct BasicParaS * ctrl, double * input);
double * Updating1F(struct BasicParaS * ctrl, double * input);
double * Updating2F(struct BasicParaS * ctrl, double * input1, double * input2, int numRetrans);
double * UpdatingF(struct BasicParaS * ctrl, double * input1, double * input2, int numRetrans);
int * DecidingF(struct BasicParaS * ctrl, double * input);
double CountBerF(struct BasicParaS * ctrl, int * input, int * output);
int ExportOutputF(struct BasicParaS * ctrl, double ber,double fer,double throughput, double Eb_No_dB);
//int CalcZfactorF(int K, int N) ;
double logcothsemi(double x);
int MaxLogDeMap(int start, int length, double symbol, double * llr);
//int ResumeBitsF(struct BasicParaS * ctrl, double * input, double * output);
double random();
double generate_random_source();
short generate_binary_source();
double AWGN(double sigma2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -