mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-11-19 06:30:29 +01:00
prettier printing for FPGroups
This commit is contained in:
parent
5b5f3e3811
commit
f2d2d4ee52
17
src/types.jl
17
src/types.jl
@ -225,12 +225,21 @@ function FPGroup(
|
||||
return FPGroup(G.gens, rels, rws)
|
||||
end
|
||||
|
||||
function Base.show(io::IO, ::MIME"text/plain", G::FPGroup)
|
||||
print(io, "Finitely presented group generated by:\n\t{")
|
||||
Base.print_array(io, permutedims(gens(G)))
|
||||
println(io, " },")
|
||||
println(io, "subject to relations:")
|
||||
return Base.print_array(io, relations(G))
|
||||
end
|
||||
|
||||
function Base.show(io::IO, G::FPGroup)
|
||||
print(io, "⟨")
|
||||
join(io, gens(G), ", ")
|
||||
print(io, " | ")
|
||||
join(io, relations(G), ", ")
|
||||
return print(io, "⟩")
|
||||
Base.print_array(io, permutedims(gens(G)))
|
||||
println(io, " | ")
|
||||
print(io, "\t ")
|
||||
Base.print_array(io, permutedims(relations(G)))
|
||||
return print(io, " ⟩")
|
||||
end
|
||||
|
||||
Base.show(io::IO, ::Type{<:FPGroup{T}}) where {T} =
|
||||
|
@ -96,7 +96,7 @@
|
||||
@test evaluate(g*h) == evaluate(h*g)
|
||||
@test (g*h).savedhash == zero(UInt)
|
||||
|
||||
@test sprint(show, typeof(g)) == "Automorphism{FreeGroup{Symbol}, …}"
|
||||
@test sprint(show, typeof(g)) == "Automorphism{FreeGroup{Symbol, KnuthBendix.LenLex{Symbol}}, …}"
|
||||
|
||||
a = g*h
|
||||
b = h*g
|
||||
|
@ -14,7 +14,7 @@
|
||||
G = FPGroup(F, [a*b=>b*a, a*c=>c*a, b*c=>c*b])
|
||||
|
||||
@test G isa FPGroup
|
||||
@test sprint(show, G) == "⟨a, b, c | a*b => b*a, a*c => c*a, b*c => c*b⟩"
|
||||
@test sprint(show, G) == "⟨ a b c | \n\t a*b => b*a a*c => c*a b*c => c*b ⟩"
|
||||
@test rand(G) isa FPGroupElement
|
||||
|
||||
f = a*c*b
|
||||
|
Loading…
Reference in New Issue
Block a user