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 authored and fingolfin committed Jun 13, 2019
1 parent fe8ebae commit 3f85d62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/fitfree.gi
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ local ffs,hom,U,rest,ker,r,p,l,i,depths;
for i in U{[1..Length(U)-1]} do # last one is length+1
p:=PositionProperty(r,x->x>=i);
if p<>fail and p<=Length(ipcgs) and not p in l then
Add(l,p);
Add(l,p);
fi;
od;
Add(l,Length(ipcgs)+1);
Expand Down
10 changes: 9 additions & 1 deletion lib/matrix.gi
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,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 3f85d62

Please sign in to comment.