diff --git a/hpcgap/lib/basis.gd b/hpcgap/lib/basis.gd
index ee6297fc32..a8fb243ee5 100644
--- a/hpcgap/lib/basis.gd
+++ b/hpcgap/lib/basis.gd
@@ -786,9 +786,11 @@ DeclareOperation( "RelativeBasisNC", [ IsBasis, IsHomogeneousList ] );
## (see ).
##
## name must be a string,
-## a filter f with this name is created, and
-## a logical implication from f to
-## is installed.
+## a filter f with this name is created which implies
+## , and
+## a logical implication from the join of f with
+## to
+## is installed.
##
## record must be a record with the following components.
##
@@ -805,28 +807,34 @@ DeclareOperation( "RelativeBasisNC", [ IsBasis, IsHomogeneousList ] );
##
## NiceFreeLeftModuleInfo
## -
-## the NiceFreeLeftModuleInfo method for left modules in f,
+## the
method for left modules in
+## f,
##
## NiceVector
## -
-## the NiceVector method for left modules V in f;
+## the
method for left modules V in
+## f;
## called with V and a vector v \in V, this function returns the
## nice vector r associated with v, and
##
## UglyVector
## -
-## the
method for left modules V in f;
-## called with V and a vector r in the NiceFreeLeftModule value
-## of V, this function returns the vector v \in V to which r is
+## the method for left modules V in
+## f;
+## called with V and a vector r in the
+## value of V,
+## this function returns the vector v \in V to which r is
## associated.
##
##
##
## The idea is that all one has to do for implementing a new kind of free
## left modules handled by the mechanism of nice bases is to call
-## DeclareHandlingByNiceBasis and InstallHandlingByNiceBasis,
+## and
+## ,
## which causes the installation of the necessary methods and adds the pair
-## [ f, record.detect ] to the global list NiceBasisFiltersInfo.
+## [ f, record.detect ] to the global list
+## .
## The methods call
## , which sets the appropriate filter
## for the desired left module if applicable.
@@ -889,6 +897,7 @@ InstallGlobalFunction( "DeclareHandlingByNiceBasis", function( name, info )
local entry;
atomic readwrite NiceBasisFiltersInfo do
DeclareFilter( name );
+ InstallTrueMethod( IsFreeLeftModule, ValueGlobal( name ) );
entry := [ ValueGlobal( name ), info ];
MigrateObj( entry, NiceBasisFiltersInfo );
Add( NiceBasisFiltersInfo, entry, 1 );
diff --git a/hpcgap/lib/basis.gi b/hpcgap/lib/basis.gi
index cf83dae265..89e4256d96 100644
--- a/hpcgap/lib/basis.gi
+++ b/hpcgap/lib/basis.gi
@@ -687,14 +687,16 @@ InstallGlobalFunction( "InstallHandlingByNiceBasis",
filter:= ValueGlobal( name );
# Install the detection of the filter.
+ # The mechanism is safe only if the domain can store
+ # its nice variant, thus we will install it only for cases where
+ # 'IsAttributeStoringRep' is guaranteed.
atomic readwrite NiceBasisFiltersInfo do
entry:= First( NiceBasisFiltersInfo,
x -> IsIdenticalObj( filter, x[1] ) );
entry[3] := record.detect;
od;
-
+ filter:= filter and IsAttributeStoringRep;
InstallTrueMethod( IsHandledByNiceBasis, filter );
- filter:= IsFreeLeftModule and filter;
# Install the methods.
InstallMethod( NiceFreeLeftModuleInfo,
@@ -1078,7 +1080,7 @@ InstallMethod( IsCanonicalBasis,
##
#M Basis( ) . . . . . . . . . . . for free module handled by nice basis
##
-BasisForFreeModuleByNiceBasis:= function( V )
+BindGlobal( "BasisForFreeModuleByNiceBasis", function( V )
local B;
B:= Objectify( NewType( FamilyObj( V ),
IsFiniteBasisDefault
@@ -1087,7 +1089,7 @@ BasisForFreeModuleByNiceBasis:= function( V )
rec() );
SetUnderlyingLeftModule( B, V );
return B;
-end;
+end );
InstallMethod( Basis,
"for free module that is handled by a nice basis",
diff --git a/hpcgap/lib/helpbase.gi b/hpcgap/lib/helpbase.gi
index 20ed39fce1..fe9de8ebe2 100644
--- a/hpcgap/lib/helpbase.gi
+++ b/hpcgap/lib/helpbase.gi
@@ -1442,4 +1442,3 @@ atomic readwrite HELP_REGION do
fi;
od; # end atomic
end);
-
diff --git a/hpcgap/lib/polyconw.gi b/hpcgap/lib/polyconw.gi
index 51dc68134d..d1ac23a431 100644
--- a/hpcgap/lib/polyconw.gi
+++ b/hpcgap/lib/polyconw.gi
@@ -194,7 +194,7 @@ end);
## list of all cases with less than 100*10^9 compatible polynomials, sorted
## w.r.t. this number
-ConwayCandidates := function()
+BindGlobal( "ConwayCandidates", function()
local cand, p, i;
# read data
for p in [2,113,1009] do
@@ -211,7 +211,7 @@ ConwayCandidates := function()
Sort(cand);
cand := Filtered(cand, a-> not IsBound(CONWAYPOLDATA[a[2]][a[3]]));
return cand;
-end;
+end );
##
##
@@ -502,15 +502,15 @@ InstallGlobalFunction( IsCheapConwayPolynomial, function( p, n )
fi;
# this is not very precise, hopefully good enough for the moment
if p < 41 then
- if n < 100 and IsPrimeInt(n) then
+ if n < 100 and (n = 1 or IsPrimeInt(n)) then
return true;
fi;
elif p < 100 then
- if n < 40 and IsPrimeInt(n) then
+ if n < 40 and (n = 1 or IsPrimeInt(n)) then
return true;
fi;
elif p < 1000 then
- if n < 14 and IsPrimeInt(n) then
+ if n < 14 and (n = 1 or IsPrimeInt(n)) then
return true;
fi;
elif p < 2^48 then
diff --git a/hpcgap/lib/ratfun.gi b/hpcgap/lib/ratfun.gi
index 6fa6d08fcb..ce3f2ad67c 100644
--- a/hpcgap/lib/ratfun.gi
+++ b/hpcgap/lib/ratfun.gi
@@ -1078,6 +1078,20 @@ function( left, right )
return SumCoefPolynomial(left, right);
end);
+# divide by constant polynomials
+
+InstallMethod(\/,"constant denominator poly",IsIdenticalObj,
+ [IsPolynomial,IsPolynomial],0,
+function(num,den)
+local e;
+ e:=ExtRepNumeratorRatFun(den);
+ if Length(e)=0 then Error("Division by zero");
+ elif Length(e)>2 or Length(e[1])>0 then TryNextMethod();fi;
+ e:=Inverse(e[2]);
+ if e=fail then TryNextMethod();fi;
+ return e*num;
+end);
+
InstallGlobalFunction( QuotientPolynomialsExtRep,QUOTIENT_POLYNOMIALS_EXT);
#############################################################################
@@ -1090,9 +1104,7 @@ InstallMethod(HeuristicCancelPolynomialsExtRep,"ignore",true,
[IsRationalFunctionsFamily,IsList,IsList],
# fallback: lower than default for the weakest conditions
-1,
-function(f,a,b)
- return fail; # can't do anything
-end);
+ReturnFail);
InstallGlobalFunction(TryGcdCancelExtRepPolynomials,TRY_GCD_CANCEL_EXTREP_POL);
@@ -1129,7 +1141,7 @@ local fam,t,num,tt,den;
ExtRepPolynomialRatFun(left),
ExtRepDenominatorRatFun(right));
num:=ZippedProduct(t[1],ExtRepNumeratorRatFun(right),
- fam!.zeroCoefficient,fam!.zippedProduct);
+ fam!.zeroCoefficient,fam!.zippedProduct);
if Length(t[2])=2 and t[2][1]=[] and t[2][2]=fam!.oneCoefficient then
return PolynomialByExtRepNC(fam,num);
else
@@ -1140,7 +1152,7 @@ local fam,t,num,tt,den;
ExtRepPolynomialRatFun(right),
ExtRepDenominatorRatFun(left));
num:=ZippedProduct(t[1],ExtRepNumeratorRatFun(left),
- fam!.zeroCoefficient,fam!.zippedProduct);
+ fam!.zeroCoefficient,fam!.zippedProduct);
if Length(t[2])=2 and t[2][1]=[] and t[2][2]=fam!.oneCoefficient then
return PolynomialByExtRepNC(fam,num);
else
@@ -1152,9 +1164,9 @@ local fam,t,num,tt,den;
tt:=TryGcdCancelExtRepPolynomials(fam,
ExtRepNumeratorRatFun(right),ExtRepDenominatorRatFun(left));
num:=ZippedProduct(t[1],tt[1],fam!.zeroCoefficient,
- fam!.zippedProduct);
+ fam!.zippedProduct);
den:=ZippedProduct(t[2],tt[2],fam!.zeroCoefficient,
- fam!.zippedProduct);
+ fam!.zippedProduct);
if Length(den)=2 and den[1]=[] and den[2]=fam!.oneCoefficient then
return PolynomialByExtRepNC(fam,num);
else
@@ -1219,14 +1231,14 @@ local fam,num,den,lnum,rnum,lden,rden,t,tmp,tmpp,i;
# same denominator: add numerators
num:=ZippedSum(lnum,rnum,fam!.zeroCoefficient,fam!.zippedSum);
if Length(num)=0 then
- return Zero(fam);
+ return Zero(fam);
fi;
t:=TryGcdCancelExtRepPolynomials(fam,num,lden);
if Length(t[2])=2 and Length(t[2][1])=0 and t[2][2]=fam!.oneCoefficient
then
- return PolynomialByExtRepNC(fam,t[1]);
+ return PolynomialByExtRepNC(fam,t[1]);
else
- return RationalFunctionByExtRepNC(fam,t[1],t[2]);
+ return RationalFunctionByExtRepNC(fam,t[1],t[2]);
fi;
else
t:=TryGcdCancelExtRepPolynomials(fam,lden,rden);
@@ -1236,9 +1248,9 @@ local fam,num,den,lnum,rnum,lden,rden,t,tmp,tmpp,i;
fam!.zippedProduct);
num:=ZippedSum(tmp,tmpp,fam!.zeroCoefficient,fam!.zippedSum);
if Length(t)=3 then
- tmp:=t[3];
+ tmp:=t[3];
else
- tmp:=QuotientPolynomialsExtRep(fam,rden,t[2]);
+ tmp:=QuotientPolynomialsExtRep(fam,rden,t[2]);
fi;
tmpp:=TryGcdCancelExtRepPolynomials(fam,num,tmp);
den:=ZippedProduct(tmpp[2],t[1],fam!.zeroCoefficient,