372{
374 {
375 ERROR(
"encountered different rings");
376 *result_remainder = nullptr;
377 *result_quotient = nullptr;
378 return false;
379 }
381 {
382 ERROR(
"expected matrices to have same number of rows");
383 *result_remainder = nullptr;
384 *result_quotient = nullptr;
385 return false;
386 }
388 MatrixConstructor mat_quotient(
Fsyz, m->
cols(),
nullptr);
389 bool all_zeroes = true;
390 for (
int i = 0; i < m->
n_cols(); i++)
391 {
392 vec f =
R->copy_vec(m->
elem(i));
393 vec fsyz = nullptr;
394
396 R->negate_vec_to(fsyz);
397 if (f != nullptr) all_zeroes = false;
398 mat_remainder.set_column(i, f);
399 mat_quotient.set_column(i, fsyz);
400 }
401 *result_remainder = mat_remainder.to_matrix();
402 *result_quotient = mat_quotient.to_matrix();
403 return all_zeroes;
404}
void reduce(gm_elem *&p, gm_elem *q)
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