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
17
src/types.jl
17
src/types.jl
@ -225,12 +225,21 @@ function FPGroup(
|
|||||||
return FPGroup(G.gens, rels, rws)
|
return FPGroup(G.gens, rels, rws)
|
||||||
end
|
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)
|
function Base.show(io::IO, G::FPGroup)
|
||||||
print(io, "⟨")
|
print(io, "⟨")
|
||||||
join(io, gens(G), ", ")
|
Base.print_array(io, permutedims(gens(G)))
|
||||||
print(io, " | ")
|
println(io, " | ")
|
||||||
join(io, relations(G), ", ")
|
print(io, "\t ")
|
||||||
return print(io, "⟩")
|
Base.print_array(io, permutedims(relations(G)))
|
||||||
|
return print(io, " ⟩")
|
||||||
end
|
end
|
||||||
|
|
||||||
Base.show(io::IO, ::Type{<:FPGroup{T}}) where {T} =
|
Base.show(io::IO, ::Type{<:FPGroup{T}}) where {T} =
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
@test evaluate(g*h) == evaluate(h*g)
|
@test evaluate(g*h) == evaluate(h*g)
|
||||||
@test (g*h).savedhash == zero(UInt)
|
@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
|
a = g*h
|
||||||
b = h*g
|
b = h*g
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
G = FPGroup(F, [a*b=>b*a, a*c=>c*a, b*c=>c*b])
|
G = FPGroup(F, [a*b=>b*a, a*c=>c*a, b*c=>c*b])
|
||||||
|
|
||||||
@test G isa FPGroup
|
@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
|
@test rand(G) isa FPGroupElement
|
||||||
|
|
||||||
f = a*c*b
|
f = a*c*b
|
||||||
|
Loading…
Reference in New Issue
Block a user