awgn.h

来自「根据LDPC码中码子的构造方法中的PEG算法」· C头文件 代码 · 共 62 行

H
62
字号
/*************************************** * * Random value generator for AWGN *  * based on I[j+1] = a*I[j] mod m * Since it is not possible to implement this iteration * directly (the product a*I may exceed the maximum value * of a 32-bit integer) Schrage's algorithm is used  * (see Numerical Recipes in C, p.278ff.) * * (for simulation results and goodness of this *  random generator, see ~/svensson/dani/matlab/results/noise.m) * ***************************************/#ifndef AWGNH#define AWGNH#define IA 16807#define IM 2147483647 // 2^31 - 1#define AM (1.0/IM);#define IQ 127773#define IR 2836#define NTAB 32#define NDIV (1+(IM-1)/NTAB)#define EPSI 1.2e-7#define RNMX (1.0-EPSI)#define NOV 1000000 // number of values that are generated at randomclass AWGN {public:  // constructor  AWGN(long seed = 1, double sigma = 1);  // set the standard deviation of this random variable  void setSigma(double sigma);  // get a random value  double nextValue(void);  // get the seed  long getSeed(void);  // test method  static void test(void);private:  long seed;  double sigma;  long iy;  long iv[NTAB];  int iset;  double gset;  double random(long *idum);}; #endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?