GNU Radio C++ API Reference g90d26cb
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
alist.h
Go to the documentation of this file.
1#include "stdint.h"
2/* -*- c++ -*- */
3/*
4 * Copyright 2015 Free Software Foundation, Inc.
5 *
6 * This file is part of GNU Radio
7 *
8 * SPDX-License-Identifier: GPL-3.0-or-later
9 *
10 */
11
12/* -----------------------------------------------------------------
13 *
14 * This class handles sparse matrices specified in alist-format.
15 * For details about alist format please visit the link below.
16 * - http://www.inference.phy.cam.ac.uk/mackay/codes/alist.html
17 *
18 * Alist class is an efficient way of representing a sparse matrix
19 * the parity check matrix H of an LDPC code for instance.
20 *
21 */
22
23#ifndef ALIST_H
24#define ALIST_H
25
26#include <gnuradio/fec/api.h>
27#include <cstdint>
28#include <cstdlib>
29#include <fstream>
30#include <sstream>
31#include <vector>
32
34{
35public:
36 //! Default Constructor
37 alist() : data_ok(false) {}
38
39 //! Constructor which loads alist class from an alist-file
40 alist(const char* fname);
41
42 //! Read alist data from a file
43 void read(const char* fname);
44
45 //! Write alist data to a file
46 void write(const char* fname) const;
47
48 //! Returns N, the number of variable nodes
49 int get_N();
50
51 //! Return M, the number of check nodes
52 int get_M();
53
54 //! Return the m_list variable
56
57 //! Returns the n_list variable
59
60 //! Returns the num_mlist variable
62
63 //! Returns the num_nlist variable
65
66 //! Returns the max_num_nlist variable
68
69 //! Returns the max_num_mlist variable
71
72 //! Prints the nlist[i] variable
73 void print_nlist_i(int i);
74
75 //! Prints the mlist[i] variable
76 void print_mlist_i(int i);
77
78 //! Returns the corresponding H matrix
80
81protected:
82 //! A variable indicating if data has been read from alist-file
83 bool data_ok;
84
85 //! Number of variable nodes
86 int N;
87
88 //! Number of check nodes
89 int M;
90
91 //! Maximum weight of rows
93
94 //! Maximum weight of columns
96
97 //! Weight of each column n
99
100 //! Weight of each row m
102
103 //! List of integer coordinates along each rows with non-zero entries
105
106 //! List of integer coordinates along each column with non-zero entries
108};
109#endif // ifndef ALIST_H
Definition alist.h:34
std::vector< int > get_num_nlist()
Returns the num_nlist variable.
std::vector< int > num_nlist
Weight of each column n.
Definition alist.h:98
int get_M()
Return M, the number of check nodes.
std::vector< std::vector< int > > mlist
List of integer coordinates along each rows with non-zero entries.
Definition alist.h:104
std::vector< std::vector< uint8_t > > get_matrix()
Returns the corresponding H matrix.
int N
Number of variable nodes.
Definition alist.h:86
std::vector< int > num_mlist
Weight of each row m.
Definition alist.h:101
int M
Number of check nodes.
Definition alist.h:89
int max_num_nlist
Maximum weight of columns.
Definition alist.h:95
std::vector< std::vector< int > > get_nlist()
Returns the n_list variable.
alist(const char *fname)
Constructor which loads alist class from an alist-file.
void read(const char *fname)
Read alist data from a file.
std::vector< std::vector< int > > get_mlist()
Return the m_list variable.
int get_N()
Returns N, the number of variable nodes.
void write(const char *fname) const
Write alist data to a file.
std::vector< std::vector< int > > nlist
List of integer coordinates along each column with non-zero entries.
Definition alist.h:107
int max_num_mlist
Maximum weight of rows.
Definition alist.h:92
bool data_ok
A variable indicating if data has been read from alist-file.
Definition alist.h:83
int get_max_num_mlist()
Returns the max_num_mlist variable.
void print_mlist_i(int i)
Prints the mlist[i] variable.
alist()
Default Constructor.
Definition alist.h:37
void print_nlist_i(int i)
Prints the nlist[i] variable.
int get_max_num_nlist()
Returns the max_num_nlist variable.
std::vector< int > get_num_mlist()
Returns the num_mlist variable.
STL class.
Definition vector_docstub.h:11
#define FEC_API
Definition gr-fec/include/gnuradio/fec/api.h:18