From 8766d8b8f0de93ddb243bab689dd9193d27f6e33 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 6 Oct 2022 14:43:24 +0200 Subject: [PATCH] Change most uses of GAP.julia_to_gap to GAP.Obj --- experimental/GModule/Cohomology.jl | 20 ++++++++++---------- experimental/GModule/GModule.jl | 4 ++-- src/Groups/GAPGroups.jl | 6 +++--- src/Groups/abelian_aut.jl | 2 +- src/Groups/cosets.jl | 2 +- src/Groups/directproducts.jl | 2 +- src/Groups/group_constructors.jl | 4 ++-- src/Groups/gsets.jl | 12 ++++++------ src/Groups/homomorphisms.jl | 6 +++--- src/Groups/matrices/MatGrp.jl | 2 +- src/Groups/perm.jl | 4 ++-- src/Rings/AbelianClosure.jl | 2 +- test/Groups/matrixgroups.jl | 8 ++++---- 13 files changed, 37 insertions(+), 37 deletions(-) diff --git a/experimental/GModule/Cohomology.jl b/experimental/GModule/Cohomology.jl index d8952d3715b0..3f672d931bc9 100644 --- a/experimental/GModule/Cohomology.jl +++ b/experimental/GModule/Cohomology.jl @@ -160,7 +160,7 @@ function Oscar.relations(G::Oscar.GAPGroup) end function Oscar.relations(G::PcGroup) - f = GAP.Globals.IsomorphismFpGroupByPcgs(GAP.Globals.FamilyPcgs(G.X), GAP.julia_to_gap("g")) + f = GAP.Globals.IsomorphismFpGroupByPcgs(GAP.Globals.FamilyPcgs(G.X), GAP.Obj("g")) f !=GAP.Globals.fail || throw(ArgumentError("Could not convert group into a group of type FPGroup")) H = FPGroup(GAPWrap.Image(f)) return relations(H) @@ -1138,7 +1138,7 @@ function pc_group(M::GrpAbFinGen; refine::Bool = true) h = rels(M) @assert !any(x->h[x,x] == 1, 1:ncols(h)) - C = GAP.Globals.SingleCollector(G.X, GAP.julia_to_gap([h[i,i] for i=1:nrows(h)], recursive = true)) + C = GAP.Globals.SingleCollector(G.X, GAP.Obj([h[i,i] for i=1:nrows(h)], recursive = true)) F = GAP.Globals.FamilyObj(GAP.Globals.Identity(G.X)) for i=1:ngens(M)-1 @@ -1148,7 +1148,7 @@ function pc_group(M::GrpAbFinGen; refine::Bool = true) push!(r, -h[i, j]) GAP.Globals.SetConjugate(C, j, i, gen(G, j).X) end - rr = GAP.Globals.ObjByExtRep(F, GAP.julia_to_gap(r, recursive = true)) + rr = GAP.Globals.ObjByExtRep(F, GAP.Obj(r, recursive = true)) GAP.Globals.SetPower(C, i, rr) end @@ -1163,7 +1163,7 @@ function pc_group(M::GrpAbFinGen; refine::Bool = true) push!(r, a[i]) end end - return GAP.Globals.ObjByExtRep(FB, GAP.julia_to_gap(r, recursive = true)) + return GAP.Globals.ObjByExtRep(FB, GAP.Obj(r, recursive = true)) end gap_to_julia = function(a::GAP.GapObj) @@ -1209,7 +1209,7 @@ function pc_group(M::Generic.FreeModule{<:FinFieldElem}; refine::Bool = true) G = free_group(degree(k)*dim(M)) C = GAP.Globals.CombinatorialCollector(G.X, - GAP.julia_to_gap([p for i=1:ngens(G)], recursive = true)) + GAP.Obj([p for i=1:ngens(G)], recursive = true)) F = GAP.Globals.FamilyObj(GAP.Globals.Identity(G.X)) B = PcGroup(GAP.Globals.GroupByRws(C)) @@ -1223,7 +1223,7 @@ function pc_group(M::Generic.FreeModule{<:FinFieldElem}; refine::Bool = true) push!(r, lift(a[i])) end end - g = GAP.Globals.ObjByExtRep(FB, GAP.julia_to_gap(r, recursive = true)) + g = GAP.Globals.ObjByExtRep(FB, GAP.Obj(r, recursive = true)) return g end @@ -1239,7 +1239,7 @@ function pc_group(M::Generic.FreeModule{<:FinFieldElem}; refine::Bool = true) end end end - g = GAP.Globals.ObjByExtRep(FB, GAP.julia_to_gap(r, recursive = true)) + g = GAP.Globals.ObjByExtRep(FB, GAP.Obj(r, recursive = true)) return g end @@ -1450,12 +1450,12 @@ function extension(::Type{PcGroup}, c::CoChain{2,<:Oscar.PcGroupElem}) end end -# l = GAP.julia_to_gap([]) +# l = GAP.Obj([]) # GAP.Globals.FinitePolycyclicCollector_IsConfluent(CN, l) # @show l # z = GAP.Globals.GroupByRwsNC(CN) -# s = GAP.Globals.GapInputPcGroup(z, GAP.julia_to_gap("Z")) +# s = GAP.Globals.GapInputPcGroup(z, GAP.Obj("Z")) # @show GAP.gap_to_julia(s) Q = PcGroup(GAP.Globals.GroupByRws(CN)) fQ = GAP.Globals.FamilyObj(one(Q).X) @@ -1478,7 +1478,7 @@ function extension(::Type{PcGroup}, c::CoChain{2,<:Oscar.PcGroupElem}) push!(wg, wm[i]+ngens(G)) push!(wg, wm[i+1]) end - return mQ(FPGroupElem(N, GAP.Globals.ObjByExtRep(FN, GAP.julia_to_gap(wg)))) + return mQ(FPGroupElem(N, GAP.Globals.ObjByExtRep(FN, GAP.Obj(wg)))) end return Q, inv(mfM)*MtoQ, QtoG, GMtoQ diff --git a/experimental/GModule/GModule.jl b/experimental/GModule/GModule.jl index 11631b7238d0..a549345d42a0 100644 --- a/experimental/GModule/GModule.jl +++ b/experimental/GModule/GModule.jl @@ -741,7 +741,7 @@ function Gap(C::GModule{<:Any, <:Generic.FreeModule{<:FinFieldElem}}, h=Oscar.is if z !== nothing return z end - z = GAP.Globals.GModuleByMats(GAP.julia_to_gap([GAP.julia_to_gap(map(h, Matrix(mat(x)))) for x = C.ac]), codomain(h)) + z = GAP.Globals.GModuleByMats(GAP.Obj([GAP.Obj(map(h, Matrix(mat(x)))) for x = C.ac]), codomain(h)) set_attribute!(C, :Gap=>z) return z end @@ -1130,7 +1130,7 @@ export irreducible_modules, is_absolutely_irreducible, is_decomposable ## Fill in some stubs for Hecke function _to_gap(h, x::Vector) - return GAP.Globals.GModuleByMats(GAP.julia_to_gap([GAP.julia_to_gap(map(h, Matrix(y))) for y in x]), codomain(h)) + return GAP.Globals.GModuleByMats(GAP.Obj([GAP.Obj(map(h, Matrix(y))) for y in x]), codomain(h)) end function _gap_matrix_to_julia(h, g) diff --git a/src/Groups/GAPGroups.jl b/src/Groups/GAPGroups.jl index ab5444fe2429..242fa04be2ad 100644 --- a/src/Groups/GAPGroups.jl +++ b/src/Groups/GAPGroups.jl @@ -1084,7 +1084,7 @@ function hall_subgroup(G::GAPGroup, P::AbstractVector{<:IntegerUnion}) P = unique(P) all(is_prime, P) || throw(ArgumentError("The integers must be prime")) is_solvable(G) || throw(ArgumentError("The group is not solvable")) - return _as_subgroup(G,GAP.Globals.HallSubgroup(G.X,GAP.julia_to_gap(P, recursive=true))) + return _as_subgroup(G,GAP.Globals.HallSubgroup(G.X,GAP.Obj(P, recursive=true))) end """ @@ -1124,7 +1124,7 @@ julia> h = hall_subgroup_reps(g, [2, 7]); length(h) function hall_subgroup_reps(G::GAPGroup, P::AbstractVector{<:IntegerUnion}) P = unique(P) all(is_prime, P) || throw(ArgumentError("The integers must be prime")) - res_gap = GAP.Globals.HallSubgroup(G.X, GAP.julia_to_gap(P))::GapObj + res_gap = GAP.Globals.HallSubgroup(G.X, GAP.Obj(P))::GapObj if res_gap == GAP.Globals.fail return typeof(G)[] elseif GAPWrap.IsList(res_gap) @@ -1393,7 +1393,7 @@ has_prime_of_pgroup(G::GAPGroup) = has__prime_of_pgroup(G) Set the value for `prime_of_pgroup(G)` to `p` if it has't been set already. """ function set_prime_of_pgroup(G::GAPGroup, p::IntegerUnion) - set__prime_of_pgroup(G, GAP.julia_to_gap(p)) + set__prime_of_pgroup(G, GAP.Obj(p)) end diff --git a/src/Groups/abelian_aut.jl b/src/Groups/abelian_aut.jl index cf897c21c229..fb17345b6f27 100644 --- a/src/Groups/abelian_aut.jl +++ b/src/Groups/abelian_aut.jl @@ -79,7 +79,7 @@ function (aut::AutGrpAbTor)(f::Union{GrpAbFinGenMap,TorQuadModMor};check::Bool=t return b.X end gene = GAP.Globals.GeneratorsOfGroup(AA) - img = GAP.julia_to_gap([img_gap(a) for a in gene]) + img = GAP.Obj([img_gap(a) for a in gene]) fgap = GAP.Globals.GroupHomomorphismByImagesNC(AA,AA,img) return aut(fgap) end diff --git a/src/Groups/cosets.jl b/src/Groups/cosets.jl index ea8cf41ec53b..df5ed86f2863 100644 --- a/src/Groups/cosets.jl +++ b/src/Groups/cosets.jl @@ -364,7 +364,7 @@ function intersect(V::AbstractVector{Union{T, GroupCoset, GroupDoubleCoset}}) wh else G = V[1].G end - l = GAP.julia_to_gap([v.X for v in V]) + l = GAP.Obj([v.X for v in V]) ints = GAP.Globals.Intersection(l) L = Vector{typeof(G)}(undef, length(ints)) for i in 1:length(ints) diff --git a/src/Groups/directproducts.jl b/src/Groups/directproducts.jl index 6bfbdd946bcf..845fef7d2cb4 100644 --- a/src/Groups/directproducts.jl +++ b/src/Groups/directproducts.jl @@ -79,7 +79,7 @@ function inner_direct_product(L::AbstractVector{T}; morphisms=false) where T<:Un end function inner_direct_product(L::AbstractVector{PermGroup}; morphisms=false) - P = GAP.Globals.DirectProductOfPermGroupsWithMovedPoints(GapObj([G.X for G in L]), GAP.julia_to_gap([collect(1:degree(G)) for G in L], recursive = true)) + P = GAP.Globals.DirectProductOfPermGroupsWithMovedPoints(GapObj([G.X for G in L]), GAP.Obj([collect(1:degree(G)) for G in L], recursive = true)) DP = PermGroup(P, sum([degree(G) for G in L], init = 0)) if morphisms emb = [GAPGroupHomomorphism(L[i],DP,GAP.Globals.Embedding(P,i)) for i in 1:length(L)] diff --git a/src/Groups/group_constructors.jl b/src/Groups/group_constructors.jl index b17db21d154c..690802364e3b 100644 --- a/src/Groups/group_constructors.jl +++ b/src/Groups/group_constructors.jl @@ -145,7 +145,7 @@ function abelian_group(v::Vector{Int}) for i = 1:length(v) iszero(v[i]) && error("Cannot represent an infinite group as a polycyclic group") end - v1 = GAP.julia_to_gap(v) + v1 = GAP.Obj(v) return PcGroup(GAP.Globals.AbelianGroup(v1)) end =# @@ -168,7 +168,7 @@ function abelian_group(::Type{T}, v::Vector{Int}) where T <: GAPGroup end function abelian_group(::Type{T}, v::Vector{fmpz}) where T <: GAPGroup - vgap = GAP.julia_to_gap(v, recursive=true) + vgap = GAP.Obj(v, recursive=true) return T(GAP.Globals.AbelianGroup(_gap_filter(T), vgap)::GapObj) end diff --git a/src/Groups/gsets.jl b/src/Groups/gsets.jl index 1117e1f2ee5b..515ed9a24c98 100644 --- a/src/Groups/gsets.jl +++ b/src/Groups/gsets.jl @@ -418,8 +418,8 @@ julia> permutation(Omega, x) ``` """ function permutation(Omega::GSetByElements{T}, g::GAPGroupElem) where T<:GAPGroup - omega_list = GAP.julia_to_gap(elements(Omega)) - gfun = GAP.julia_to_gap(action_function(Omega)) + omega_list = GAP.Obj(elements(Omega)) + gfun = GAP.Obj(action_function(Omega)) # The following works only because GAP does not check # whether the given group element 'g' is a group element. @@ -494,13 +494,13 @@ true """ @attr GAPGroupHomomorphism{T, PermGroup} function action_homomorphism(Omega::GSetByElements{T}) where T<:GAPGroup G = acting_group(Omega) - omega_list = GAP.julia_to_gap(collect(Omega)) + omega_list = GAP.Obj(collect(Omega)) gap_gens = map(x -> x.X, gens(G)) - gfun = GAP.julia_to_gap(action_function(Omega)) + gfun = GAP.Obj(action_function(Omega)) # The following works only because GAP does not check # whether the given generators in GAP and Julia fit together. - acthom = GAP.Globals.ActionHomomorphism(G.X, omega_list, GAP.julia_to_gap(gap_gens), GAP.julia_to_gap(gens(G)), gfun) + acthom = GAP.Globals.ActionHomomorphism(G.X, omega_list, GAP.Obj(gap_gens), GAP.Obj(gens(G)), gfun) # The first difficulty on the GAP side is `ImagesRepresentative` # (which is the easy direction of the action homomorphism): @@ -516,7 +516,7 @@ true # (Yes, this is also overhead. # The alternative would be to create a new type of Oscar homomorphism, # which uses `permutation` or something better for mapping elements.) - GAP.Globals.SetJuliaData(acthom, GAP.julia_to_gap([Omega, G])) + GAP.Globals.SetJuliaData(acthom, GAP.Obj([Omega, G])) sym = get_attribute!(Omega, :action_range) do return symmetric_group(length(Omega)) diff --git a/src/Groups/homomorphisms.jl b/src/Groups/homomorphisms.jl index 77c85413585e..01f5d0509076 100644 --- a/src/Groups/homomorphisms.jl +++ b/src/Groups/homomorphisms.jl @@ -102,7 +102,7 @@ function hom(G::GAPGroup, H::GAPGroup, img::Function) img_el = img(el) return img_el.X end - mp = GAP.Globals.GroupHomomorphismByFunction(G.X, H.X, GAP.julia_to_gap(gap_fun)) + mp = GAP.Globals.GroupHomomorphismByFunction(G.X, H.X, GAP.Obj(gap_fun)) return GAPGroupHomomorphism(G, H, mp) end @@ -122,9 +122,9 @@ function hom(G::GAPGroup, H::GAPGroup, img::Function, preimg::Function; is_known end if is_known_to_be_bijective - mp = GAP.Globals.GroupHomomorphismByFunction(G.X, H.X, GAP.julia_to_gap(gap_fun), GAP.julia_to_gap(gap_pre_fun)) + mp = GAP.Globals.GroupHomomorphismByFunction(G.X, H.X, GAP.Obj(gap_fun), GAP.Obj(gap_pre_fun)) else - mp = GAP.Globals.GroupHomomorphismByFunction(G.X, H.X, GAP.julia_to_gap(gap_fun), false, GAP.julia_to_gap(gap_pre_fun)) + mp = GAP.Globals.GroupHomomorphismByFunction(G.X, H.X, GAP.Obj(gap_fun), false, GAP.Obj(gap_pre_fun)) end return GAPGroupHomomorphism(G, H, mp) diff --git a/src/Groups/matrices/MatGrp.jl b/src/Groups/matrices/MatGrp.jl index 498783681684..e39a4059fd48 100644 --- a/src/Groups/matrices/MatGrp.jl +++ b/src/Groups/matrices/MatGrp.jl @@ -806,7 +806,7 @@ matrix_group(V::T...) where T<:Union{MatElem,MatrixGroupElem} = matrix_group(col function sub(G::MatrixGroup, elements::Vector{S}) where S <: GAPGroupElem @assert elem_type(G) === S - elems_in_GAP = GAP.julia_to_gap(GapObj[x.X for x in elements]) + elems_in_GAP = GAP.Obj(GapObj[x.X for x in elements]) H = GAP.Globals.Subgroup(G.X,elems_in_GAP)::GapObj #H is the group. I need to return the inclusion map too K,f = _as_subgroup(G, H) diff --git a/src/Groups/perm.jl b/src/Groups/perm.jl index fecd3e54e9fb..8299b67ed978 100644 --- a/src/Groups/perm.jl +++ b/src/Groups/perm.jl @@ -286,7 +286,7 @@ function cperm(L::AbstractVector{T}...) where T <: IntegerUnion if length(L)==0 return one(symmetric_group(1)) else - return prod([PermGroupElem(symmetric_group(maximum(y)), GAP.Globals.CycleFromList(GAP.julia_to_gap([Int(k) for k in y]))) for y in L]) + return prod([PermGroupElem(symmetric_group(maximum(y)), GAP.Globals.CycleFromList(GAP.Obj([Int(k) for k in y]))) for y in L]) #TODO: better create the product of GAP permutations? end end @@ -298,7 +298,7 @@ function cperm(g::PermGroup,L::AbstractVector{T}...) where T <: IntegerUnion if length(L)==0 return one(g) else - x=prod(y -> GAP.Globals.CycleFromList(GAP.julia_to_gap([Int(k) for k in y])), L) + x=prod(y -> GAP.Globals.CycleFromList(GAP.Obj([Int(k) for k in y])), L) if length(L) <= degree(g) && x in g.X return PermGroupElem(g, x) else diff --git a/src/Rings/AbelianClosure.jl b/src/Rings/AbelianClosure.jl index 1c6e56ee7e58..656217fc04e9 100644 --- a/src/Rings/AbelianClosure.jl +++ b/src/Rings/AbelianClosure.jl @@ -831,7 +831,7 @@ Base.conj(elm::QQAbElem) = elm^QQAbAutomorphism(-1) ############################################################################### function generators_galois_group_cyclotomic_field(n::Int) - res = GAP.Globals.GeneratorsPrimeResidues(GAP.julia_to_gap(n)) + res = GAP.Globals.GeneratorsPrimeResidues(GAP.Obj(n)) return [QQAbAutomorphism(k) for k in Vector{Int}(GAP.Globals.Flat(res.generators))] end diff --git a/test/Groups/matrixgroups.jl b/test/Groups/matrixgroups.jl index 17fb216a9a86..a8c8ea1eccfe 100644 --- a/test/Groups/matrixgroups.jl +++ b/test/Groups/matrixgroups.jl @@ -22,7 +22,7 @@ # for i in 1:3 # xg[i] = GAP.GapObj([preimage(G.ring_iso, xo[i,j]) for j in 1:3]) # end -# xg=GAP.julia_to_gap(xg) +# xg=GAP.Obj(xg) xg = GAP.GapObj([[G.ring_iso(xo[i,j]) for j in 1:3] for i in 1:3]; recursive=true) @test map_entries(G.ring_iso, xo) == xg @@ -58,9 +58,9 @@ xo = matrix(F,3,3,[1,z,0,0,1,2*z+1,0,0,z+2]) xg = Vector{GAP.GapObj}(undef, 3) for i in 1:3 - xg[i] = GAP.julia_to_gap([G.ring_iso(xo[i,j]) for j in 1:3]) + xg[i] = GAP.Obj([G.ring_iso(xo[i,j]) for j in 1:3]) end - xg=GAP.julia_to_gap(xg) + xg=GAP.Obj(xg) @test map_entries(G.ring_iso, xo) == xg @test Oscar.preimage_matrix(G.ring_iso, xg) == xo @test Oscar.preimage_matrix(G.ring_iso, GAP.Globals.One(GAP.Globals.GL(3, codomain(G.ring_iso)))) == matrix(one(G)) @@ -134,7 +134,7 @@ end @test (g\x) * (g\y) == g\(x * y) @test g(g\x) == x end - H = GAP.Globals.Group(GAP.julia_to_gap(gens(G0); recursive=true)) + H = GAP.Globals.Group(GAP.Obj(gens(G0); recursive=true)) f = GAP.Globals.GroupHomomorphismByImages(G.X, H) @test GAP.Globals.IsBijective(f) @test order(G) == GAP.Globals.Order(H)