mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-09-26 19:28:49 +02:00
add the standard linear representation for Automorphisms
This commit is contained in:
parent
df554480ea
commit
1597784ac5
@ -365,3 +365,25 @@ function reduce!(W::Automorphism)
|
|||||||
|
|
||||||
return W
|
return W
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function linear_repr(A::Automorphism{N}, hom=matrix_repr) where N
|
||||||
|
return reduce(*, hom(Identity(), N, 1), linear_repr.(A.symbols, N, hom))
|
||||||
|
end
|
||||||
|
|
||||||
|
linear_repr(a::AutSymbol, n::Int, hom) = hom(a.typ, n, a.pow)
|
||||||
|
|
||||||
|
function matrix_repr(a::Union{RTransvect, LTransvect}, n::Int, pow)
|
||||||
|
x = eye(n)
|
||||||
|
x[a.i,a.j] = pow
|
||||||
|
return x
|
||||||
|
end
|
||||||
|
|
||||||
|
function matrix_repr(a::FlipAut, n::Int, pow)
|
||||||
|
x = eye(n)
|
||||||
|
x[a.i,a.i] = -1^pow
|
||||||
|
return x
|
||||||
|
end
|
||||||
|
|
||||||
|
matrix_repr(a::PermAut, n::Int, pow) = eye(n)[:, (a.perm^pow).d]
|
||||||
|
|
||||||
|
matrix_repr(a::Identity, n::Int, pow) = eye(n)
|
||||||
|
@ -4,7 +4,7 @@ module Groups
|
|||||||
using Nemo
|
using Nemo
|
||||||
import Nemo: Group, GroupElem, Ring
|
import Nemo: Group, GroupElem, Ring
|
||||||
import Nemo: parent, parent_type, elem_type
|
import Nemo: parent, parent_type, elem_type
|
||||||
import Nemo: elements, order, gens
|
import Nemo: elements, order, gens, matrix_repr
|
||||||
|
|
||||||
import Base: length, ==, hash, show, convert
|
import Base: length, ==, hash, show, convert
|
||||||
import Base: inv, reduce, *, ^
|
import Base: inv, reduce, *, ^
|
||||||
|
@ -207,4 +207,48 @@
|
|||||||
@test length(unique(B_2)) == 1777
|
@test length(unique(B_2)) == 1777
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@testset "linear_repr tests" begin
|
||||||
|
N = 3
|
||||||
|
G = AutGroup(FreeGroup(N))
|
||||||
|
S = unique([gens(G); inv.(gens(G))])
|
||||||
|
R = 3
|
||||||
|
|
||||||
|
@test Groups.linear_repr(G()) isa Matrix{Float64}
|
||||||
|
@test Groups.linear_repr(G()) == eye(N)
|
||||||
|
|
||||||
|
M = eye(N)
|
||||||
|
M[1,2] = 1
|
||||||
|
ϱ₁₂ = G(Groups.rmul_autsymbol(1,2))
|
||||||
|
λ₁₂ = G(Groups.rmul_autsymbol(1,2))
|
||||||
|
|
||||||
|
@test Groups.linear_repr(ϱ₁₂) == M
|
||||||
|
@test Groups.linear_repr(λ₁₂) == M
|
||||||
|
|
||||||
|
M[1,2] = -1
|
||||||
|
|
||||||
|
@test Groups.linear_repr(ϱ₁₂^-1) == M
|
||||||
|
@test Groups.linear_repr(λ₁₂^-1) == M
|
||||||
|
|
||||||
|
M = eye(N)
|
||||||
|
M[2,2] = -1
|
||||||
|
ε₂ = G(Groups.flip_autsymbol(2))
|
||||||
|
|
||||||
|
@test Groups.linear_repr(ε₂) == M
|
||||||
|
@test Groups.linear_repr(ε₂^2) == eye(N)
|
||||||
|
|
||||||
|
M = [0.0 0.0 1.0; 1.0 0.0 0.0; 0.0 1.0 0.0]
|
||||||
|
σ = G(Groups.perm_autsymbol([2,3,1]))
|
||||||
|
@test Groups.linear_repr(σ) == M
|
||||||
|
@test Groups.linear_repr(σ^3) == eye(3)
|
||||||
|
@test Groups.linear_repr(σ)^3 ≈ eye(3)
|
||||||
|
|
||||||
|
function test_homomorphism(S, r)
|
||||||
|
for elts in Iterators.product([[g for g in S] for _ in 1:r]...)
|
||||||
|
prod(Groups.linear_repr.(elts)) == Groups.linear_repr(prod(elts)) || error("linear representaton test failed at $elts")
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
@test test_homomorphism(S, R) == 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user