% L=dmin_init(nstates,ninput,trellis_transition,trellis_output,ndepth,dmin_ub) % Initialize list L with information about states. nstates are the % number of trellis states, ninput are the number of input bits, % and trellis_transition, trellis_output are determined from the % trellis description. ndepth is the distance depth, and dmin_ub is % some finite upper bound for the minimum distance. % The list is modelled as a matrix, where each row represents a state. % The columns correspondingly represent the quantities of minimum % distance, number of minimum distance (and subsequent) paths, % and number of bits corresponding to the number of minimum distance (and % subsequent) paths. % % George Ginis, May 2001 function L=... dmin_init(nstates,ninput,trellis_transition,trellis_output,ndepth,dmin_ub) % initialize matrix keeping information about states L=zeros(nstates,1+2*(ndepth+1)); L(:,1)=dmin_ub*ones(size(L,1),1); % initialize distances to the upper bound value % assuming that the initial state is 1, iterate for all possible inputs for m=1:2^ninput % produce all possible output states and output values [st(m) out(m)] = trellis_fn(1,m-1,trellis_transition,trellis_output); end for m=2:2^ninput % iterate for all possible inputs resulting in divergence % compute distance between path leading to state st(m) and 0 path dp=bdistance(out(m),out(1)); % compute number of differing bits between the path ending at % state st(m) and the "top" path Nbp=bdistance(m-1,0); % set up polynomial with neighbors information poly_neighb = zeros(1,ndepth+2); poly_neighb(1) = dp; poly_neighb(2) = 1; % update matrix with neighbors information for target state L(st(m),1:ndepth+2) = ... polyadd( L(st(m),1:ndepth+2), poly_neighb(1:ndepth+2) ); % set up polynomial with bits information poly_bits = zeros(1,ndepth+2); poly_bits(1) = dp; poly_bits(2) = Nbp; % update matrix with bits information for target state poly_bits_add = polyadd( ... [L(st(m),1) L(st(m),ndepth+3:2*ndepth+3)] , poly_bits(1:ndepth+2) ); L(st(m),ndepth+3:2*ndepth+3) = poly_bits_add(2:ndepth+2); end