Skip to content

Commit

Permalink
Prefer using BaseDomain over BaseField
Browse files Browse the repository at this point in the history
However, leave the documentation untouched (at least for now), as
cvec users certainly are used to using BaseField
  • Loading branch information
fingolfin committed Jul 12, 2019
1 parent 324ade5 commit 2d2baf1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
9 changes: 6 additions & 3 deletions gap/cmat.gi
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ InstallMethod( ExtractSubMatrix, "for a compressed 8bit matrix",
function(m, rows, cols)
local mm,s;
mm := m{rows}{cols};
s := Size(BaseField(m));
s := Size(BaseDomain(m));
ConvertToMatrixRep(mm,s);
return mm;
end );
Expand Down Expand Up @@ -1219,13 +1219,16 @@ InstallMethod( BaseDomain, "for a cmat", [IsCMatRep],
return c![CVEC_IDX_GF];
end);

# compatibility with GAP <= 4.11
if IsBound(BaseField) and not IsIdenticalObj(BaseDomain, BaseField) then
InstallMethod( BaseField, "for a cmat", [IsCMatRep],
function(m)
local c;
c := m!.vecclass;
return c![CVEC_IDX_GF];
end);

fi;

InstallMethod(FieldOfMatrixList,
[IsListOrCollection and IsFFECollCollColl],1,
function(l)
Expand Down Expand Up @@ -2725,7 +2728,7 @@ InstallGlobalFunction( CVEC_ValueLaurentPoly,
if not(IsOne(s)) then
for j in [1..n] do MultVector(val[j],s); od;
fi;
o := One(BaseField(x));
o := One(BaseDomain(x));
while true do
i := i - 1;
# Add a multiple of the identity:
Expand Down
7 changes: 5 additions & 2 deletions gap/cvec.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1073,14 +1073,17 @@ InstallMethod( BaseDomain, "for cvecs", [IsCVecRep],
c := DataObj(v);
return c![CVEC_IDX_GF];
end);


# compatibility with GAP <= 4.11
if IsBound(BaseField) and not IsIdenticalObj(BaseDomain, BaseField) then
InstallMethod( BaseField, "for cvecs", [IsCVecRep],
function(v)
local c;
c := DataObj(v);
return c![CVEC_IDX_GF];
end);

fi;

#############################################################################
# Slicing:
#############################################################################
Expand Down
2 changes: 1 addition & 1 deletion gap/linalg.gi
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ InstallGlobalFunction( CVEC_MinimalPolynomial, function(m)
d := NumberRows(m);
b := EmptySemiEchelonBasis(m);
pivs := [1..d];
f := BaseField(m);
f := BaseDomain(m);
poly := One(PolynomialRing(f,[1]));
o := One(f);
fam := FamilyObj(o);
Expand Down
10 changes: 5 additions & 5 deletions gap/quarry.g
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ InstallMethod( LazyGreaser, "for a vector and a positive grease level",
function( vecs, lev )
local lg;
lg := rec( vecs := vecs, tab := vecs{[]}, ind := [], lev := lev,
fs := Size(BaseField(vecs)) );
fs := Size(BaseDomain(vecs)) );
if lg.fs > 65536 then
Error("Lazy grease only supported for fields with <= 65536 elements");
return;
Expand Down Expand Up @@ -96,7 +96,7 @@ CVEC_TESTLAZY := function(m,lev)
local erg,f,i,j,l,offset,newpos,poss,v,w;
v := ShallowCopy(m[1]);
l := LazyGreaser(m,lev);
f := BaseField(m);
f := BaseDomain(m);
offset := Random(1,Length(m)-lev+1);
offset := QuoInt(offset-1,lev)*lev + 1; # make it congruent 1 mod lev
for i in [1..10000] do
Expand Down Expand Up @@ -205,7 +205,7 @@ InstallGlobalFunction( CVEC_RelativeOrderPoly, function( m, v, subb, indetnr )
# is bound.
# The original v is untouched!
local A,B,b,closed,d,dec,f,fam,i,l,lambda,o,ordpol,vcopy,vl,vv;
f := BaseField(m);
f := BaseDomain(m);
o := One(f);
fam := FamilyObj(o);
b := EmptySemiEchelonBasis(v);
Expand Down Expand Up @@ -333,7 +333,7 @@ function( m, eps, verify, indetnr )
A := []; # base changes within each subquotient
l := []; # a list of semi echelon bases for the subquotients
# order polynomial infrastructure (grows over time):
opi := rec( f := BaseField(m),
opi := rec( f := BaseDomain(m),
d := [],
ranges := [],
rordpols := [], # list of relative order polynomials
Expand Down Expand Up @@ -495,7 +495,7 @@ InstallGlobalFunction( CVEC_NewMinimalPolynomial, function( m, indetnr )
A := []; # base changes within each subquotient
l := []; # a list of semi echelon bases for the subquotients
# order polynomial infrastructure (grows over time):
opi := rec( f := BaseField(m),
opi := rec( f := BaseDomain(m),
d := [],
ranges := [],
rordpols := [], # list of relative order polynomials
Expand Down

0 comments on commit 2d2baf1

Please sign in to comment.