GNU Radio Manual and C++ API Reference 3.7.14.0
The Free & Open Software Radio Ecosystem
ldpc_H_matrix.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2015 Free Software Foundation, Inc.
4 *
5 * This is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published
7 * by the Free Software Foundation; either version 3, or (at your
8 * option) any later version.
9 *
10 * This software is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this software; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street,
18 * Boston, MA 02110-1301, USA.
19 */
20
21#ifndef INCLUDED_ldpc_H_matrix_H
22#define INCLUDED_ldpc_H_matrix_H
23
24#include <gnuradio/fec/api.h>
26#include <boost/enable_shared_from_this.hpp>
27#include <boost/shared_ptr.hpp>
28
29namespace gr {
30namespace fec {
31namespace code {
32/*!
33 * \brief Parity check matrix in Richardson/Urbanke format
34 * \ingroup error_coding_blk
35 *
36 * \details
37 * This class stores a matrix for use with the
38 * ldpc_encoder class. It must be of the specific format
39 * described by Richardson and Urbanke in Appendix A of their
40 * book: Modern Coding Theory (ISBN 978-0-521-85229-6). The
41 * form is:
42 * \f[\left[\begin{array}{ccc} T & A & B\\ E & C & D \end{array}\right]\f]
43 * This class can be used with the ldpc_bit_flip_decoder.
44 *
45 * To convert a parity check matrix to this format, use the
46 * python functions in:
47 * /lib/python2.7/dist-packages/gnuradio/fec/LDPC/Generate_LDPC_matrix.py.
48 */
49class FEC_API ldpc_H_matrix : virtual public fec_mtrx,
50 public boost::enable_shared_from_this<ldpc_H_matrix>
51{
52public:
53 typedef boost::shared_ptr<ldpc_H_matrix> sptr;
54
55 /*!
56 * \brief Constructor given alist file and gap
57 * \param filename Name of an alist file to use. The alist
58 * format is described at:
59 * http://www.inference.phy.cam.ac.uk/mackay/codes/alist.html
60 * \param gap A property of the matrix being used. For alist
61 * files distributed with GNU Radio, this value
62 * is specified in the alist filename. The gap is
63 * found during the matrix preprocessing
64 * algorithm. It is equal to the number of rows in
65 * submatrices E, C and D.
66 */
67 static sptr make(const std::string filename, unsigned int gap);
68
69 //! Encode \p inbuffer with LDPC H matrix into \p outbuffer.
70 virtual void encode(unsigned char* outbuffer,
71 const unsigned char* inbuffer) const = 0;
72
73 //! Decode \p inbuffer with LDPC H matrix into \p outbuffer.
74 virtual void decode(unsigned char* outbuffer,
75 const float* inbuffer,
76 unsigned int frame_size,
77 unsigned int max_iterations) const = 0;
78
79 //! Get the codeword length n
80 // Handled in fec_mtrx parent class.
81 virtual unsigned int n() const = 0;
82
83 //! Get the information word length k
84 // Handled in fec_mtrx parent class.
85 virtual unsigned int k() const = 0;
86
87 /*!
88 * \brief A pointer to make SWIG work
89 *
90 * \details
91 * SWIG doesn't understand the parent class pointer to this
92 * child class for the make function of the
93 * ldpc_bit_flip_decoder; it's expecting a pointer to the base
94 * class. This returns a shared_from_this instance.
95 */
96 virtual gr::fec::code::fec_mtrx_sptr get_base_sptr() = 0;
97};
98
99} // namespace code
100} // namespace fec
101} // namespace gr
102
103#endif /* INCLUDED_ldpc_H_matrix_H */
Base class for FEC matrix objects.
Definition: fec_mtrx.h:135
Parity check matrix in Richardson/Urbanke format.
Definition: ldpc_H_matrix.h:51
virtual void encode(unsigned char *outbuffer, const unsigned char *inbuffer) const =0
Encode inbuffer with LDPC H matrix into outbuffer.
boost::shared_ptr< ldpc_H_matrix > sptr
Definition: ldpc_H_matrix.h:53
static sptr make(const std::string filename, unsigned int gap)
Constructor given alist file and gap.
virtual unsigned int n() const =0
Get the codeword length n.
virtual unsigned int k() const =0
Get the information word length k.
virtual void decode(unsigned char *outbuffer, const float *inbuffer, unsigned int frame_size, unsigned int max_iterations) const =0
Decode inbuffer with LDPC H matrix into outbuffer.
#define FEC_API
Definition: gr-fec/include/gnuradio/fec/api.h:30
Include this header to use the message passing features.
Definition: basic_block.h:45