Skip to content

Commit

Permalink
ENHANCE: Recode assertion to avoid recursion trap
Browse files Browse the repository at this point in the history
This fixes #3140
  • Loading branch information
hulpke committed Jan 7, 2019
1 parent 10cc76d commit de2743a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/matrix.gi
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,16 @@ BindGlobal( "Matrix_CharacteristicPolynomialSameField",
vec[i] := zero;
fi;
od;
Assert(3, IsZero(Value(cp,imat)));
Assert(2, Length(CoefficientsOfUnivariatePolynomial(cp)) = n+1);
if AssertionLevel()>=3 then
# cannot use Value(cp,imat), as this uses characteristic polynomial
n:=Zero(imat);
one:=One(imat);
for i in Reversed(CoefficientsOfUnivariatePolynomial(cp)) do
n:=n*imat+(i*one);
od;
Assert(3,IsZero(n));
fi;
Info(InfoMatrix,1,"Characteristic Polynomial returns ", cp);
return cp;
end );
Expand Down

0 comments on commit de2743a

Please sign in to comment.