3#ifndef _aring_gf_m2_hpp_
4#define _aring_gf_m2_hpp_
74 void display(std::ostream &o)
const;
157 return (t <=
p ? t : t -
p);
163 return (t <= 0 ? t +
p : t);
195 if (f < g)
return -1;
269 if (n ==
mGF.minusOne())
276 if (-n ==
mGF.minusOne())
283 if (
mGF.characteristic() == 2)
309 if (a != 0 && b != 0)
312 if (c >
mGF.orderMinusOne()) c -=
mGF.orderMinusOne();
326 if (c <= 0) c +=
mGF.orderMinusOne();
337 long order1 =
static_cast<long>(
mGF.orderMinusOne());
357 long n1 = mpz_fdiv_ui(n,
mGF.orderMinusOne());
365 else if (mpz_sgn(n) == 0)
383 bool p_parens =
false)
const;
406 const std::vector<long> &poly)
const;
Shared base of the aring framework (namespace M2) that unifies the engine's coefficient rings.
Append-only GC-backed byte buffer used throughout the engine for text output.
Engine-side finite field GF(p^n) built on top of (Z/p)[t] / f(t) for a primitive element of the resul...
void from_ring_elem(ElementType &result, const ring_elem &a) const
int compare_elems(ElementType f, ElementType g) const
bool is_zero(ElementType f) const
void set(elem &result, elem a) const
void power_mpz(elem &result, elem a, mpz_srcptr n) const
void set_zero(elem &result) const
void text_out(buffer &o) const
void power(elem &result, elem a, long n) const
bool is_unit(ElementType f) const
void init_set(elem &result, elem a) const
std::vector< elem > ElementContainerType
void swap(ElementType &a, ElementType &b) const
void subtract(elem &result, elem a, elem b) const
static int modulus_sub(int a, int b, int p)
void divide(elem &result, elem a, elem b) const
void lift_to_original_ring(ring_elem &result, const ElementType &f) const
bool is_equal(ElementType f, ElementType g) const
int get_repr(elem f) const
void syzygy(ElementType a, ElementType b, ElementType &x, ElementType &y) const
const PolynomialRing & originalRing() const
void subtract_multiple(elem &result, elem a, elem b) const
unsigned int computeHashValue(const elem &a) const
void elem_text_out(buffer &o, ElementType a, bool p_one=true, bool p_plus=false, bool p_parens=false) const
void fromSmallIntegerCoefficients(ElementType &result, const std::vector< long > &poly) const
static void clear(elem &result)
GFElement characteristic() const
void invert(elem &result, elem a) const
bool lift(const Ring *Rg, const elem f, ring_elem &result) const
void negate(elem &result, elem a) const
void set_from_mpz(elem &result, mpz_srcptr a) const
ElementType from_ring_elem_const(const ring_elem &a) const
ARingGFM2(const PolynomialRing &R, const ring_elem a)
void init(elem &result) const
void mult(elem &result, elem a, elem b) const
void add(elem &result, elem a, elem b) const
bool set_from_BigReal(elem &result, gmp_RR a) const
static int modulus_add(int a, int b, int p)
Arithmetic functions ///////.
void set_from_long(elem &result, long a) const
void eval(const RingMap *map, const elem f, int first_var, ring_elem &result) const
void to_ring_elem(ring_elem &result, const ElementType &a) const
void copy(elem &result, elem a) const
bool promote(const Ring *Rf, const ring_elem f, elem &result) const
static const RingID ringID
void set_var(elem &result, int v) const
void getGenerator(elem &result_gen) const
bool set_from_mpq(elem &result, mpq_srcptr a) const
void random(ElementType &result) const
GFElement dimension() const
GFElement minusOne() const
GFElement generatorExponent() const
const ring_elem primitiveElement() const
GFElement oneTable(GFElement a) const
const RingElement * getGenerator() const
GaloisFieldTable(const PolynomialRing &R, const ring_elem prim)
const ring_elem mPrimitiveElement
const PolynomialRing & ring() const
GFElement characteristic() const
GFElement orderMinusOne() const
GFElement * mFromIntTable
const RingElement * mGenerator
GFElement mGeneratorExponent
void display(std::ostream &o) const
const PolynomialRing & mOriginalRing
GFElement fromZZTable(GFElement a) const
A base class for simple ARings.
Abstract base for the engine's polynomial-ring hierarchy.
Front-end-visible "ring element" value: an engine ring_elem paired with the Ring* that gives it meani...
Engine-side ring homomorphism: stores, for each source-ring variable, the target-ring element it maps...
namespace exc — internal C++ exception types and the TRY / CATCH macro pair.
VALGRIND_MAKE_MEM_DEFINED & result(result)
PolynomialRing — abstract polynomial-ring base, the engine's most-reused class.
int32_t rawRandomInt(int32_t max)
Engine-boundary C API for the engine's PRNG and rational / real / complex random draws.
ring_elem — the universal value type carried by every Ring* in the engine.