mirror of https://github.com/CGAL/cgal
Fixed some RS issue (about monomials with zero coefficient)
This commit is contained in:
parent
15b1274ed8
commit
6216d92a89
|
|
@ -47,16 +47,19 @@ void create_rs_upoly(mpq_t *poly, const int deg) {
|
||||||
rs_import_uppring ("T");
|
rs_import_uppring ("T");
|
||||||
ident_pol = rs_get_default_up ();
|
ident_pol = rs_get_default_up ();
|
||||||
for (i=0; i<deg+1; i++) {
|
for (i=0; i<deg+1; i++) {
|
||||||
ident_mon = rs_export_new_mon_upp_bz ();
|
|
||||||
ident_coeff = rs_export_new_gmp ();
|
|
||||||
CGAL_assertion_msg
|
CGAL_assertion_msg
|
||||||
(mpz_cmp_ui (mpq_denref (poly[deg-i]), 1) == 0,
|
(mpz_cmp_ui (mpq_denref (poly[deg-i]), 1) == 0,
|
||||||
"by now, RS works only with integer coefficients");
|
"by now, RS works only with integer coefficients");
|
||||||
rs_import_bz_gmp
|
// don't add the monomial if the coefficient is zero!
|
||||||
(ident_coeff, TO_RSPTR_IN (mpq_numref (poly[deg-i])));
|
if (mpq_cmp_ui (poly[deg-i], 0, 1) != 0) {
|
||||||
//rs_import_bz_gmp (ident_coeff, TO_RSPTR_IN (&(poly[deg-i])));
|
ident_mon = rs_export_new_mon_upp_bz ();
|
||||||
rs_dset_mon_upp_bz (ident_mon, ident_coeff, i);
|
ident_coeff = rs_export_new_gmp ();
|
||||||
rs_dappend_list_mon_upp_bz (ident_pol, ident_mon);
|
rs_import_bz_gmp
|
||||||
|
(ident_coeff,
|
||||||
|
TO_RSPTR_IN (mpq_numref (poly[deg-i])));
|
||||||
|
rs_dset_mon_upp_bz (ident_mon, ident_coeff, i);
|
||||||
|
rs_dappend_list_mon_upp_bz (ident_pol, ident_mon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue