7
7
#include < stdexcept>
8
8
9
9
10
+ /* * @namespace tms
11
+ * @brief All the entities in the library are defined in this namespace. */
10
12
namespace tms
11
13
{
12
- using DirNumInt = uintmax_t ;
13
-
14
- using IntPoint = std::vector<DirNumInt>;
15
- // / Type used for storing integer values that are less than word size.
14
+ // / A type for integer values that are less than word size (e.g. m, s parameters of the net)
16
15
using BasicInt = unsigned int ;
17
- // / Type used for storing quantity-values and indexation- values, i.e. the total amount of points to generate.
16
+ // / A type for integer counting values, (e.g. number of net's point)
18
17
using CountInt = uintmax_t ;
19
- // / Type used for storing coordinates of points of (t,m, s)-net.
18
+ // / A type of coordinates of points of (t, m, s)-net
20
19
using Real = long double ;
21
- // / Type used for storing points of (t,m,s)-net.
20
+ // / Represents a generating number of a digital (t, m, s)-net
21
+ using GenNumInt = uintmax_t ;
22
+ // / Represents a point of a scaled (t, m, s)-net
23
+ using IntPoint = std::vector<uintmax_t >;
24
+ // / Represents a point of a (t, m, s)-net
22
25
using Point = std::vector<Real>;
23
- // / Type used for storing polynomials.
26
+ // / Represents a polynomial over GF[2]
24
27
using Polynomial = irrpoly::gfpoly;
25
28
26
- class DirNum ;
29
+
30
+ // / Highest allowed m parameter value of created nets, i.e. highest bit depth value
31
+ BasicInt const max_nbits = sizeof (uintmax_t )*8 ;
32
+
33
+
34
+ class GenNum ;
27
35
28
36
class GenMatRow ;
29
37
30
38
class GenMat ;
31
39
32
- BasicInt const max_nbits = sizeof (DirNumInt)*8 ;
33
-
34
40
35
- class DirNum
41
+ /* * @class GenNum
42
+ * @brief Represents container of generating numbers of a digital net.
43
+ * Can be used as a shortened version of generating matrix */
44
+ class GenNum
36
45
{
37
46
public:
38
47
39
- DirNum (void );
40
- DirNum (DirNum const &);
41
- DirNum (DirNum &&);
48
+ // / Creates empty container with no generating numbers
49
+ GenNum (void );
50
+ GenNum (GenNum const &);
51
+ GenNum (GenNum &&);
52
+
53
+ ~GenNum (void );
42
54
43
- ~DirNum (void );
55
+ GenNum& operator =(GenNum const &);
56
+ GenNum& operator =(GenNum &&);
44
57
45
- DirNum& operator =(DirNum const &);
46
- DirNum& operator =(DirNum &&);
58
+ /* * Creates generating numbers with given values
59
+ * @param values – vector of generating numbers values */
60
+ GenNum (std::vector<GenNumInt> const &values);
47
61
48
- DirNum (std::vector<DirNumInt> const &values);
49
- DirNum (BasicInt size);
50
- // DirNum(GenMat const &gen_mat );
62
+ /* * Creates certain amount of zero defined generating numbers
63
+ * @param amount – amount of generating numbers */
64
+ GenNum (BasicInt amount );
51
65
66
+ // / Casts generating numbers to the corresponding generating matrix
52
67
explicit operator GenMat (void ) const ;
53
68
69
+ // / Checks whether generating numbers container is empty
70
+ bool empty (void ) const ;
71
+
72
+ // / Checks whether the corresponding generating matrix is toeplitz
73
+ bool is_toeplitz (void ) const ;
74
+
75
+ // / Returns amount of generating numbers in the containter
54
76
BasicInt size (void ) const ;
77
+
78
+ /* * Returns certain bit of a generating number addressed as an element of generating matrix
79
+ * @param i – row number
80
+ * @param j – column number */
55
81
bool get_bit (BasicInt i, BasicInt j) const ;
56
- DirNumInt operator [](BasicInt n) const ;
57
82
83
+ /* * Returns certain generating number
84
+ * @param n – index of a number */
85
+ uintmax_t operator [](BasicInt n) const ;
86
+
87
+ /* * Sets new bit value of a certain generating number addressed as an element of generating matrix
88
+ * @param i – row number
89
+ * @param j – column number
90
+ * @param value – new bit value */
58
91
void set_bit (BasicInt i, BasicInt j, bool value);
59
- DirNumInt& operator [](BasicInt n);
92
+
93
+ /* * Returns reference to a certain generating number
94
+ * @param n – index of a number */
95
+ uintmax_t & operator [](BasicInt n);
96
+
97
+ GenNum& operator *=(GenNum const & l);
98
+
99
+ friend bool operator ==(GenNum const &r, GenNum const &l);
60
100
61
101
62
102
private:
63
103
64
104
BasicInt m_nbits;
65
- std::vector<DirNumInt > m_numbers;
105
+ std::vector<GenNumInt > m_numbers;
66
106
};
67
107
108
+ GenNum operator * (GenNum r, GenNum const &l);
109
+ bool operator !=(GenNum const &l, GenNum const &r);
110
+
68
111
112
+ /* * Represents a row of a generating matrix */
69
113
class GenMatRow
70
114
{
71
115
public:
@@ -83,6 +127,8 @@ namespace tms
83
127
GenMatRow (std::vector<uint8_t > const &values_vector); // ?
84
128
GenMatRow (std::initializer_list<uint8_t > const &values_list);
85
129
130
+ bool empty (void ) const ;
131
+
86
132
BasicInt size (void ) const ;
87
133
uint8_t operator [](BasicInt n) const ;
88
134
uint8_t & operator [](BasicInt n);
@@ -127,13 +173,15 @@ namespace tms
127
173
GenMat (std::vector<GenMatRow> const &matrix);
128
174
GenMat (std::initializer_list<GenMatRow> const &lines_list);
129
175
130
- explicit operator DirNum (void ) const ;
176
+ explicit operator GenNum (void ) const ;
131
177
132
- BasicInt size (void ) const ;
178
+ bool empty (void ) const ;
179
+
180
+ BasicInt size (void ) const ;
133
181
GenMatRow operator [](BasicInt n) const ;
134
182
GenMatRow& operator [](BasicInt n);
135
183
136
- bool is_shifted (void ) const ;
184
+ bool is_toeplitz (void ) const ;
137
185
GenMat inverse (void ) const ;
138
186
139
187
GenMat& operator *=(GenMat const &r);
@@ -159,30 +207,38 @@ namespace tms
159
207
160
208
161
209
210
+ inline bool
211
+ GenNum::empty () const
212
+ { return m_numbers.empty (); }
213
+
162
214
inline BasicInt
163
- DirNum ::size (void ) const
215
+ GenNum ::size (void ) const
164
216
{ return m_nbits; }
165
217
166
218
inline bool
167
- DirNum ::get_bit (BasicInt i, BasicInt j) const
219
+ GenNum ::get_bit (BasicInt i, BasicInt j) const
168
220
{ return (m_numbers[j] >> (m_nbits - 1 - i)) & 1 ; }
169
221
170
- inline DirNumInt
171
- DirNum ::operator [](BasicInt n) const
222
+ inline uintmax_t
223
+ GenNum ::operator [](BasicInt n) const
172
224
{ return m_numbers[n]; }
173
225
174
226
175
227
inline void
176
- DirNum ::set_bit (BasicInt i, BasicInt j, bool value)
177
- { m_numbers[j] |= static_cast <DirNumInt >(value) << (m_nbits - 1 - i); }
228
+ GenNum ::set_bit (BasicInt i, BasicInt j, bool value)
229
+ { m_numbers[j] |= static_cast <uintmax_t >(value) << (m_nbits - 1 - i); }
178
230
179
- inline DirNumInt &
180
- DirNum ::operator [](BasicInt n)
231
+ inline uintmax_t &
232
+ GenNum ::operator [](BasicInt n)
181
233
{ return m_numbers[n]; }
182
234
183
235
184
236
185
237
238
+ inline bool
239
+ GenMatRow::empty (void ) const
240
+ { return m_values.empty (); }
241
+
186
242
inline BasicInt
187
243
GenMatRow::size (void ) const
188
244
{ return static_cast <BasicInt>(m_values.size ()); }
@@ -198,6 +254,10 @@ namespace tms
198
254
199
255
200
256
257
+ inline bool
258
+ GenMat::empty () const
259
+ { return m_rows.empty (); }
260
+
201
261
inline BasicInt
202
262
GenMat::size (void ) const
203
263
{ return m_nbits; }
0 commit comments