⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 softdemodulator.c

📁 根据LDPC码中码子的构造方法中的PEG算法
💻 C
字号:
#define _1_DIV_SQRT_2PI 0.398942280//#define EPS 1e-10#include <math.h>#include <iostream.h>#include "SoftDemodulator.h"#include "Constant.h"SoftDemodulator::SoftDemodulator(double sigma, int isiSize) {  (*this).sigma = sigma;  factor1 = 1.0/sigma;  factor2 = factor1*factor1/2.0;  (*this).isiSize=isiSize;  isiAlphabet=new int [2];  isiAlphabet[0]=-1;  isiAlphabet[1]=1;}SoftDemodulator::~SoftDemodulator() {  delete [] isiAlphabet;}void SoftDemodulator::getProbabilities(const double *y, int length, double *(*prob)) {#ifdef SOFTDEMODULATOR_DEBUG  cout << "CHANNEL TRANSITION PROBABILITIES:\n";#endif  for (int i = 0; i < length; i++) {    for (int j = 0; j < isiSize; j++) {      double diff = y[i] - isiAlphabet[j];      prob[i][j] = _1_DIV_SQRT_2PI*factor1*exp(-(diff*diff)*factor2);      if (prob[i][j] < EPS) {	prob[i][j] = EPS;      }#ifdef SOFTDEMODULATOR_DEBUG      cout << prob[i][j] << "          ";#endif    }#ifdef SOFTDEMODULATOR_DEBUG    cout << "\n";#endif  }#ifdef SOFTDEMODULATOR_DEBUG  cout << "\n";#endif}void SoftDemodulator::setSigma(double sigma) {  (*this).sigma = sigma;  factor1 = 1.0/sigma;  factor2 = factor1*factor1/2.0;}

⌨️ 快捷键说明

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