From 2d2baf1da19f512e95e972e959c966ee7ee4f65e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 12 Jul 2019 12:18:06 +0200 Subject: [PATCH] Prefer using BaseDomain over BaseField However, leave the documentation untouched (at least for now), as cvec users certainly are used to using BaseField --- gap/cmat.gi | 9 ++++++--- gap/cvec.gi | 7 +++++-- gap/linalg.gi | 2 +- gap/quarry.g | 10 +++++----- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/gap/cmat.gi b/gap/cmat.gi index 4ca2e5b..3ff1370 100644 --- a/gap/cmat.gi +++ b/gap/cmat.gi @@ -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 ); @@ -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) @@ -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: diff --git a/gap/cvec.gi b/gap/cvec.gi index 5a45ef7..9f8ab5a 100644 --- a/gap/cvec.gi +++ b/gap/cvec.gi @@ -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: ############################################################################# diff --git a/gap/linalg.gi b/gap/linalg.gi index 93e8fab..b7c9ce0 100644 --- a/gap/linalg.gi +++ b/gap/linalg.gi @@ -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); diff --git a/gap/quarry.g b/gap/quarry.g index ab0e198..036abf9 100644 --- a/gap/quarry.g +++ b/gap/quarry.g @@ -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; @@ -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 @@ -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); @@ -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 @@ -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