26 result->fsyz =
R->make_vec(i,
R->one());
38 syz_list.push_back(
p->fsyz);
46 R->mult_vec_to(
p->f, leadinv,
false);
47 R->mult_vec_to(
p->fsyz, leadinv,
false);
48 p->nterms =
R->n_nonzero_terms(
p->f);
72 :
row(m->n_rows() - 1),
82 typedef struct gm_elem *gm_elem_ptr;
86 for (i = 0; i < m->
n_rows(); i++)
96 for (i = 0; i < m->
n_cols(); i++)
108 R->remove_vec(
p->fsyz);
116 for (
int i = 0; i <
gens->n_rows(); i++)
139 vec v1 =
R->mult_vec(c1, q->
f);
140 vec v2 =
R->mult_vec(d2,
p->f);
141 vec s1 =
R->mult_vec(c1, q->
fsyz);
142 vec s2 =
R->mult_vec(d2,
p->fsyz);
144 R->remove_vec(q->
fsyz);
146 R->add_vec_to(v1, v2);
147 R->add_vec_to(s1, s2);
165 vec g =
R->mult_vec(c,
gb_list[r]->f);
181 if (f ==
nullptr)
return;
200 vec gsyz =
R->mult_vec(c,
gb_list[r]->fsyz);
201 vec g =
R->mult_vec(c,
gb_list[r]->f);
203 R->add_vec_to(fsyz, gsyz);
232 if (
p->fsyz ==
nullptr)
263 for (
int r = 1; r <
gens->n_rows(); r++)
265 if (
gb_list[r] ==
nullptr)
continue;
282 for (
int i = 0; i <
gens->n_rows(); i++)
286 mat.
append(
R->make_vec(v->comp, v->coeff));
294 for (
int i = 0; i <
gens->n_rows(); i++)
302 for (
int i = 0; i <
gens->n_rows(); i++)
310 for (
int i = 0; i < syz_list.size(); i++)
311 mat.
append(
R->copy_vec(syz_list[i]));
318 for (
int i = 0; i <
gens->n_rows(); i++)
322 o <<
"--- component " << i <<
" -----" <<
newline;
328 o <<
"--- component " << i <<
" -----" <<
newline;
333 R->vec_text_out(o,
p->f);
335 R->vec_text_out(o,
p->fsyz);
340 for (
int i = 0; i < syz_list.size(); i++)
R->vec_text_out(o, syz_list[i]);
349 ERROR(
"encountered different rings");
354 ERROR(
"expected matrices to have same number of rows");
358 for (
int i = 0; i < m->
n_cols(); i++)
360 vec f =
R->copy_vec(m->
elem(i));
370 const Matrix **result_remainder,
371 const Matrix **result_quotient)
375 ERROR(
"encountered different rings");
376 *result_remainder =
nullptr;
377 *result_quotient =
nullptr;
382 ERROR(
"expected matrices to have same number of rows");
383 *result_remainder =
nullptr;
384 *result_quotient =
nullptr;
389 bool all_zeroes =
true;
390 for (
int i = 0; i < m->
n_cols(); i++)
392 vec f =
R->copy_vec(m->
elem(i));
396 R->negate_vec_to(fsyz);
397 if (f !=
nullptr) all_zeroes =
false;
401 *result_remainder = mat_remainder.
to_matrix();
402 *result_quotient = mat_quotient.
to_matrix();
413 ERROR(
"encountered different ring");
417 for (
int i = 0; i < m->
n_cols(); i++)
419 vec f =
R->copy_vec(m->
elem(i));
enum ComputationStatusCode status() const
enum ComputationStatusCode set_status(enum ComputationStatusCode)
FreeModule * sub_space(int n) const
virtual const Matrix * get_mingens()
void remove_gm_elem(gm_elem *&p)
virtual int complete_thru_degree() const
virtual M2_bool matrix_lift(const Matrix *m, const Matrix **result_remainder, const Matrix **result_quotient)
virtual const Matrix * get_change()
virtual const Matrix * get_syzygies()
GaussElimComputation(const Matrix *m, int collect_syz, int n_syz)
virtual const Matrix * get_gb()
void reduce(gm_elem *&p, gm_elem *q)
virtual void start_computation()
virtual const Matrix * matrix_remainder(const Matrix *m)
virtual void text_out(buffer &o) const
virtual const Matrix * get_initial(int nparts)
virtual int contains(const Matrix *m)
virtual const Ring * get_ring() const
const_monomial degree_shift() const
const Ring * get_ring() const
ring_elem elem(int i, int j) const
const FreeModule * rows() const
const FreeModule * cols() const
void set_column(int c, vec v)
Mutable builder used to assemble an immutable Matrix one column (or one term) at a time.
Engine-side ring of integers, backed by GMP mpz_ptr elements.
GaussElimComputation — Gaussian elimination GB / submodule strategy over a field.
bool system_interrupted()
system_interrupted() — thread-safe polling predicate for Ctrl+C handling.
VALGRIND_MAKE_MEM_DEFINED & result(result)
MatrixConstructor — the mutable builder that produces an immutable Matrix.
our_new_delete — per-class opt-in routing of new / delete through bdwgc.
Engine-wide stylistic constants: LT / EQ / GT codes, INTSIZE, GEOHEAP_SIZE.
void emit_wrapped(const char *s)
Text-formatting helpers layered on buffer: bignum print, line wrapping, M2_gbTrace-gated emit.