From 3118c8b4fe55092de0228fc078911f30260dedbd Mon Sep 17 00:00:00 2001 From: kalmar Date: Mon, 13 Mar 2017 11:45:23 +0100 Subject: [PATCH] And function to create generating set and products --- SL3Z.jl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/SL3Z.jl b/SL3Z.jl index 356b1eb..f556648 100644 --- a/SL3Z.jl +++ b/SL3Z.jl @@ -79,6 +79,27 @@ function inv(M::Array{Mod,2}) return adjugate(M) end +function SL_generatingset(n::Int, p::Int) + (p > 1 && n > 1) || throw(ArgumentError("Both n and p should be integers!")) + isprime(p) || throw(ArgumentError("p should be a prime number!")) + + indexing = [(i,j) for i in 1:n for j in 1:n if i≠j] + S = [E(i,j, N=n, mod=p) for (i,j) in indexing] + S = vcat(S, [inv(s) for s in S]) + S = vcat(S, [permutedims(x, [2,1]) for x in S]); + + return unique(S) +end + +function products{T}(U::AbstractVector{T}, V::AbstractVector{T}) + result = Vector{T}() + for u in U + for v in V + push!(result, u*v) + end + end + return unique(result) +end function ΔandSDPconstraints(identity, S) B₁ = vcat([identity], S)