MCPcopy Create free account
hub / github.com/aff3ct/aff3ct / get_trellis

Method get_trellis

src/Module/Encoder/RSC/Encoder_RSC_generic_json_sys.cpp:29–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28template<typename B>
29std::vector<std::vector<int>>
30Encoder_RSC_generic_json_sys<B>::get_trellis()
31{
32 std::vector<std::vector<int>> trellis(10, std::vector<int>(this->n_states));
33
34 std::vector<bool> occurrence(this->n_states, false);
35
36 for (auto i = 0; i < this->n_states; i++)
37 {
38 // sys = 0
39 auto state = i;
40 auto bit_sys = 0;
41 auto bit_par = Encoder_RSC_generic_sys<B>::inner_encode(bit_sys, state);
42
43 trellis[0 + (occurrence[state] ? 3 : 0)][state] = i; // initial state
44 trellis[1 + (occurrence[state] ? 3 : 0)][state] = +1; // gamma coeff
45 trellis[2 + (occurrence[state] ? 3 : 0)][state] = bit_sys ^ bit_par; // gamma
46 trellis[6][i] = state; // final state, bit syst = 0
47 trellis[7][i] = bit_sys ^ bit_par; // gamma , bit syst = 0
48
49 occurrence[state] = true;
50
51 // sys = 1
52 state = i;
53 bit_sys = 1;
54 bit_par = Encoder_RSC_generic_sys<B>::inner_encode(bit_sys, state);
55
56 trellis[0 + (occurrence[state] ? 3 : 0)][state] = i; // initial state
57 trellis[1 + (occurrence[state] ? 3 : 0)][state] = -1; // gamma coeff
58 trellis[2 + (occurrence[state] ? 3 : 0)][state] = bit_sys ^ bit_par; // gamma
59 trellis[8][i] = state; // initial state, bit syst = 1
60 trellis[9][i] = bit_sys ^ bit_par; // gamma , bit syst = 1
61
62 occurrence[state] = true;
63 }
64
65 return trellis;
66}
67
68template<typename B>
69int

Callers 1

inner_encodeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected