mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-12-26 02:20:30 +01:00
some eye-candy
This commit is contained in:
parent
66a33e7c72
commit
979ffaccfa
@ -84,6 +84,17 @@ Base.show(io::IO, ::Type{<:FPGroupElement{<:AutomorphismGroup{T}}}) where {T} =
|
|||||||
|
|
||||||
Base.show(io::IO, A::AutomorphismGroup) = print(io, "automorphism group of ", object(A))
|
Base.show(io::IO, A::AutomorphismGroup) = print(io, "automorphism group of ", object(A))
|
||||||
|
|
||||||
|
|
||||||
|
function Base.show(io::IO, ::MIME"text/plain", a::FPGroupElement{<:AutomorphismGroup})
|
||||||
|
println(io, " ┌ $(a):")
|
||||||
|
im = evaluate(a)
|
||||||
|
d = domain(a)
|
||||||
|
for (x, imx) in zip(d, im[1:end-1])
|
||||||
|
println(io, " │ $x ↦ $imx")
|
||||||
|
end
|
||||||
|
print(io, " └ $(last(d)) ↦ $(last(im))")
|
||||||
|
end
|
||||||
|
|
||||||
## Automorphism Evaluation
|
## Automorphism Evaluation
|
||||||
|
|
||||||
domain(f::FPGroupElement{<:AutomorphismGroup}) = deepcopy(parent(f).domain)
|
domain(f::FPGroupElement{<:AutomorphismGroup}) = deepcopy(parent(f).domain)
|
||||||
|
@ -36,6 +36,14 @@ Base.@propagate_inbounds function (G::AbstractFPGroup)(word::AbstractVector{<:In
|
|||||||
return FPGroupElement(word_type(G)(word), G)
|
return FPGroupElement(word_type(G)(word), G)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Base.show(io::IO, G::AbstractFPGroup)
|
||||||
|
print(io, "⟨")
|
||||||
|
join(io, gens(G), ", ")
|
||||||
|
print(io, " | ")
|
||||||
|
join(io, relations(G), ", ")
|
||||||
|
print(io, "⟩")
|
||||||
|
end
|
||||||
|
|
||||||
## Group Interface
|
## Group Interface
|
||||||
|
|
||||||
Base.one(G::AbstractFPGroup) = FPGroupElement(one(word_type(G)), G)
|
Base.one(G::AbstractFPGroup) = FPGroupElement(one(word_type(G)), G)
|
||||||
@ -140,7 +148,7 @@ function FreeGroup(n::Integer)
|
|||||||
sizehint!(symbols, 2n)
|
sizehint!(symbols, 2n)
|
||||||
sizehint!(inverses, 2n)
|
sizehint!(inverses, 2n)
|
||||||
for i in 1:n
|
for i in 1:n
|
||||||
push!(symbols, Symbol(:f, i), Symbol(:F, i))
|
push!(symbols, Symbol(:f, subscriptify(i)), Symbol(:F, subscriptify(i)))
|
||||||
push!(inverses, 2i, 2i-1)
|
push!(inverses, 2i, 2i-1)
|
||||||
end
|
end
|
||||||
return FreeGroup(symbols[1:2:2n], Alphabet(symbols, inverses))
|
return FreeGroup(symbols[1:2:2n], Alphabet(symbols, inverses))
|
||||||
@ -190,15 +198,9 @@ function FPGroup(
|
|||||||
return FPGroup(G.gens, rels, rws)
|
return FPGroup(G.gens, rels, rws)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Base.show(io::IO, G::FPGroup)
|
|
||||||
print(io, "⟨")
|
|
||||||
join(io, gens(G), ", ")
|
|
||||||
print(io, " | ")
|
|
||||||
join(io, relations(G), ", ")
|
|
||||||
print(io, "⟩")
|
|
||||||
end
|
|
||||||
|
|
||||||
## GSymbol aka letter of alphabet
|
## GSymbol aka letter of alphabet
|
||||||
|
|
||||||
abstract type GSymbol end
|
abstract type GSymbol end
|
||||||
Base.literal_pow(::typeof(^), t::GSymbol, ::Val{-1}) = inv(t)
|
Base.literal_pow(::typeof(^), t::GSymbol, ::Val{-1}) = inv(t)
|
||||||
|
|
||||||
|
subscriptify(i::Integer) = join('₀'+d for d in reverse(digits(i)))
|
||||||
|
Loading…
Reference in New Issue
Block a user