From caea44a3934b1750c21eb9ca9d659c5ea5301eab Mon Sep 17 00:00:00 2001 From: Ben Ruijl Date: Mon, 15 Jun 2015 15:33:50 +0200 Subject: [PATCH] Bugfixes for the gcd_linear routine --- sources/polygcd.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sources/polygcd.cc b/sources/polygcd.cc index 87049ac3..43281044 100644 --- a/sources/polygcd.cc +++ b/sources/polygcd.cc @@ -1299,7 +1299,7 @@ const map,poly> polygcd::bracket(const poly &a, const vector& f mon.setmod(a.modp); mon[0] = a[ai] + 1; for (int i=0; i 1 && i <= AN.poly_num_vars && varpattern[i - 1]) + if (i > 0 && i <= AN.poly_num_vars && varpattern[i - 1]) mon[1+i] = 0; else mon[1+i] = a[ai+i]; @@ -1335,7 +1335,9 @@ const poly gcd_linear_helper (const poly &a, const poly &b) { poly subgcd(BHEAD 1); if (ba.size() == 2) - poly subgcd = polygcd::gcd_linear(ba.begin()->second, (ba.begin()++)->second); + subgcd = polygcd::gcd_linear(ba.begin()->second, (++ba.begin())->second); + else + subgcd = ba.begin()->second; poly linfac = a / subgcd; if (poly::divides(linfac,b))