mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-12-26 02:30:29 +01:00
group matrix-,perm-reps in one place
This commit is contained in:
parent
36fbaa5393
commit
fc0a9ccfec
@ -41,24 +41,10 @@ end
|
|||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
# Matrix-, Permutation- and C*-representations
|
# perm-, matrix-, representations
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
function matrix_repr(p::perm)
|
|
||||||
N = parent(p).n
|
|
||||||
return sparse(1:N, p.d, [1.0 for _ in 1:N])
|
|
||||||
end
|
|
||||||
|
|
||||||
function matrix_reps(preps::Dict{T,perm{I}}) where {T<:GroupElem, I<:Integer}
|
|
||||||
kk = collect(keys(preps))
|
|
||||||
mreps = Vector{SparseMatrixCSC{Float64, Int}}(length(kk))
|
|
||||||
Threads.@threads for i in 1:length(kk)
|
|
||||||
mreps[i] = matrix_repr(preps[kk[i]])
|
|
||||||
end
|
|
||||||
return Dict(kk[i] => mreps[i] for i in 1:length(kk))
|
|
||||||
end
|
|
||||||
|
|
||||||
function perm_repr(g::GroupElem, E::Vector, E_dict)
|
function perm_repr(g::GroupElem, E::Vector, E_dict)
|
||||||
p = Vector{Int}(length(E))
|
p = Vector{Int}(length(E))
|
||||||
for (i,elt) in enumerate(E)
|
for (i,elt) in enumerate(E)
|
||||||
@ -81,12 +67,7 @@ function perm_reps(G::Group, E::Vector, E_rdict=GroupRings.reverse_dict(E))
|
|||||||
return Dict(elts[i]=>preps[i] for i in 1:l)
|
return Dict(elts[i]=>preps[i] for i in 1:l)
|
||||||
end
|
end
|
||||||
|
|
||||||
function perm_reps(S::Vector, autS::Group, radius::Int)
|
function matrix_repr(x::GroupRingElem, mreps::Dict)
|
||||||
E, _ = Groups.generate_balls(S, radius=radius)
|
|
||||||
return perm_reps(autS, E)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Cstar_repr(x::GroupRingElem{T}, mreps::Dict) where {T}
|
|
||||||
nzeros = findn(x.coeffs)
|
nzeros = findn(x.coeffs)
|
||||||
return sum(x[i].*mreps[parent(x).basis[i]] for i in nzeros)
|
return sum(x[i].*mreps[parent(x).basis[i]] for i in nzeros)
|
||||||
end
|
end
|
||||||
@ -98,4 +79,11 @@ function orthSVD(M::AbstractMatrix{T}) where {T<:AbstractFloat}
|
|||||||
return fact[:U][:,1:M_rank]
|
return fact[:U][:,1:M_rank]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function matrix_reps(preps::Dict{T,perm{I}}) where {T<:GroupElem, I<:Integer}
|
||||||
|
kk = collect(keys(preps))
|
||||||
|
mreps = Vector{SparseMatrixCSC{Float64, Int}}(length(kk))
|
||||||
|
Threads.@threads for i in 1:length(kk)
|
||||||
|
mreps[i] = AbstractAlgebra.matrix_repr(preps[kk[i]])
|
||||||
|
end
|
||||||
|
return Dict(kk[i] => mreps[i] for i in 1:length(kk))
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user