GNU Radio C++ API Reference: alist.h Source File

| GNU Radio C++ API Reference 3.10.12.0 The Free & Open Software Radio Ecosystem |

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