-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patherr_coeff.m
25 lines (24 loc) · 873 Bytes
/
err_coeff.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
% Polar Code Enumerator ###############################################################
%
% Copyright (c) 2021, Mohammad Rowshan
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without modification,
% are permitted provided that:
% the source code retains the above copyright notice, and te redistribtuion condition.
%
% Freely distributed for educational and research purposes
%######################################################################################
function [dmin, A_dmin] = err_coeff(I,N)
d = min(sum(dec2bin(I)-'0',2));
dmin = 2ˆd; n = log2(N); A_dmin = 0;
B = find(sum(dec2bin(I)-'0',2)==d);
for i = B'
Ki_size = n - d;
for x = find(dec2bin(I(i),n)-'0'==1)
ii = dec2bin(bitxor(N-1,I(i)),n)-'0';
Ki_size = Ki_size + sum(ii(1:x-1));
end
A_dmin = A_dmin + 2ˆKi_size;
end
end