Skip to content

Commit f4558ea

Browse files
author
Christian Häger
committed
initial upload
1 parent 8977652 commit f4558ea

20 files changed

+796
-3
lines changed

DensE/DE_base.m

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
classdef DE_base < handle
2+
properties
3+
channel % DE_channel
4+
scheme % DE_scheme
5+
precision % for threshold computation
6+
end
7+
8+
properties(Access = private)
9+
max_iterations
10+
target_error_rate
11+
end
12+
13+
methods
14+
function obj = DE_base(p_channel, p_scheme, p_max_iterations, p_target_error_rate)
15+
obj.channel = p_channel;
16+
obj.scheme = p_scheme;
17+
obj.max_iterations = p_max_iterations;
18+
obj.target_error_rate = p_target_error_rate;
19+
obj.precision = p_channel.default_precision; % default precision from the channel
20+
disp(['threshold is determined with precision: obj.precision = ' num2str(obj.precision)]);
21+
22+
% passing functionalities to the ensemble object
23+
obj.scheme.set_max_iterations(obj.max_iterations);
24+
obj.scheme.set_target_error_rate(p_target_error_rate);
25+
obj.scheme.set_channel(p_channel);
26+
end
27+
28+
function threshold = find_threshold(obj)
29+
% Find the approximate treshold via bisection method (binary search)
30+
31+
% initial search range
32+
channel_param_lb = obj.channel.channel_param_lb;
33+
channel_param_ub = obj.channel.channel_param_ub;
34+
higher_is_better = obj.channel.higher_is_better;
35+
36+
if(channel_param_lb >= channel_param_ub)
37+
error('Lower bound has to be strictly lower than upper bound');
38+
end
39+
40+
if(higher_is_better)
41+
% higher ChannelParameter is better (e.g., SNR)
42+
while(1)
43+
channel_param_test = channel_param_lb+(channel_param_ub-channel_param_lb)/2;
44+
success = obj.scheme.density_evolution(channel_param_test);
45+
46+
if(success)
47+
channel_param_ub = channel_param_test;
48+
else
49+
channel_param_lb = channel_param_test;
50+
end
51+
52+
if(channel_param_ub - channel_param_lb < obj.precision)
53+
threshold = ceil(channel_param_ub/obj.precision)*obj.precision;
54+
if(obj.scheme.density_evolution(threshold-obj.precision))
55+
threshold = threshold - obj.precision;
56+
end
57+
break;
58+
end
59+
end % while
60+
else
61+
% lower ChannelParameter is better (e.g., erasure prob.)
62+
while(1)
63+
channel_param_test = channel_param_lb+(channel_param_ub-channel_param_lb)/2;
64+
success = obj.scheme.density_evolution(channel_param_test);
65+
66+
if(success)
67+
channel_param_lb = channel_param_test;
68+
else
69+
channel_param_ub = channel_param_test;
70+
end
71+
72+
if(channel_param_ub - channel_param_lb < obj.precision)
73+
threshold = floor(channel_param_lb/obj.precision)*obj.precision;
74+
if(obj.scheme.density_evolution(threshold+obj.precision))
75+
threshold = threshold + obj.precision;
76+
end
77+
break;
78+
end
79+
end % while
80+
end
81+
end % find_threshold
82+
83+
function pe = get_final_error_rate(obj, channel_parameter_range)
84+
85+
pe = zeros(size(channel_parameter_range));
86+
87+
for i = 1:length(pe)
88+
obj.scheme.density_evolution(channel_parameter_range(i));
89+
pe(i) = obj.scheme.get_finalErrProb();
90+
end
91+
end
92+
93+
function iter = required_iterations(obj, channel_parameter_range)
94+
% Compute the required number of iterations to achieve the target
95+
% error rate
96+
97+
iter = zeros(size(channel_parameter_range));
98+
99+
for i = 1:length(iter)
100+
% do bisection search
101+
iter_lb = 1;
102+
iter_ub = obj.max_iterations;
103+
104+
while(1)
105+
iter_test = round(iter_lb + (iter_ub-iter_lb)/2);
106+
107+
obj.scheme.set_max_iterations(iter_test);
108+
obj.scheme.density_evolution(channel_parameter_range(i));
109+
pe = obj.scheme.get_finalErrProb();
110+
111+
if(pe > obj.target_error_rate)
112+
iter_lb = iter_test;
113+
else
114+
iter_ub = iter_test;
115+
end
116+
117+
if(iter_ub - iter_lb <= 1)
118+
iter(i) = iter_ub;
119+
break;
120+
end
121+
end
122+
end
123+
124+
end
125+
end
126+
end

DensE/DE_channel.m

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
classdef DE_channel < handle
2+
properties
3+
channel_param_lb
4+
channel_param_ub
5+
higher_is_better
6+
default_precision
7+
end
8+
9+
methods
10+
%
11+
end
12+
end

DensE/DE_channel_gpc_bec.m

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
classdef DE_channel_gpc_bec < DE_channel
2+
% high-rate binary erasure channel (BEC) for analyzing
3+
% deterministic generalized product codes
4+
% parametrized by c, where p = c/n is the erasure-correcting capability
5+
% and n is the component code length
6+
7+
methods
8+
function obj = DE_channel_gpc_bec()
9+
obj.channel_param_lb = 1;
10+
obj.channel_param_ub = 100;
11+
obj.higher_is_better = 0;
12+
obj.default_precision = 0.01;
13+
end
14+
end
15+
end

DensE/DE_det_gpc.m

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
classdef DE_det_gpc < handle
2+
properties
3+
L % number of positions
4+
eta % position connectivity matrix
5+
gamma % relative number of component codes at the positions
6+
tau % error-correcting capabilities
7+
8+
% derived parameters
9+
Lp % number of bit positions
10+
BitPosInd %
11+
end
12+
13+
methods
14+
function obj = DE_det_gpc()
15+
%
16+
end
17+
18+
function set_derived_parameters(obj)
19+
obj.Lp = sum(sum(tril(obj.eta)));
20+
obj.BitPosInd = find(tril(obj.eta));
21+
end
22+
end
23+
end

DensE/DE_half_product_code.m

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
classdef DE_half_product_code < DE_det_gpc
2+
methods
3+
function obj = DE_half_product_code(t)
4+
% t : erasure-correcting capability of the component codes
5+
6+
obj.eta = 1;
7+
obj.L = 1;
8+
obj.gamma = 1;
9+
obj.tau{1} = [t; 1];
10+
end
11+
end
12+
end

DensE/DE_product_code.m

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
classdef DE_product_code < DE_det_gpc
2+
methods
3+
function obj = DE_product_code(t)
4+
% t : erasure-correcting capability of the component codes;
5+
% can also be a length-2 vector to specify row/column codes
6+
% separately
7+
8+
obj.eta = [0 1; 1 0];
9+
obj.L = 2;
10+
obj.gamma = [1 1];
11+
12+
if(length(t) == 1)
13+
obj.tau{1} = [t; 1];
14+
obj.tau{2} = [t; 1];
15+
elseif(length(t) == 2)
16+
obj.tau{1} = [t(1); 1];
17+
obj.tau{2} = [t(2); 1];
18+
else
19+
error('DE_product_code: length of input argument should be 1 or 2')
20+
end
21+
end
22+
23+
function schedule = get_rowcolumn_schedule(obj, max_iterations)
24+
% max_iter : maximum number of decoding iterations;
25+
% 1 iterations corresponds to 2 half-iterations (row+column
26+
% decoding)
27+
28+
schedule = cell(2*max_iterations, 2); % first col: active
29+
30+
for i = 1:max_iterations
31+
schedule{2*i-1, 1} = 1;
32+
schedule{2*i-1, 2} = 2;
33+
schedule{2*i, 1} = 2;
34+
schedule{2*i, 2} = 1;
35+
end
36+
end
37+
end
38+
end
39+

DensE/DE_scheme.m

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
classdef DE_scheme < handle
2+
properties
3+
channel
4+
5+
% copied / initialized by DE_base
6+
max_iterations % maximum number of iterations
7+
target_error_rate % target error probability
8+
9+
% information about the last density evolution that was run
10+
errProb_avg % vector of length maxIter+1
11+
errProb % matrix (maxIter+1) rows, columns depends on VN types
12+
nIter % number of iterations until target error probability was reached
13+
end
14+
15+
methods
16+
function set_max_iterations(obj, p_max_iterations)
17+
obj.max_iterations = p_max_iterations;
18+
obj.errProb_avg = zeros(p_max_iterations+1, 1);
19+
end
20+
21+
function set_target_error_rate(obj, p_target_error_rate)
22+
obj.target_error_rate = p_target_error_rate;
23+
end
24+
25+
function set_channel(obj, p_channel)
26+
obj.channel = p_channel;
27+
end
28+
29+
function tmp = get_finalErrProb(obj)
30+
% nIter = 0 -> uncoded
31+
% nIter = 1 -> after one iteration
32+
tmp = mean(obj.errProb_avg(obj.nIter+1, :));
33+
end
34+
end
35+
end

0 commit comments

Comments
 (0)