21 int max_slanted_degree,
30 if (max_level <= 0) max_level = 1;
49 ERROR(
"engine resolution strategies all require a polynomial base ring");
55 ERROR(
"free resolutions over polynomial rings with RR or CC coefficients not yet implemented");
61 "engine resolution strategies all require a Heft vector which is "
62 "positive for all variables");
65 if (algorithm < 4 and !m->is_homogeneous())
67 ERROR(
"engine resolution strategies require a homogeneous module");
74 if (!resolve_cokernel)
77 "resolution Strategy=>1 cannot resolve a cokernel with a given "
78 "presentation: use Strategy=>2 or Strategy=>3 instead");
84 "use resolution Strategy=>2 or Strategy=>3 for non commutative "
89 C =
new res_comp(m, max_level, strategy);
92 if (!resolve_cokernel)
95 "resolution Strategy=>0 cannot resolve a cokernel with a given "
96 "presentation: use Strategy=>2 or Strategy=>3 instead");
102 "use resolution Strategy=>2 or Strategy=>3 for non commutative "
108 m, max_level, use_max_slanted_degree, max_slanted_degree, strategy);
113 C =
new gbres_comp(m, max_level + 1, origsyz, strategy);
123 if (!resolve_cokernel)
126 "resolution Strategy=>4 cannot resolve a cokernel with a given "
127 "presentation: use Strategy=>2 or Strategy=>3 instead");
133 "use resolution Strategy=>2 or Strategy=>3 for non commutative "
138 C =
createF4Res(m, max_level, strategy, numThreads, parallelizeByDegree);
139 if (C ==
nullptr)
return nullptr;
144 ERROR(
"unknown resolution algorithm");
153 int z = (hi - lo + 1) * (len + 1);
167 for (d = hi; d >= lo; d--)
169 for (lev = 0; lev <= len; lev++)
170 if (bettis[lev + (len + 1) * (d - lo)] > 0)
175 if (hi1 <= hi)
break;
177 if (hi1 > hi) hi1 = hi;
180 for (lev = len; lev >= 0; lev--)
182 for (d = lo; d <= hi1; d++)
183 if (bettis[lev + (len + 1) * (d - lo)] > 0)
188 if (len1 <= len)
break;
190 if (len1 > len) len1 = len;
192 int totallen = (hi1 - lo + 1) * (len1 + 1);
200 for (d = lo; d <= hi1; d++)
201 for (lev = 0; lev <= len1; lev++)
202 result->array[next++] = bettis[lev + (len + 1) * (d - lo)];
215 for (
int lev = 0; lev < len; lev++)
218 for (
int d = lo; d <= hi; d++) sum += a[len * (d - lo) + lev + 3];
223 o <<
" [" << total_sum <<
"]" <<
newline;
224 for (
int d = lo; d <= hi; d++)
228 for (
int lev = 0; lev < len; lev++)
230 int c = a[len * (d - lo) + lev + 3];
247 ERROR(
"this function not defined for this resolution type");
Abstract Ring subclass that lifts either a FreeAlgebra or a FreeAlgebraQuotient into the engine's Rin...
const Ring * get_ring() const
bool primary_degrees_of_vars_positive() const
Abstract base class for mutable matrices over an arbitrary engine Ring, the in-place counterpart of t...
const Ring * getCoefficientRing() const
virtual const Monoid * getMonoid() const
bool is_skew_commutative() const
Abstract base for the engine's polynomial-ring hierarchy.
static void betti_display(buffer &o, M2_arrayint a)
static void betti_init(int lo, int hi, int len, int *&bettis)
virtual const Matrix * get_matrix(int level)=0
static ResolutionComputation * choose_res(const Matrix *m, M2_bool resolve_cokernel, int max_level, M2_bool use_max_slanted_degree, int max_slanted_degree, int algorithm, int strategy, int numThreads, M2_bool parallelizeByDegree)
static M2_arrayint betti_make(int lo, int hi, int len, int *bettis)
virtual ~ResolutionComputation()
virtual const M2FreeAlgebraOrQuotient * cast_to_M2FreeAlgebraOrQuotient() const
virtual bool is_commutative_ring() const
virtual unsigned long get_precision() const
virtual const PolynomialRing * cast_to_PolynomialRing() const
One of the Resolution computations, based on computing step by step.
One of the Resolution computations, based on Schreyer and Lascala.
One of the Resolution computations, based on Schreyer and Lascala.
void intern_res(ResolutionComputation *G)
ResolutionComputation — abstract base for every free-resolution algorithm in the engine.
intern_* helpers that register long-lived engine objects with bdwgc finalisers.
VALGRIND_MAKE_MEM_DEFINED & result(result)
M2_arrayint M2_makearrayint(int n)
ResolutionComputation * createNCRes(const Matrix *gbModuleMatrix, int max_level, int strategy)
NCResComputation — placeholder free-resolution driver for modules over a FreeAlgebraQuotient.
#define newarray_atomic_clear(T, len)
res2_comp — original (1996) free-resolution engine using explicit pair processing.
ResolutionComputation * createF4Res(const Matrix *groebnerBasisMatrix, int max_level, int strategy, int numThreads, bool parallelizeByDegree)
F4ResComputation — top-level Schreyer-frame F4 free-resolution driver.
void emit_line(const char *s)
Text-formatting helpers layered on buffer: bignum print, line wrapping, M2_gbTrace-gated emit.