diff --git a/lib/classic.gi b/lib/classic.gi index 859bd86..7bcfc71 100644 --- a/lib/classic.gi +++ b/lib/classic.gi @@ -43,18 +43,39 @@ BindGlobal( "_IsEqualModScalars", return IsZero( mat2 ); end ); +# The following helper function provides compatibility +# with older GAP versions. +# Before gap-system/gap/pull/6203, 'FieldOfMatrixGroup( G )' was interpreted +# as the field of definition of the invariant forms stored in 'G'. +# This was not always correct, hence we decided to add a component +# 'baseDomain' to the records that describe the invariant forms created with +# 'InvariantBilinearForm' etc. +BindGlobal("Forms_FieldOfDefinition", function( form_record, G ) + if IsBound( form_record.baseDomain ) then + return form_record.baseDomain; + else + return FieldOfMatrixGroup( G ); + fi; +end ); + BindGlobal("Forms_OrthogonalGroup", function( g, form ) local stored, gf, d, wanted, mat1, mat2, mat, matinv, gens, gg; - stored:= InvariantQuadraticForm( g ).matrix; + stored:= InvariantQuadraticForm( g ); + gf:= Forms_FieldOfDefinition( stored, g ); + stored:= stored.matrix; + + # Check that 'form' lives over the intended field. + if not IsSubset( gf, form!.basefield ) then + Error( "the defining field of