Macaulay2 Engine
Loading...
Searching...
No Matches

◆ matrix_lift()

M2_bool HermiteComputation::matrix_lift ( const Matrix * m,
const Matrix ** result_remainder,
const Matrix ** result_quotient )
virtual

Implements GBComputation.

Definition at line 485 of file hermite.cpp.

489{
490 if (m->get_ring() != globalZZ)
491 {
492 ERROR("expected matrix over ZZ");
493 *result_remainder = nullptr;
494 *result_quotient = nullptr;
495 return false;
496 }
497 if (m->n_rows() != gens->rows()->rank())
498 {
499 ERROR("expected matrices to have same number of rows");
500 *result_remainder = nullptr;
501 *result_quotient = nullptr;
502 return false;
503 }
504 MatrixConstructor mat_remainder(m->rows(), m->cols(), m->degree_shift());
505 MatrixConstructor mat_quotient(Fsyz, m->cols(), nullptr);
506 bool all_zeroes = true;
507 for (int i = 0; i < m->n_cols(); i++)
508 {
509 vec f = globalZZ->copy_vec(m->elem(i));
510 vec fsyz = nullptr;
511
512 gb_reduce(f, fsyz);
513 if (f != nullptr) all_zeroes = false;
514
515 globalZZ->negate_vec_to(fsyz);
516 mat_remainder.set_column(i, f);
517 mat_quotient.set_column(i, fsyz);
518 }
519 *result_remainder = mat_remainder.to_matrix();
520 *result_quotient = mat_quotient.to_matrix();
521 return all_zeroes;
522}
const FreeModule * Fsyz
Definition hermite.hpp:64
const Matrix * gens
Definition hermite.hpp:61
void gb_reduce(vec &f) const
Definition hermite.cpp:387
const_monomial degree_shift() const
Definition matrix.hpp:149
const Ring * get_ring() const
Definition matrix.hpp:134
ring_elem elem(int i, int j) const
Definition matrix.cpp:307
int n_cols() const
Definition matrix.hpp:147
int n_rows() const
Definition matrix.hpp:146
const FreeModule * rows() const
Definition matrix.hpp:144
const FreeModule * cols() const
Definition matrix.hpp:145
void negate_vec_to(vec &v) const
vec copy_vec(const vecterm *v) const
Definition ring-vecs.cpp:91
RingZZ * globalZZ
Definition relem.cpp:13
const int ERROR
Definition m2-mem.cpp:55

References Matrix::cols(), Matrix::degree_shift(), Matrix::elem(), ERROR, Fsyz, gb_reduce(), gens, Matrix::get_ring(), globalZZ, Matrix, Matrix::n_cols(), Matrix::n_rows(), Matrix::rows(), MatrixConstructor::set_column(), and MatrixConstructor::to_matrix().