mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2025-03-15 00:42:11 +01:00
Add headers
This commit is contained in:
parent
ffe0e901b2
commit
1fc4405b77
@ -2,6 +2,12 @@ using Permutations
|
|||||||
|
|
||||||
import Base: convert
|
import Base: convert
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# AutSymbol/ AutGroup / AutGroupElem
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
immutable AutSymbol <: GSymbol
|
immutable AutSymbol <: GSymbol
|
||||||
gen::String
|
gen::String
|
||||||
pow::Int
|
pow::Int
|
||||||
@ -18,11 +24,21 @@ end
|
|||||||
|
|
||||||
export AutSymbol, AutGroupElem, AutGroup
|
export AutSymbol, AutGroupElem, AutGroup
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Type and parent object methods
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
elem_type(::AutGroup) = AutGroupElem
|
elem_type(::AutGroup) = AutGroupElem
|
||||||
|
|
||||||
parent_type(::AutGroupElem) = AutGroup
|
parent_type(::AutGroupElem) = AutGroup
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# AutSymbol defining functions
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
function ϱ(i,j, pow=1)
|
function ϱ(i,j, pow=1)
|
||||||
# @assert i ≠ j
|
# @assert i ≠ j
|
||||||
@ -85,6 +101,12 @@ function getperm(s::AutSymbol)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# AutGroup / AutGroupElem constructors
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
function AutGroup(G::FPGroup; outer=false, special=false)
|
function AutGroup(G::FPGroup; outer=false, special=false)
|
||||||
length(G.rels) == 0 || throw("Don't know how to construct AutGroup of $G.")
|
length(G.rels) == 0 || throw("Don't know how to construct AutGroup of $G.")
|
||||||
n = length(G.generators)
|
n = length(G.generators)
|
||||||
@ -103,6 +125,11 @@ function AutGroup(G::FPGroup; outer=false, special=false)
|
|||||||
return new(G, S)
|
return new(G, S)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Types call overloads
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
function (f::AutSymbol){T}(v::Vector{GWord{T}})
|
function (f::AutSymbol){T}(v::Vector{GWord{T}})
|
||||||
if f.pow == 0
|
if f.pow == 0
|
||||||
@ -118,6 +145,11 @@ function (F::AutGroupElem)(v)
|
|||||||
return v
|
return v
|
||||||
end
|
end
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Basic manipulation
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
hash(s::AutSymbol, h::UInt) = hash(s.gen, hash(s.pow, hash(:AutSymbol, h)))
|
hash(s::AutSymbol, h::UInt) = hash(s.gen, hash(s.pow, hash(:AutSymbol, h)))
|
||||||
|
|
||||||
@ -145,11 +177,40 @@ end
|
|||||||
|
|
||||||
generators(G::AutGroup) = [G(AutGroupElem(elt)) for elt in G.generators]
|
generators(G::AutGroup) = [G(AutGroupElem(elt)) for elt in G.generators]
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# String I/O
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Comparison
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
(==)(s::AutSymbol, t::AutSymbol) = s.gen == t.gen && s.pow == t.pow
|
(==)(s::AutSymbol, t::AutSymbol) = s.gen == t.gen && s.pow == t.pow
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Binary operators
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Inversion
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
inv(f::AutSymbol) = change_pow(f, -f.pow)
|
inv(f::AutSymbol) = change_pow(f, -f.pow)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Misc
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
function simplify_perms!(W::AutGroupElem)
|
function simplify_perms!(W::AutGroupElem)
|
||||||
reduced = true
|
reduced = true
|
||||||
for i in 1:length(W.symbols) - 1
|
for i in 1:length(W.symbols) - 1
|
||||||
|
Loading…
Reference in New Issue
Block a user