37 ERROR(
"internal error: expected a polynomial ring for `Algorithm => LinearAlgebra` groebner basis");
40 const Ring *K =
R->getCoefficients();
45 ERROR(
"expected commutative polynomial ring for `Algorithm => LinearAlgebra` groebner basis");
50 ERROR(
"can't use quotient polynomial rings with `Algorithm => LinearAlgebra` groebner basis");
55 ERROR(
"expected homogeneous input for `Algorithm => LinearAlgebra` groebner basis");
60 ERROR(
"expected coefficient ring to be a finite field for `Algorithm => LinearAlgebra` groebner basis");
91 std::vector<int> moduleHeftDegrees;
94 moduleHeftDegrees.push_back(
mFreeModule->primary_degree(j));
104 if (
mMonoid->componentLocation() != -1 or
108 throw exc::engine_error(
"must use Position=>Up at end of monomial order for Algorithm=>LinearAlgebra groebner basis");
137 mF4GB->set_hilbert_function(hf);
145 auto gbsize =
gb.size();
146 int *gb_order =
new int[gbsize];
147 for (
int i = 0; i < gbsize; i++)
152 std::stable_sort(gb_order, gb_order + gbsize, C);
156 for (
int i = 0; i < gbsize; i++)
158 int which = gb_order[i];
163 return result.to_matrix();
168 ERROR(
"Minimal generators for all `Algorithm => LinearAlgebra` Groebner bases not computed");
174 ERROR(
"Change of basis matrix for all `Algorithm => LinearAlgebra` Groebner bases not computed");
180 ERROR(
"Syzygies for `Algorithm => LinearAlgebra` Groebner bases not computed");
187 ERROR(
"Lead terms for `Algorithm => LinearAlgebra`: use `leadTerm gens gb` instead of `leadTerm gb`");
194 ERROR(
"No special algorithm for computing matrix remainder for `Algorithm => LinearAlgebra");
200 const Matrix **result_remainder,
201 const Matrix **result_quotient)
204 *result_remainder =
nullptr;
205 *result_quotient =
nullptr;
206 ERROR(
"No special algorithm for computing matrix remainder and lift for `Algorithm => LinearAlgebra");
216 ERROR(
"No special algorithm for computing containment for `Algorithm => LinearAlgebra");
Coefficient-ring-erased arithmetic dispatcher used by F4, GB, and resolution code.
Append-only GC-backed byte buffer used throughout the engine for text output.
Abstract base for long-running, resumable engine computations (GBComputation, ResolutionComputation,...
const PolynomialRing * mOriginalRing
void start_computation() override
const VectorArithmetic * mVectorArithmetic
int contains(const Matrix *m) override
const FreeModule * mFreeModule
M2_bool matrix_lift(const Matrix *m, const Matrix **result_remainder, const Matrix **result_quotient) override
int complete_thru_degree() const override
const Matrix * get_gb() override
const Matrix * get_change() override
void show() const override
const Matrix * matrix_remainder(const Matrix *m) override
const Matrix * get_initial(int nparts) override
Computation * set_hilbert_function(const RingElement *h) override
~F4Computation() override
F4Computation(const VectorArithmetic *VA, const Matrix *m, M2_bool collect_syz, int n_rows_to_keep, M2_arrayint gb_weights, int strategy, M2_bool use_max_degree, int max_degree, int numThreads)
const Matrix * get_mingens() override
const Matrix * get_syzygies() override
void text_out(buffer &o) const override
GBComputation subclass that drives an F4GB engine instance from the engine-side computation API.
Commutative F4 Groebner-basis driver: degree-by-degree Macaulay matrix construction plus row-reductio...
static void from_M2_matrix(const VectorArithmetic *VA, const MonomialInfo *MI, const Matrix *m, gb_array &result_polys)
static vec to_M2_vec(const VectorArithmetic *VA, const MonomialInfo *MI, const GBF4Polynomial &f, const FreeModule *F)
base class for Groebner basis computations.
Comparator that orders indices into the current GB array (gb_array) by each gbelem's leading monomial...
const Ring * get_ring() const
bool is_homogeneous() const
const FreeModule * rows() const
Mutable builder used to assemble an immutable Matrix one column (or one term) at a time.
Per-ring monomial layout / encoding helper used by F4GB.
Abstract base for the engine's polynomial-ring hierarchy.
virtual bool is_quotient_ring() const
virtual bool isGaloisField() const
virtual bool is_commutative_ring() const
virtual const PolynomialRing * cast_to_PolynomialRing() const
virtual bool isFinitePrimeField() const
Front-end-visible "ring element" value: an engine ring_elem paired with the Ring* that gives it meani...
Runtime dispatcher that hides the concrete coefficient ring behind a std::variant of ConcreteVectorAr...
static void stats(buffer &o)
Engine error-reporting primitives: ERROR, INTERNAL_ERROR, error, error_message.
GBComputation * createF4GB(const Matrix *m, M2_bool collect_syz, int n_rows_to_keep, M2_arrayint gb_weights, int strategy, M2_bool use_max_degree, int max_degree, int numThreads)
F4Computation — GBComputation adapter around the F4 inner-loop engine.
F4toM2Interface — static translators between engine vec / Matrix and F4's GBF4Polynomial.
std::vector< gbelem * > gb_array
Shared type vocabulary used across the F4 engine.
F4GB — the inner-loop Faugère F4 Groebner-basis algorithm.
void gb(IntermediateBasis &F, int n)
VALGRIND_MAKE_MEM_DEFINED & result(result)
MatrixConstructor — the mutable builder that produces an immutable Matrix.
Matrix — the engine's immutable homomorphism F -> G between free modules.
stash and doubling_stash — legacy size-class allocator interfaces, now stubbed to plain GC allocation...
MonomialInfo — F4's packed_monomial encoding plus operations.
Monoid — variable count, naming, grading, and monomial order of a polynomial ring.
PolynomialRing — abstract polynomial-ring base, the engine's most-reused class.
Ring — the legacy abstract base class for every coefficient and polynomial ring.
ring_elem — the universal value type carried by every Ring* in the engine.
Text-formatting helpers layered on buffer: bignum print, line wrapping, M2_gbTrace-gated emit.
std::vector< T > M2_arrayint_to_stdvector(M2_arrayint arr)
Conversion helpers between M2 boundary types and standard C++ containers.