24 unsigned int hashval = 13;
25 if (
R->degree_monoid()->n_vars() == 0)
28 for (
int i = 0; i <
rank(); i++) hashval = 14535 * hashval +
degree(i)[0];
37 auto D =
R->degree_monoid();
39 for (
int i = 0; i < n; i++)
append(deg);
42 if (has_schreyer_order)
59 ERROR(
"expected a polynomial ring");
64 if (rk == 0)
return F;
79 ERROR(
"expected a polynomial ring");
84 if (rk == 0)
return G;
86 auto D =
R->degree_monoid();
87 for (
int i = 0; i < rk; i++)
91 if (v !=
nullptr)
R->get_gb_ring()->gbvector_multidegree(F, v, deg);
103 if (!
schreyer || P ==
nullptr)
return Matrix::zero(
R->make_FreeModule(0),
this);
107 for (i = 0; i <
rank(); i++)
109 const FreeModule *F =
R->make_FreeModule(maxtie + 1);
111 for (i = 0; i <
rank(); i++)
157 if (
this == F)
return true;
159 if (
rank() != F->
rank())
return false;
161 auto D =
R->degree_monoid();
163 for (i = 0; i <
rank(); i++)
164 if (0 != D->compare(
degree(i), F->
degree(i)))
return false;
181 auto D =
R->degree_monoid();
185 for (
int i = 0; i <
rank(); i++)
187 D->mult(
degree(i), d, deg);
199 if (n < 0 || n >
rank())
201 ERROR(
"subfreemodule: index out of bounds");
214 for (
unsigned int i = 0; i < a->len; i++)
215 if (a->array[i] >= 0 && a->array[i] <
rank())
219 ERROR(
"subfreemodule: index out of bounds");
229 auto D =
R->degree_monoid();
233 for (
int i = 0; i <
rank(); i++)
235 D->power(
degree(i), -1, deg);
248 if (
R !=
G->get_ring())
250 ERROR(
"expected free modules over the same ring");
255 for (i = 0; i <
G->rank(); i++)
result->append(
G->degree(i));
265 for (
int i = 0; i <
G->rank(); i++)
append(
G->degree(i));
274 if (
R !=
G->get_ring())
276 ERROR(
"expected free modules over the same ring");
279 auto D =
R->degree_monoid();
283 for (
int i = 0; i <
rank(); i++)
284 for (
int j = 0; j <
G->rank(); j++)
286 D->mult(
degree(i),
G->degree(j), deg);
291 if (
schreyer !=
nullptr &&
G->schreyer !=
nullptr)
301 return R->make_FreeModule(1);
306 if (pp > rk || pp < 0)
return result;
308 size_t p =
static_cast<size_t>(pp);
311 for (
size_t i = 0; i <
p; i++) a[i] = i;
313 auto D =
R->degree_monoid();
319 for (
size_t r = 0; r <
p; r++)
320 D->mult(deg,
degree(
static_cast<int>(a[r])), deg);
361 for (
int i = lastn; i <
F->rank(); i++)
407 for (
int i = 0; i < len; i++)
408 if (deg[i] < lo->array[i])
return false;
410 for (
int i = 0; i < len; i++)
411 if (deg[i] > hi->array[i])
return false;
418 auto D =
R->degree_monoid();
419 std::vector<size_t>
result;
420 int ndegrees = D->n_vars();
422 for (
int i = 0; i <
rank(); i++)
424 D->to_expvector(
degree(i), exp);
426 for (
int i=0; i<ndegrees; i++)
427 printf(
"%d ", exp[i]);
443 R->degree_monoid()->degree_weights(
degree(i),
R->get_heft_vector());
449 if (
rank() == 0)
return 0;
451 for (
int i = 1; i <
rank(); i++)
461 if (
rank() == 0)
return 0;
463 for (
int i = 1; i <
rank(); i++)
475 o <<
"free(rank " << rk <<
" degrees = {";
476 auto D =
R->degree_monoid();
477 for (i = 0; i < rk; i++)
479 if (i != 0) o <<
", ";
480 D->elem_text_out(o,
degree(i));
Older Schreyer-style kernel computation, predecessor of schreyer-resolution/.
exponents::ConstExponents const_exponents
exponents::Exponents exponents_t
FreeModule * transpose() const
M2_arrayintOrNull select_by_degrees(M2_arrayintOrNull lo, M2_arrayintOrNull hi) const
virtual FreeModule * new_free() const
FreeModule * tensor(const FreeModule *G) const
const Ring * get_ring() const
const_monomial degree(int i) const
gc_vector< monomial > components
void initialize(const Ring *RR)
void change_degree(int i, const_monomial deg)
void append(const_monomial d)
FreeModule * exterior(int p) const
void direct_sum_to(const FreeModule *G)
FreeModule * symm(int p) const
FreeModule(const Ring *R, int n, bool has_schreyer_order)
bool is_equal(const FreeModule *F) const
FreeModule * shift(const_monomial d) const
virtual unsigned int computeHashValue() const
int primary_degree(int i) const
Matrix * get_induced_order() const
FreeModule * sub_space(int n) const
int lowest_primary_degree() const
void append_schreyer(const_monomial d, const_monomial base_monom, int compare_num)
FreeModule * direct_sum(const FreeModule *G) const
int highest_primary_degree() const
static FreeModule * make_schreyer(const Matrix *m)
void text_out(buffer &o) const
Engine-side free module R^n over a Ring.
const Ring * get_ring() const
const FreeModule * cols() const
void set_entry(int r, int c, ring_elem a)
Mutable builder used to assemble an immutable Matrix one column (or one term) at a time.
Engine-side commutative monomial monoid: variable names, ordering, multidegree machinery,...
virtual const Monoid * getMonoid() const
virtual ring_elem make_flat_term(const ring_elem a, const_monomial m) const =0
virtual const Ring * getCoefficients() const
Abstract base for the engine's polynomial-ring hierarchy.
virtual ring_elem from_long(long n) const =0
virtual const PolynomialRing * cast_to_PolynomialRing() const
static SchreyerOrder * create(const Monoid *m)
int compare_num(int i) const
const_monomial base_monom(int i) const
Per-component tie-breaker data for a Schreyer monomial order on a FreeModule.
static bool increment(size_t n, Subset &s)
std::vector< size_t > Subset
Subsets — combinatorial-number-system encoding of p-subsets of {0,...,n-1}.
static CanonicalForm base
static bool degree_in_box(int len, const_exponents deg, M2_arrayint lo, M2_arrayint hi)
FreeModule — finite-rank free module R^n, the type-level anchor for every Matrix.
GBRing and gbvector — the GB-tuned polynomial-ring view used by classical Buchberger code.
const int * const_monomial
VALGRIND_MAKE_MEM_DEFINED & result(result)
M2_arrayint M2_arrayintOrNull
MatrixConstructor — the mutable builder that produces an immutable Matrix.
Matrix — the engine's immutable homomorphism F -> G between free modules.
#define newarray_atomic(T, len)
PolynomialRing — abstract polynomial-ring base, the engine's most-reused class.
FreeModule_symm(const FreeModule *F0, int n0)
FreeModule * symm1_result
void symm1(int lastn, int pow) const
Helper functor that builds the n-th symmetric power of a FreeModule by recursively walking multi-indi...
const FreeModule * get_free_module() const
gc_vector< gbvector * > elems
gbvector-side matrix: a target FreeModule plus a list of gbvector* columns living in it.
M2_arrayint stdvector_to_M2_arrayint(const std::vector< T > &v)
Conversion helpers between M2 boundary types and standard C++ containers.