mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-12-25 02:05:30 +01:00
prettier printing for FPGroups
This commit is contained in:
parent
5b5f3e3811
commit
f2d2d4ee52
15
src/types.jl
15
src/types.jl
@ -225,11 +225,20 @@ 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), ", ")
|
||||
Base.print_array(io, permutedims(gens(G)))
|
||||
println(io, " | ")
|
||||
print(io, "\t ")
|
||||
Base.print_array(io, permutedims(relations(G)))
|
||||
return print(io, " ⟩")
|
||||
end
|
||||
|
||||
|
@ -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