1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-26 02:20:30 +01:00

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

View File

@ -81,3 +81,26 @@ Base.@propagate_inbounds function evaluate!(v::NTuple{T, N}, t::Transvection, A:
return v return v
end 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