image thumbnail

Channel Noise Estimation Using Particle based Belief Propagation for LDPC decoding in AWGN and BSC

by

 

Channel Noise Estimation Using Particle based Belief Propagation for LDPC decoding in AWGN and BSC

test_Java_beta_invGamma_Distribution.m
% Authors:
% 
% Shuang Wang, Lijuan Cui and Samuel Cheng
% 
% Copyright:
% 
% Copyright ? 2007-2011 Shuang Wang
% 
% Questions:
% 
% For any questions, please contact me by shuangwang AT ou dot edu
%
% reference
%  L. Cui, S. Wang, S. Cheng, M. Yeary, "Adaptive Binary Slepian-Wolf Decoding using Particle Based Belief Propagation", Communications, IEEE Transactions on, to appear.
%  S. Wang, L. Cui, S. Cheng, Y. Zhai, M. Yeary, Q. Wu, "Noise Adaptive LDPC Decoding Using Particle Filtering," Communications, IEEE Transactions on, Vol 59. pp. 913 - 916, April 2011.
%
close all; warning off all; clearvars; % clear java; 
clear import; warning on; %#ok<WNON>   % clear java;
clear import; warning off all;
addMyPath_PBP();
p = mfilename('fullpath'); p = p(1:numel(p)-numel(mfilename)); cd(p);
if(strcmp(getenv('OS'), 'Windows_NT'))   
    javarmpath('..\JavaBPForMatlab\JavaBPForMatlab\dist\JavaBPForMatlab.jar');
    javarmpath('.\JavaPBPForMatlab\dist\JavaPBPForMatlab.jar');
else    
    javarmpath('../JavaBPForMatlab/JavaBPForMatlab/dist/JavaBPForMatlab.jar');
    javarmpath('./JavaPBPForMatlab/dist/JavaPBPForMatlab.jar');
end
warning on;  %#ok<WNON>

if( matlabpool('size') == 0)
    matlabpool;
end

if(strcmp(getenv('OS'), 'Windows_NT'))
    pegFile = '..\JavaBPForMatlab\PCHK\Reg3_6_10000.dat';
    initializeJava('..\JavaBPForMatlab\JavaBPForMatlab\dist\JavaBPForMatlab.jar');
    initializeJava('.\JavaPBPForMatlab\dist\JavaPBPForMatlab.jar');
else
    pegFile = '../JavaBPForMatlab/PCHK/Reg3_6_10000.dat';
    initializeJava('./JavaPBPForMatlab/dist/JavaPBPForMatlab.jar');
end


% test small x a b
x = [0:0.001:1]';
a = [1: 0.5: 3000];
b = [1: 0.5: 3000];

for a1 = a
    a1
    for b1 = b
        y1 = betapdf(x, a1, b1);
        y2 = javapbpformatlab.MyMath.betapdf(x, a1, b1);
        dist = sum(abs(y1 - y2));
        assert( dist < 1e-6, sprintf('dist: %e; a = %f, b = %f', dist, a1, b1));
    end
end

% test small x a b
x = [0.001:0.001:4]';
a = [1: 0.5: 3000];
b = [1: 0.5: 3000];

for a1 = 1:numel(a)
    a1
    for b1 = b
        y1 = invgampdf(x, a(a1), b1);
        y2 = javapbpformatlab.MyMath.invgampdf(x, a(a1), b1);
        dist = sum(abs(y1 - y2));
        assert( dist < 1e-7, sprintf('dist: %e; a = %f, b = %f', dist, a(a1), b1));
    end
end

Contact us