diff --git a/src/1712.07167.jl b/src/1712.07167.jl index 308b489..df0f51f 100644 --- a/src/1712.07167.jl +++ b/src/1712.07167.jl @@ -10,7 +10,7 @@ abstract type Settings end struct Naive{El} <: Settings name::String - G::Group + G::Union{Group, NCRing} S::Vector{El} halfradius::Int upper_bound::Float64 @@ -21,7 +21,7 @@ end struct Symmetrized{El} <: Settings name::String - G::Group + G::Union{Group, NCRing} S::Vector{El} autS::Group halfradius::Int @@ -32,14 +32,14 @@ struct Symmetrized{El} <: Settings end function Settings(name::String, - G::Group, S::Vector{<:GroupElem}, solver::JuMP.OptimizerFactory; - halfradius::Integer=2, upper_bound::Float64=1.0, warmstart=true) + G::Union{Group, NCRing}, S::AbstractVector{El}, solver::JuMP.OptimizerFactory; + halfradius::Integer=2, upper_bound::Float64=1.0, warmstart=true) where El <: Union{GroupElem, NCRingElem} return Naive(name, G, S, halfradius, upper_bound, solver, warmstart) end function Settings(name::String, - G::Group, S::Vector{<:GroupElem}, autS::Group, solver::JuMP.OptimizerFactory; - halfradius::Integer=2, upper_bound::Float64=1.0, warmstart=true) + G::Union{Group, NCRing}, S::AbstractVector{El}, autS::Group, solver::JuMP.OptimizerFactory; + halfradius::Integer=2, upper_bound::Float64=1.0, warmstart=true) where El <: Union{GroupElem, NCRingElem} return Symmetrized(name, G, S, autS, halfradius, upper_bound, solver, warmstart) end diff --git a/src/PropertyT.jl b/src/PropertyT.jl index 038bcc9..f082f5c 100644 --- a/src/PropertyT.jl +++ b/src/PropertyT.jl @@ -13,7 +13,7 @@ using GroupRings using JLD using JuMP -import AbstractAlgebra: Group, Ring, perm +import AbstractAlgebra: Group, NCRing, perm import MathProgBase.SolverInterface.AbstractMathProgSolver diff --git a/src/laplacians.jl b/src/laplacians.jl index c9538af..5df4cb7 100644 --- a/src/laplacians.jl +++ b/src/laplacians.jl @@ -4,30 +4,22 @@ # ############################################################################### -function spLaplacian(RG::GroupRing, S, T::Type=Float64) +function spLaplacian(RG::GroupRing, S::AbstractVector{El}, T::Type=Float64) where El result = RG(T) - result[RG.group()] = T(length(S)) + id = (El <: AbstractAlgebra.NCRingElem ? one(RG.group) : RG.group()) + result[id] = T(length(S)) for s in S result[s] -= one(T) end return result end -function spLaplacian(RG::GroupRing, S::Vector{REl}, T::Type=Float64) where {REl<:AbstractAlgebra.ModuleElem} - result = RG(T) - result[one(RG.group)] = T(length(S)) - for s in S - result[s] -= one(T) - end - return result -end - -function Laplacian(S::Vector{E}, halfradius) where E<:AbstractAlgebra.ModuleElem +function Laplacian(S::AbstractVector{REl}, halfradius) where REl<:AbstractAlgebra.NCRingElem R = parent(first(S)) return Laplacian(S, one(R), halfradius) end -function Laplacian(S::Vector{E}, halfradius) where E<:AbstractAlgebra.GroupElem +function Laplacian(S::AbstractVector{E}, halfradius) where E<:AbstractAlgebra.GroupElem G = parent(first(S)) return Laplacian(S, G(), halfradius) end @@ -56,7 +48,7 @@ function loadGRElem(fname::String, RG::GroupRing) return GroupRingElem(coeffs, RG) end -function loadGRElem(fname::String, G::Group) +function loadGRElem(fname::String, G::Union{Group, NCRing}) pm = load(fname, "pm") RG = GroupRing(G, pm) return loadGRElem(fname, RG)