9 string path =
"/home/mbkitine/Dropbox/Lulea/GRC/DeepSpace/gr-ccsds/examples/LDPC/ldpc_2/";
14 for(
unsigned int i = 0; i < row.size(); i++)
16 std::cout << row[i] <<
" " ;
18 std::cout << std::endl;
22 int R = parity.size();
23 int C = parity.at(0).size();
24 std::cout <<
"Parity matrix size : " << R <<
" X " << C << std::endl;
25 for(
int r = 0 ; r < R; r++)
34 std::vector<T>
getCol(std::vector< std::vector<T> > mat2D,
int index)
37 for(
unsigned int i = 0; i < mat2D.size(); i++)
39 col.push_back(mat2D[i][index]);
45 std::vector<T>
getRow(std::vector< std::vector<T> > mat2D,
int index)
52 std::vector<double> lq = node.
getLq();
53 for(
unsigned int i = 0; i < lq.size(); i++)
55 std::cout <<
"Lq(" << i <<
") = " << lq[i] <<
" ";
57 std::cout << std::endl;
62 std::vector<double> lq = node.
getLq();
63 for(
unsigned int i = 0; i < lq.size(); i++)
65 std::cout <<
"Lq(" << i <<
") = " << lq[i] <<
" ";
67 std::cout << std::endl;
72 std::vector<double> lr = node.
getLr();
73 for(
unsigned int i = 0; i < lr.size(); i++)
75 std::cout <<
"Lr(" << i <<
") = " << lr[i] <<
" ";
77 std::cout << std::endl;
84 for(
unsigned int i = 0; i < v.size(); i++)
85 std::cout << v[i].getlogAPP() <<
" ";
86 std::cout <<
"]" << std::endl;
88 for(
unsigned int i = 0; i < v.size(); i++)
89 std::cout << ((v[i].getlogAPP() > 0) ? 0 : 1) <<
" ";
90 std::cout <<
"]" << std::endl;
92 std::vector< std::vector<int> >
readAlist(
string filename,
93 std::vector< std::vector<int> > &m_list,std::vector< std::vector<int> > &n_list)
95 filename =
path + filename;
96 std::cout <<
"File path : " << filename << std::endl;
97 alist myAlist(filename.c_str());
98 std::cout <<
"Alist file read" << std::endl;
99 std::vector< std::vector<char> > H = myAlist.
get_matrix();
100 std::cout <<
"alist matrix read" << std::endl;
101 std::vector< std::vector<int> > H_int;
105 std::cout <<
"Size of R : " << R << std::endl;
106 std::cout <<
"Size of C : " << C << std::endl;
107 for(
int r = 0; r < R; r++)
109 std::vector<int> row;
110 for(
int c = 0; c < C; c++)
114 row.push_back(
int(H[r][c]));
116 H_int.push_back(row);
119 m_list = myAlist.get_mlist();
120 n_list = myAlist.get_nlist();
136 const string filename =
"/home/mbkitine/Dropbox/Lulea/GRC/DeepSpace/gr-ccsds/examples/LDPC/ldpc_2/myParity";
137 ldpc myCode(filename);
139 std::vector<double> y1{+0.2, +0.2, -0.9, +0.6, +0.5, -1.1, -0.4, -1.2};
140 std::vector<double> logapp = myCode.
decode(y1,7,0.5);
141 for(
unsigned int i = 0; i < logapp.size(); i++)
142 std::cout << logapp[i] <<
" ";
143 std::cout << std::endl;
std::vector< double > getLq()
Definition: examples/LDPC/ldpc_2/ldpc_decoder/variablenode.h:21
void printVarNodeLq(variableNode node)
Definition: examples/LDPC/ldpc_2/ldpc_decoder/debug.h:50
Definition: examples/LDPC/ldpc_2/ldpc_decoder/variablenode.h:7
void printVarNodeLogAPP(std::vector< variableNode > v)
Definition: examples/LDPC/ldpc_2/ldpc_decoder/debug.h:80
void printChkNodeLr(checkNode node)
Definition: examples/LDPC/ldpc_2/ldpc_decoder/debug.h:70
Definition: examples/LDPC/ldpc_2/ldpc_decoder/alist.h:45
std::vector< std::vector< int > > readAlist(string filename, std::vector< std::vector< int > > &m_list, std::vector< std::vector< int > > &n_list)
Definition: examples/LDPC/ldpc_2/ldpc_decoder/debug.h:92
std::vector< std::vector< char > > get_matrix()
Returns the corresponding H matrix.
std::vector< double > decode(std::vector< double > softBits, int iterations, double sigma)
double getCodeRate()
Definition: examples/LDPC/ldpc_2/ldpc_decoder/ldpc.h:23
void printParity(std::vector< std::vector< int > > parity)
Definition: examples/LDPC/ldpc_2/ldpc_decoder/debug.h:20
void ldpcTDD()
Definition: examples/LDPC/ldpc_2/ldpc_decoder/debug.h:134
Definition: examples/LDPC/ldpc_2/ldpc_decoder/ldpc.h:11
std::vector< T > getRow(std::vector< std::vector< T > > mat2D, int index)
Definition: examples/LDPC/ldpc_2/ldpc_decoder/debug.h:45
void printRow(std::vector< int > row)
Definition: examples/LDPC/ldpc_2/ldpc_decoder/debug.h:12
string path
Definition: examples/LDPC/ldpc_2/ldpc_decoder/debug.h:9
Definition: examples/LDPC/ldpc_2/ldpc_decoder/checknode.h:6
void printChkNodeLq(checkNode node)
Definition: examples/LDPC/ldpc_2/ldpc_decoder/debug.h:60
std::vector< double > getLq()
Definition: examples/LDPC/ldpc_2/ldpc_decoder/checknode.h:19
std::vector< T > getCol(std::vector< std::vector< T > > mat2D, int index)
Definition: examples/LDPC/ldpc_2/ldpc_decoder/debug.h:34