56template <
class Exponent,
bool legacy_length>
59template <
class Exponent,
bool legacy_length>
62template <
class E,
bool L>
78 for (
Iterator i = vp; i.valid(); ++i)
79 hashval = 4624296 * hashval + 2341 * i.var() + i.exponent();
86 if (!i.
valid() and p_one) o <<
"1";
87 for (; i.
valid(); ++i)
94 o << char(
'A' + v - 26);
96 o <<
"x[" << v <<
"]";
100 o <<
"^(" << e <<
")";
123 return std::equal(a, a +
length(a), b);
141 std::copy(vp, vp +
length(vp), std::back_inserter(
result));
150 for (
size_t i = 0; i < std::min(alen, blen); i++)
153 if (c == 0)
continue;
154 return (c > 0 ?
GT :
LT);
156 if (alen == blen)
return EQ;
157 return (alen > blen ?
GT :
LT);
167 template <
typename T>
171 auto num_wts = wts.size();
172 for (
Iterator i = m; i.valid(); ++i)
173 sum += i.exponent() * (i.var() < num_wts ? wts[i.var()] : 1);
179 for (
Iterator i = m; i.valid(); ++i) deg += i.exponent();
204 if (
npairs(a) != 1)
return false;
220# warning "buchberger-moeller still to write"
234template <
class E,
bool L>
varpower::ConstExponents const_varpower
ExponentList< int, true > varpower
ExponentListIterator< int, true > index_varpower
Dense exponent-vector template [e_0, ..., e_{nvars-1}] for monomial operations.
Append-only GC-backed byte buffer used throughout the engine for text output.
static Exponent buchberger_moeller_keep(ConstExponents m, ConstExponents p, ConstExponents q, ConstExponents pq)
static bool is_one(ConstExponents a)
gc_vector< Exponent > Vector
static void radical(ConstExponents a, Vector &result)
static int compare(ConstExponents a, ConstExponents b)
std::make_unsigned< Exponent >::type HashExponent
static HashExponent computeHashValue(ConstExponents vp)
ExponentListIterator< E, L > Iterator
const Exponent * ConstExponents
static void one(Vector &result)
static Exponent weight(ConstExponents m, const std::vector< T > &wts)
static void lcm(ConstExponents a, ConstExponents b, Vector &result)
static void mult(ConstExponents a, ConstExponents b, Vector &result)
static void from_arrayint(M2_arrayint m, Vector &result)
static void quotient(ConstExponents a, ConstExponents b, Vector &result)
static Exponent topvar(ConstExponents a)
static void from_expvector(int n, exponents::ConstExponents a, Vector &result)
static void gcd(ConstExponents a, ConstExponents b, Vector &result)
static Exponent simple_degree(ConstExponents m)
static void elem_text_out(buffer &o, ConstExponents m, bool p_one=true)
static void monsyz(ConstExponents a, ConstExponents b, Vector &sa, Vector &sb)
static void erase(ConstExponents a, ConstExponents b, Vector &result)
static void copy(ConstExponents vp, Vector &result)
static bool divides(ConstExponents a, ConstExponents b)
static M2_arrayint to_arrayint(ConstExponents vp)
static const Exponent length(ConstExponents m)
static const Exponent npairs(ConstExponents m)
static bool is_pure_power(ConstExponents a, Exponent &v, Exponent &e)
static bool is_equal(ConstExponents a, ConstExponents b)
static void to_expvector(int n, ConstExponents a, exponents::Exponents result)
static void var(Exponent v, Exponent e, Vector &result)
static void power(ConstExponents a, Exponent n, Vector &result)
ExponentListIterator(const Exponent *m)
ExponentListIterator(const ExponentListIterator &i)
const Exponent * ConstExponents
ExponentListIterator & operator++()
const Exponent * ConstExponents
Engine-wide include prelude — a single point of truth for portability shims.
VALGRIND_MAKE_MEM_DEFINED & result(result)
typename std::vector< T, gc_allocator< T > > gc_vector
a version of the STL vector, which allocates its backing memory with gc.