Skip to content

Commit

Permalink
Change most uses of GAP.julia_to_gap to GAP.Obj
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Oct 7, 2022
1 parent f3a3d8c commit 3332dce
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions experimental/GModule/Cohomology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions experimental/GModule/GModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion experimental/GaloisGrp/GaloisGrp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,7 @@ function starting_group(GC::GaloisCtx, K::T; useSubfields::Bool = true) where T

#TODO: wrap this properly
if hasproperty(GAP.Globals, :ConStabilize)
tmp = [GAP.Globals.ConStabilize(GAP.Obj(sort(o), recursive=true), GAP.Globals.OnSetsSets) for o in O]
tmp = [GAP.Globals.ConStabilize(GAP.julia_to_gap(sort(o), recursive=true), GAP.Globals.OnSetsSets) for o in O]
H = GAP.Globals.Solve(GAP.Obj(vcat(GAP.Globals.ConInGroup(G.X), tmp)))
G = Oscar._as_subgroup(G, H)[1]
else
Expand Down
4 changes: 2 additions & 2 deletions src/Groups/GAPGroups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion src/Groups/abelian_aut.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Groups/cosets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Groups/group_characters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ Currently the following series are supported.
"""
function character_table(series::Symbol, parameter::Union{Int, Vector{Int}})
hasproperty(GAP.Globals, :CTblLib) || error("no character table library available")
args = GAP.Obj([string(series), parameter], recursive = true)
args = GAP.julia_to_gap([string(series), parameter], recursive = true)
tbl = GAP.Globals.CallFuncList(GAP.Globals.CharacterTable, args)::GapObj
tbl === GAP.Globals.fail && return nothing
tbl = GAPGroupCharacterTable(tbl, 0)
Expand Down
2 changes: 1 addition & 1 deletion src/Groups/group_constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
=#
Expand Down
12 changes: 6 additions & 6 deletions src/Groups/gsets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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):
Expand All @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions src/Groups/homomorphisms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Groups/matrices/MatGrp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/Groups/perm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Groups/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ and `MatrixGroup`.
abstract type GAPGroup <: AbstractAlgebra.Group end

## `GapGroup` to GAP group
GAP.julia_to_gap(obj::GAPGroup) = obj.X
GAP.Obj(obj::GAPGroup) = obj.X

@doc Markdown.doc"""
GAPGroupElem <: AbstractAlgebra.GroupElem
Expand All @@ -45,7 +45,7 @@ i.e., if `g` is a `GAPGroupElem`, then `GapObj(g)` is the `GapObj` underlying `g
abstract type GAPGroupElem{T<:GAPGroup} <: AbstractAlgebra.GroupElem end

## `GapGroupElem` to GAP group element
GAP.julia_to_gap(obj::GAPGroupElem) = obj.X
GAP.Obj(obj::GAPGroupElem) = obj.X

@doc Markdown.doc"""
BasicGAPGroupElem{T<:GAPGroup} <: GAPGroupElem{T}
Expand Down
2 changes: 1 addition & 1 deletion src/Rings/AbelianClosure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3332dce

Please sign in to comment.