Skip to content

Commit

Permalink
Add cycle_length for PermGroupElem (#4359)
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin authored Nov 28, 2024
1 parent 39afcf9 commit 2cba15c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/GAP/wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ GAP.@wrap ConjugateSubgroup(x::GapObj, y::GapObj)::GapObj
GAP.@wrap Core(x::GapObj, y::GapObj)::GapObj
GAP.@wrap CycleFromList(x::GapObj)::GapObj
GAP.@wrap CycleStructurePerm(x::GapObj)::GapObj
GAP.@wrap CYCLE_LENGTH_PERM_INT(x::GapObj, y::Int)::Int
GAP.@wrap CycList(x::GapObj)::GapInt
GAP.@wrap CyclotomicPol(x::Int)::GapObj
GAP.@wrap DecomposeTensorProduct(x::GapObj, y::GapObj, z::GapObj)::GapObj
Expand Down
21 changes: 21 additions & 0 deletions src/Groups/perm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,27 @@ function cycles(g::PermGroupElem)
return cycles
end

@doc raw"""
cycle_length(g::PermGroupElem, i::IntegerUnion)
Return the length of the cycle of `i` under the action of the permutation `g`.
# Examples
```jldoctest
julia> g = cperm(1:3, 6:7, 8:10, 11:15)
(1,2,3)(6,7)(8,9,10)(11,12,13,14,15)
julia> cycle_length(g, 1)
3
julia> cycle_length(g, 4)
1
```
"""
function cycle_length(g::PermGroupElem, i::IntegerUnion)
return GAPWrap.CYCLE_LENGTH_PERM_INT(GapObj(g), GapObj(i))
end

################################################################################
#
# _perm_helper
Expand Down
1 change: 1 addition & 0 deletions src/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ export cox_variety
export cperm
export cross_polytope
export cube
export cycle_length
export cycle_matroid
export cycle_structure
export cycle_structures
Expand Down

0 comments on commit 2cba15c

Please sign in to comment.