add PermAut(omorphisms)

This commit is contained in:
Marek Kaluba 2021-07-05 15:05:57 +02:00
parent 939d231bbe
commit 15a737bfa5
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
1 changed files with 23 additions and 0 deletions

View File

@ -81,3 +81,26 @@ Base.@propagate_inbounds function evaluate!(v::NTuple{T, N}, t::Transvection, A:
return v
end
struct PermAut <: GSymbol
perm::Vector{UInt8}
function PermAut(p::AbstractVector{<:Integer})
@assert sort(p) == 1:length(p)
return new(p)
end
end
function Base.show(io::IO, p::PermAut)
print(io, 'σ')
join(io, (subscriptify(Int(i)) for i in p.perm))
end
Base.inv(p::PermAut) = PermAut(invperm(p.perm))
Base.:(==)(p::PermAut, q::PermAut) = p.perm == q.perm
Base.hash(p::PermAut, h::UInt) = hash(p.perm, hash(PermAut, h))
Base.@propagate_inbounds function evaluate!(v::NTuple{T, N}, p::PermAut, ::Alphabet, tmp=one(first(v))) where {T, N}
return v[p.perm]
end