mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-14 14:15:28 +01:00
use NCRing[Elem]s instead of MatSpace and use NCRing in Settings
This commit is contained in:
parent
80e338f191
commit
88b460a959
@ -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
|
||||
|
||||
|
@ -13,7 +13,7 @@ using GroupRings
|
||||
using JLD
|
||||
using JuMP
|
||||
|
||||
import AbstractAlgebra: Group, Ring, perm
|
||||
import AbstractAlgebra: Group, NCRing, perm
|
||||
|
||||
import MathProgBase.SolverInterface.AbstractMathProgSolver
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user