summaryrefslogtreecommitdiff
path: root/viterbi_generator/tests/utils/make_increment.m
blob: 91cc0ae60f583ef7b89e7157d1b28933467644cb (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
function [ INCREMENT ] = make_increment(SYMBOLS,NEXT,Rhh)
%
% MAKE_INCREMENT:
%           This function returns a lookuptable containing the
%           metric increments related to moving from state n to m.
%           The data is arranged so that the increment accosiated 
%           with a move from state n to m is located in 
%           INCREMENT(n,m). To minimize computations only legal
%           transitions are considdered.
%
% SYNTAX:   [ INCREMENT ] = make_increment(SYMBOLS,NEXT,Rhh)
%
% INPUT:    SYMBOLS: The table of symbols corresponding the the state-
%                    numbers.
%           NEXT:    A transition table containing the next legal
%                    states, as it is generated by the code make_next.
%           Rhh:     The autocorrelation as estimated by mf.m.
%
% OUTPUT:   INCREMENT:
%                    The increment table as described above.
%
% SUB_FUNC: None
%
% WARNINGS: There is no syntax checking on input or output.
%
% TEST(S):  By hand, against expected values.
%
% AUTOR:    Jan H. Mikkelsen / Arne Norre Ekstrøm
% EMAIL:    hmi@kom.auc.dk / aneks@kom.auc.dk
%
% $Id: make_increment.m,v 1.6 1997/09/22 11:39:34 aneks Exp $

% IN THIS PEACE OF CODE THE SYNTAX CHECKING IS MINIMAL
% THIS HAS BEEN CHOSEN TO AVOID THE OVERHEAD. RECALL THAT
% THIS CODE IS EXECUTED EACH TIME A BURST IS RECEIVED.

% FIND THE NUMBER OF SYMBOLS THAT WE HAVE
%
[M,Lh]=size(SYMBOLS);

% INITIALIZE THE INCREMENT MATRIX
%
INCREMENT=zeros(M);

% RECALL THAT THE I SEQUENCE AS IT IS STORED IN STORED AS:
% [ I(n-1) I(n-2) I(n-3) ... I(n-Lh) ]
%
% ALSO RECALL THAT Rhh IS STORED AS:
% [ Rhh(1) Rhh(2) Rhh(3) ... Rhh(Lh) ]
%
% THE FORMULA TO USE IS:
% INCREMENT(n,m)
% =
% real(conj(I(n))*(I(n-Lh)*Rhh(Lh)+I(n-Lh+1)*Rhh(Lh-1)+...+I(n-1)*Rhh(1))
%
% THEY CAN THUS BE MULTIPLIED DIRECTLY WITH EACH OTHER

% LOOP OVER THE STATES, AS FOUND IN THE ROWS IN SYMBOLS.
%
for n=1:M, 
  % ONLY TWO LEGAL NEXT STATES EXIST, SO THE LOOP IS UNROLLED
  %
  m=NEXT(n,1);

  INCREMENT(n,m)=real((conj(SYMBOLS(m,1))*SYMBOLS(n,:))*Rhh(2:Lh+1).');
  m=NEXT(n,2);

  INCREMENT(n,m)=real((conj(SYMBOLS(m,1))*SYMBOLS(n,:))*Rhh(2:Lh+1).');
end

personal git repositories of Harald Welte. Your mileage may vary