39Array<Array<int> > GF::alphapow;
40Array<Array<int> > GF::logalpha;
41ivec GF::q =
"1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536";
48 it_assert((m > 0) && (m <= 16),
"GF::setsize : q must be positive and "
49 "less than or equal to 2^16");
55 const int reducetable[] = {3, 3, 3, 5, 3, 9, 29, 17, 9, 5, 83, 27, 43, 3, 4107};
57 if (alphapow.
size() < (m + 1)) {
62 if (alphapow(m).
size() == 0) {
75 for (n = 1; n < (1 << m) - 1; n++) {
76 temp = alphapow(m)(n - 1);
81 alphapow(m)(n) =
temp;
87 for (n = 0;n < (1 << m) - 1;n++)
88 logalpha(m)(alphapow(m)(n)) = n;
96 static const std::string
prefix(
"alpha^");
104 is.setstate(std::ios_base::failbit);
118 is.setstate(std::ios_base::failbit);
127 if (
ingf.value == -1)
130 os <<
"alpha^" <<
ingf.value;
138 for (
int i = 0;
i <
ingfx.degree + 1;
i++) {
159 int q =
c.get_size();
167 for (
int i = 0;
i <
c.get_degree();
i++) {
185 int q =
a.get_size();
193 for (
int i = 0;
i <
a.get_degree();
i++) {
int size() const
Returns the number of data elements in the array object.
void set_size(int n, bool copy=false)
Resizing an Array<T>.
Polynomials over GF(q)[x], where q=2^m, m=1,...,16.
int get_true_degree() const
Return true degree of GF(q)[x].
void set_size(int qvalue)
set q=2^mvalue
Definitions of Galois Field algebra classes and functions.
#define it_assert(t, s)
Abort if t is not true.
vec log2(const vec &x)
log-2 of the elements
int size(const Vec< T > &v)
Length of vector.
IT++ compatibility types and functions.
Logarithmic and exponenential functions - header file.
ITPP_EXPORT int round_i(double x)
Round to nearest integer.
std::ostream & operator<<(std::ostream &output, const bin &inbin)
Output stream of bin.
GFX divgfx(const GFX &c, const GFX &g)
Division of two GFX (local help function)
std::istream & operator>>(std::istream &input, bin &outbin)
Input stream of bin.
GFX modgfx(const GFX &a, const GFX &b)
Modulo function of two GFX (local help function)