77#include < stdexcept>
88
99
10+ /* * @namespace tms
11+ * @brief All the entities in the library are defined in this namespace. */
1012namespace tms
1113{
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)
1615 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)
1817 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
2019 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
2225 using Point = std::vector<Real>;
23- // / Type used for storing polynomials.
26+ // / Represents a polynomial over GF[2]
2427 using Polynomial = irrpoly::gfpoly;
2528
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 ;
2735
2836 class GenMatRow ;
2937
3038 class GenMat ;
3139
32- BasicInt const max_nbits = sizeof (DirNumInt)*8 ;
33-
3440
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
3645 {
3746 public:
3847
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 );
4254
43- ~DirNum (void );
55+ GenNum& operator =(GenNum const &);
56+ GenNum& operator =(GenNum &&);
4457
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);
4761
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 );
5165
66+ // / Casts generating numbers to the corresponding generating matrix
5267 explicit operator GenMat (void ) const ;
5368
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
5476 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 */
5581 bool get_bit (BasicInt i, BasicInt j) const ;
56- DirNumInt operator [](BasicInt n) const ;
5782
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 */
5891 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);
60100
61101
62102 private:
63103
64104 BasicInt m_nbits;
65- std::vector<DirNumInt > m_numbers;
105+ std::vector<GenNumInt > m_numbers;
66106 };
67107
108+ GenNum operator * (GenNum r, GenNum const &l);
109+ bool operator !=(GenNum const &l, GenNum const &r);
110+
68111
112+ /* * Represents a row of a generating matrix */
69113 class GenMatRow
70114 {
71115 public:
@@ -83,6 +127,8 @@ namespace tms
83127 GenMatRow (std::vector<uint8_t > const &values_vector); // ?
84128 GenMatRow (std::initializer_list<uint8_t > const &values_list);
85129
130+ bool empty (void ) const ;
131+
86132 BasicInt size (void ) const ;
87133 uint8_t operator [](BasicInt n) const ;
88134 uint8_t & operator [](BasicInt n);
@@ -127,13 +173,15 @@ namespace tms
127173 GenMat (std::vector<GenMatRow> const &matrix);
128174 GenMat (std::initializer_list<GenMatRow> const &lines_list);
129175
130- explicit operator DirNum (void ) const ;
176+ explicit operator GenNum (void ) const ;
131177
132- BasicInt size (void ) const ;
178+ bool empty (void ) const ;
179+
180+ BasicInt size (void ) const ;
133181 GenMatRow operator [](BasicInt n) const ;
134182 GenMatRow& operator [](BasicInt n);
135183
136- bool is_shifted (void ) const ;
184+ bool is_toeplitz (void ) const ;
137185 GenMat inverse (void ) const ;
138186
139187 GenMat& operator *=(GenMat const &r);
@@ -159,30 +207,38 @@ namespace tms
159207
160208
161209
210+ inline bool
211+ GenNum::empty () const
212+ { return m_numbers.empty (); }
213+
162214 inline BasicInt
163- DirNum ::size (void ) const
215+ GenNum ::size (void ) const
164216 { return m_nbits; }
165217
166218 inline bool
167- DirNum ::get_bit (BasicInt i, BasicInt j) const
219+ GenNum ::get_bit (BasicInt i, BasicInt j) const
168220 { return (m_numbers[j] >> (m_nbits - 1 - i)) & 1 ; }
169221
170- inline DirNumInt
171- DirNum ::operator [](BasicInt n) const
222+ inline uintmax_t
223+ GenNum ::operator [](BasicInt n) const
172224 { return m_numbers[n]; }
173225
174226
175227 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); }
178230
179- inline DirNumInt &
180- DirNum ::operator [](BasicInt n)
231+ inline uintmax_t &
232+ GenNum ::operator [](BasicInt n)
181233 { return m_numbers[n]; }
182234
183235
184236
185237
238+ inline bool
239+ GenMatRow::empty (void ) const
240+ { return m_values.empty (); }
241+
186242 inline BasicInt
187243 GenMatRow::size (void ) const
188244 { return static_cast <BasicInt>(m_values.size ()); }
@@ -198,6 +254,10 @@ namespace tms
198254
199255
200256
257+ inline bool
258+ GenMat::empty () const
259+ { return m_rows.empty (); }
260+
201261 inline BasicInt
202262 GenMat::size (void ) const
203263 { return m_nbits; }
0 commit comments