/usr/include/gnuradio/fec/gf2mat.h is in gnuradio-dev 3.7.10.1-2+b3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | /* -*- c++ -*- */
/*
* Copyright 2015 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef GF2MAT_H
#define GF2MAT_H
#include <vector>
#include "gf2vec.h"
#include "alist.h"
class GF2Mat
{
//! The matrix H
std::vector < std::vector <char> > H;
//! Number of rows in H
int M;
//! Number of columns in H
int N;
public:
//! Default constructor
GF2Mat() {};
//! Construct an M x N matrix with all 0 entries
GF2Mat(int m, int n);
//! Loads the matrix from alist _list
GF2Mat(alist _list);
//! Initializes the class from a 2-D vector X
GF2Mat(std::vector <std::vector <char> > X);
//! Returns the variable M
int get_M();
//! Returns the variable N
int get_N();
//! Set the element at (i, j) coordinate to val
void set_element(int i, int j, char val);
//! Returns the element at coordinate (i, j)
char get_element(int i, int j);
//! Returns the ith row
GF2Vec get_row(int i);
//! Returns the ith column
GF2Vec get_col(int i);
//! Returns the ith row
GF2Vec operator[](int i);
//! Prints the matrix H
void print_matrix();
//! Sets the ith column with the given vector
void set_col(int i, GF2Vec vec);
//! Sets the ith row with the given vector
void set_row(int i, GF2Vec vec);
//! Swaps columns i and j
void swap_cols(int i, int j);
//! Adds column j to i and replace i with the sum
void add_cols(int i, int j);
//! Add row j to i and replace j with the sum
void add_rows(int i, int j);
//! Returns the variable H
std::vector<std::vector<char> > get_H();
/*!
* \brief Obtains an equivalent representation of H for encoding
*
* For encoding a G matrix in the form [I P] obtained from the
* parity matrix H, by (a) Column permutations, (b) Row additions
* and (c) Row permutations. Details of encoding is given in
* section A.1 of the reference:
*
* - "Modern Coding Theory", T Richardson and R Urbanke.
*
* \param p The column permutation during this operation.
* \param rank The rank of the matrix.
*/
GF2Mat get_G(std::vector<int> & p, int & rank);
};
#endif // #ifndef GF2MAT_H
|