This program simulates the performance of LDPC codes on the AWGN channel. Since the channel is symmetric, the zero codeword is used.
#include <sstream>
using namespace std;
using namespace itpp;
int main(int argc, char **argv)
{
  if (argc < 2) {
    it_info(
"Usage: " << argv[0] << 
" codec_file.it [EbN0_dB]");
 
    return 1;
  }
  int64_t Nbits = 5000000000LL; 
                                
  int Nbers = 2000;            
  double BERmin = 1e-6;        
  vec EbN0db = "0.6:0.2:5";
  bool single_snr_mode = false;
  if (argc == 3) {
    istringstream ss(argv[2]);
    double x;
    ss >> x;
    EbN0db = x;
    single_snr_mode = true;
  }
  cout << "Running with Eb/N0: " << EbN0db << endl;
  
  C.set_exit_conditions(2500);
  
  
  cout << C << endl;
  int N = C.get_nvar();             
  for (
int j = 0; j < 
length(EbN0db); j++) {
 
    
    double N0 = 
pow(10.0, -EbN0db(j) / 10.0) / C.get_rate();
 
    for (int64_t i = 0; i < Nbits; i += C.get_nvar()) {
      
      vec x = chan(s);
      
      
      QLLRvec llr;
      C.bp_decode(C.get_llrcalc().to_qllr(softbits), llr);
      bvec bitsout = llr < 0;
      
      
      berc.
count(bitsin, bitsout);
      ferc.
count(bitsin, bitsout);
      if (single_snr_mode) {
        cout << "Eb/N0 = " << EbN0db(j) << "  Simulated "
             << 
"Obtained " << berc.
get_errors() << 
" bit errors. "      }
      else {
          break;
      }
    }
    cout << "Eb/N0 = " << EbN0db(j) << "  Simulated "
         << 
"Obtained " << berc.
get_errors() << 
" bit errors. "      break;
  }
  return 0;
}
  To simulate the code "RU_10000.it" over a range of SNR (see Generation of LDPC codes for how to generate codec) 
./ldpc_bersim_awgn RU_10000.it
To simulate at Eb/N0=1.1 dB 
./ldpc_bersim_awgn RU_10000.it 1.1