1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-22 16:05:27 +01:00

define and use one(::Group)

This commit is contained in:
kalmarek 2019-07-05 18:55:25 +02:00
parent 4bce106c2d
commit 5e821286e5
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
4 changed files with 14 additions and 22 deletions

View File

@ -17,6 +17,8 @@ import AbstractAlgebra: Group, NCRing, perm
import MathProgBase.SolverInterface.AbstractMathProgSolver import MathProgBase.SolverInterface.AbstractMathProgSolver
AbstractAlgebra.one(G::Group) = G()
include("laplacians.jl") include("laplacians.jl")
include("RGprojections.jl") include("RGprojections.jl")
include("orbitdata.jl") include("orbitdata.jl")

View File

@ -70,7 +70,7 @@ end
function central_projection(RG::GroupRing, chi::AbstractCharacter, T::Type=Rational{Int}) function central_projection(RG::GroupRing, chi::AbstractCharacter, T::Type=Rational{Int})
result = RG(zeros(T, length(RG.basis))) result = RG(zeros(T, length(RG.basis)))
dim = chi(RG.group()) dim = chi(one(RG.group))
ord = Int(order(RG.group)) ord = Int(order(RG.group))
for g in RG.basis for g in RG.basis
@ -187,8 +187,8 @@ function rankOne_projections(RBn::GroupRing{G}, T::Type=Rational{Int}) where {G<
r = collect(1:N) r = collect(1:N)
for i in 1:N-1 for i in 1:N-1
first_emb = g->Bn(Generic.emb!(Bn.P(), g, view(r, 1:i))) first_emb = g->Bn(Generic.emb!(one(Bn.P), g, view(r, 1:i)))
last_emb = g->Bn(Generic.emb!(Bn.P(), g, view(r, (i+1):N))) last_emb = g->Bn(Generic.emb!(one(Bn.P), g, view(r, (i+1):N)))
Sk_first = (RBn(first_emb, p) for p in Sn_rankOnePr[i]) Sk_first = (RBn(first_emb, p) for p in Sn_rankOnePr[i])
Sk_last = (RBn(last_emb, p) for p in Sn_rankOnePr[N-i]) Sk_last = (RBn(last_emb, p) for p in Sn_rankOnePr[N-i])
@ -238,7 +238,7 @@ end
> The identity element `Id` and binary operation function `op` can be supplied > The identity element `Id` and binary operation function `op` can be supplied
> to e.g. take advantage of additive group structure. > to e.g. take advantage of additive group structure.
""" """
function generateGroup(gens::Vector{T}, r=2, Id::T=parent(first(gens))(), op=*) where {T<:GroupElem} function generateGroup(gens::Vector{T}, r=2, Id::T=one(parent(first(gens))), op=*) where {T<:GroupElem}
n = 0 n = 0
R = 1 R = 1
elts = gens elts = gens

View File

@ -4,36 +4,26 @@
# #
############################################################################### ###############################################################################
function spLaplacian(RG::GroupRing, S::AbstractVector{El}, T::Type=Float64) where El function spLaplacian(RG::GroupRing, S::AbstractVector, T::Type=Float64)
result = RG(T) result = RG(T)
id = (El <: AbstractAlgebra.NCRingElem ? one(RG.group) : RG.group()) result[one(RG.group)] = T(length(S))
result[id] = T(length(S))
for s in S for s in S
result[s] -= one(T) result[s] -= one(T)
end end
return result return result
end end
function Laplacian(S::AbstractVector{REl}, halfradius) where REl<:AbstractAlgebra.NCRingElem function Laplacian(S::AbstractVector{REl}, halfradius) where REl<:Union{NCRingElem, GroupElem}
R = parent(first(S))
return Laplacian(S, one(R), halfradius)
end
function Laplacian(S::AbstractVector{E}, halfradius) where E<:AbstractAlgebra.GroupElem
G = parent(first(S)) G = parent(first(S))
return Laplacian(S, G(), halfradius)
end
function Laplacian(S, Id, halfradius)
@info "Generating metric ball of radius" radius=2halfradius @info "Generating metric ball of radius" radius=2halfradius
@time E_R, sizes = Groups.generate_balls(S, Id, radius=2halfradius) @time E_R, sizes = Groups.generate_balls(S, one(G), radius=2halfradius)
@info "Generated balls:" sizes @info "Generated balls:" sizes
@info "Creating product matrix..." @info "Creating product matrix..."
rdict = GroupRings.reverse_dict(E_R) rdict = GroupRings.reverse_dict(E_R)
@time pm = GroupRings.create_pm(E_R, rdict, sizes[halfradius]; twisted=true) @time pm = GroupRings.create_pm(E_R, rdict, sizes[halfradius]; twisted=true)
RG = GroupRing(parent(Id), E_R, rdict, pm) RG = GroupRing(G, E_R, rdict, pm)
Δ = spLaplacian(RG, S) Δ = spLaplacian(RG, S)
return Δ return Δ
end end

View File

@ -28,7 +28,7 @@ function OrbitData(RG::GroupRing, autS::Group, verbose=true)
@time Uπs = [orthSVD(matrix_repr(p, mreps)) for p in autS_mps] @time Uπs = [orthSVD(matrix_repr(p, mreps)) for p in autS_mps]
multiplicities = size.(Uπs,2) multiplicities = size.(Uπs,2)
dimensions = [Int(p[autS()]*Int(order(autS))) for p in autS_mps] dimensions = [Int(p[one(autS)]*Int(order(autS))) for p in autS_mps]
if verbose if verbose
info_strs = ["", info_strs = ["",
lpad("multiplicities", 14) * " =" * join(lpad.(multiplicities, 4), ""), lpad("multiplicities", 14) * " =" * join(lpad.(multiplicities, 4), ""),
@ -273,8 +273,8 @@ end
function AutFG_emb(A::AutGroup, g::WreathProductElem) function AutFG_emb(A::AutGroup, g::WreathProductElem)
isa(A.objectGroup, FreeGroup) || throw("Not an Aut(Fₙ)") isa(A.objectGroup, FreeGroup) || throw("Not an Aut(Fₙ)")
parent(g).P.n == length(A.objectGroup.gens) || throw("No natural embedding of $(parent(g)) into $A") parent(g).P.n == length(A.objectGroup.gens) || throw("No natural embedding of $(parent(g)) into $A")
elt = A() elt = one(A)
Id = parent(g.n.elts[1])() Id = one(parent(g.n.elts[1]))
flips = Groups.AutSymbol[Groups.flip_autsymbol(i) for i in 1:length(g.p.d) if g.n.elts[i] != Id] flips = Groups.AutSymbol[Groups.flip_autsymbol(i) for i in 1:length(g.p.d) if g.n.elts[i] != Id]
Groups.r_multiply!(elt, flips, reduced=false) Groups.r_multiply!(elt, flips, reduced=false)
Groups.r_multiply!(elt, [Groups.perm_autsymbol(g.p)]) Groups.r_multiply!(elt, [Groups.perm_autsymbol(g.p)])