Skip to content

Commit ee411a2

Browse files
mmkleehannes14
authored andcommitted
fix: bug in evaluation point search
1 parent 97bce27 commit ee411a2

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

factory/facBivar.cc

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,12 @@ CanonicalForm evalPoint (const CanonicalForm& F, int& i)
171171
else
172172
{
173173
if (testPoint (F, result, -i))
174+
{
175+
i= -i;
174176
return result;
177+
}
178+
else if (i < 0)
179+
i= -i;
175180
}
176181
k++;
177182
}
@@ -486,7 +491,6 @@ CFList biFactorize (const CanonicalForm& F, const Variable& v)
486491
bufAeval2= buf;
487492
bufAeval2= evalPoint (buf, bufEvaluation2);
488493

489-
490494
// univariate factorization
491495
TIMING_START (fac_uni_factorizer);
492496

@@ -591,21 +595,24 @@ CFList biFactorize (const CanonicalForm& F, const Variable& v)
591595
}
592596
if (bufUniFactors.length() < uniFactors.length())
593597
{
594-
if (evaluation != 0)
595-
{
596-
uniFactors= bufUniFactors;
597-
Aeval= bufAeval;
598-
evaluation= bufEvaluation;
599-
}
598+
uniFactors= bufUniFactors;
599+
Aeval= bufAeval;
600+
evaluation= bufEvaluation;
600601
}
601602
}
602-
bufEvaluation++;
603-
bufEvaluation2++;
603+
if (bufEvaluation > 0)
604+
bufEvaluation++;
605+
else
606+
bufEvaluation= -bufEvaluation + 1;
607+
if (bufEvaluation > 0)
608+
bufEvaluation2++;
609+
else
610+
bufEvaluation2= -bufEvaluation2 + 1;
604611
}
605612

606-
if (evaluation != 0 && (uniFactors.length() > uniFactors2.length() ||
613+
if (uniFactors.length() > uniFactors2.length() ||
607614
(uniFactors.length() == uniFactors2.length()
608-
&& degs.getLength() > degs2.getLength())))
615+
&& degs.getLength() > degs2.getLength()))
609616
{
610617
degs= degs2;
611618
uniFactors= uniFactors2;

0 commit comments

Comments
 (0)