26 if ((*
gens)[i] ==
nullptr)
32 mpz_abs(
result->lead, (*
gens)[i]->coeff.get_mpz());
46 if (
p->fsyz !=
nullptr &&
collect_syz) syz_list.push_back(
p->fsyz);
60 :
row(m->n_rows() - 1),
68 for (i = 0; i < m->
n_rows(); i++) initial.push_back(
nullptr);
74 for (i = 0; i < m->
n_cols(); i++)
119 if (c < 0)
return -1;
126 if (g ==
nullptr)
return f;
127 if (f ==
nullptr)
return g;
145 if (mpz_cmp(f->
f->coeff.get_mpz(), g->
f->coeff.get_mpz()) == 0)
162 if (g->
f !=
nullptr) mpz_abs(h->
lead, g->
f->coeff.get_mpz());
188 if (
p ==
nullptr ||
p->next ==
nullptr)
return;
198 if (
p ==
nullptr)
break;
226 vec syz1 =
globalZZ->mult_vec(u,
p->fsyz);
234 vec qsyz1 =
globalZZ->mult_vec(a,
p->fsyz);
251 mpz_set(
p->lead,
p->f->coeff.get_mpz());
255 if (q->
f !=
nullptr) mpz_abs(q->
lead, q->
f->coeff.get_mpz());
269 if (
p ==
nullptr)
continue;
270 initial[
row] =
nullptr;
272 while (
p !=
nullptr &&
p->next !=
nullptr)
298 vec fsyz =
globalZZ->negate_vec(
p->fsyz);
305 initial[
p->f->comp] =
p;
342 for (
int i = 0; i < syz_list.size(); i++)
364 for (
int i = 0; i <
gens->n_rows(); i++)
365 if (initial[i] !=
nullptr)
367 o <<
"--- component " << i <<
" -----" <<
newline;
368 for (
hm_elem *
p = initial[i];
p !=
nullptr;
p =
p->next)
382 for (
int i = 0; i < syz_list.size(); i++)
383 globalZZ->vec_text_out(o, syz_list[i]);
402 globalZZ->remainderAndQuotient(f->coeff, h->
f->coeff, v);
403 bool do_reduce = !
globalZZ->is_zero(v);
410 if (
globalZZ->is_zero(rem))
continue;
438 globalZZ->remainderAndQuotient(f->coeff, h->
f->coeff, v);
439 bool do_reduce = !
globalZZ->is_zero(v);
448 if (
globalZZ->is_zero(rem))
continue;
466 ERROR(
"expected matrix over ZZ");
471 ERROR(
"expected matrices to have same number of rows");
475 for (
int i = 0; i < m->
n_cols(); i++)
487 const Matrix **result_remainder,
488 const Matrix **result_quotient)
492 ERROR(
"expected matrix over ZZ");
493 *result_remainder =
nullptr;
494 *result_quotient =
nullptr;
499 ERROR(
"expected matrices to have same number of rows");
500 *result_remainder =
nullptr;
501 *result_quotient =
nullptr;
506 bool all_zeroes =
true;
507 for (
int i = 0; i < m->
n_cols(); i++)
513 if (f !=
nullptr) all_zeroes =
false;
519 *result_remainder = mat_remainder.
to_matrix();
520 *result_quotient = mat_quotient.
to_matrix();
531 ERROR(
"expected matrix over ZZ");
535 for (
int i = 0; i < m->
n_cols(); i++)
enum ComputationStatusCode status() const
enum ComputationStatusCode set_status(enum ComputationStatusCode)
FreeModule * sub_space(int n) const
HermiteComputation(const Matrix *m, int collect_syz, int n_syz)
virtual const Matrix * matrix_remainder(const Matrix *m)
virtual int complete_thru_degree() const
void remove_hm_elem(hm_elem *&p)
virtual void text_out(buffer &o) const
virtual const Matrix * get_initial(int nparts)
virtual void start_computation()
virtual int contains(const Matrix *m)
void reduce(hm_elem *&p, hm_elem *q)
virtual const Matrix * get_syzygies()
void gb_reduce(vec &f) const
int compare_elems(hm_elem *f, hm_elem *g) const
hm_elem * merge(hm_elem *f, hm_elem *g)
virtual const Matrix * get_gb()
virtual const Matrix * get_change()
virtual M2_bool matrix_lift(const Matrix *m, const Matrix **result_remainder, const Matrix **result_quotient)
virtual const Matrix * get_mingens()
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.
static long nfree_hm_elem
static long nallocs_hm_elem
HermiteComputation — Hermite normal form over ZZ, the ZZ-analogue of GaussElimComputation.
VALGRIND_MAKE_MEM_DEFINED & result(result)
MatrixConstructor — the mutable builder that produces an immutable Matrix.
Engine-wide stylistic constants: LT / EQ / GT codes, INTSIZE, GEOHEAP_SIZE.
void bignum_text_out(buffer &o, mpz_srcptr a)
Text-formatting helpers layered on buffer: bignum print, line wrapping, M2_gbTrace-gated emit.