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

dispatch splaplacian on GroupRing{T} type

with multiplicative unit for Rings
This commit is contained in:
kalmar 2017-06-08 21:45:46 +02:00
parent a68e546b7e
commit 3c0ae5baf0
2 changed files with 13 additions and 5 deletions

View File

@ -5,7 +5,7 @@ using GroupRings
using Memento using Memento
using Groups using Groups
import Nemo: Group, GroupElem import Nemo: Ring, Group, GroupElem
const logger = Memento.config("info", fmt="{msg}") const logger = Memento.config("info", fmt="{msg}")
const solver_logger = Memento.config("info", fmt="{msg}") const solver_logger = Memento.config("info", fmt="{msg}")

View File

@ -13,10 +13,18 @@ function constraints_from_pm(pm, total_length=maximum(pm))
return constraints return constraints
end end
function splaplacian(RG::GroupRing, S, Id=RG.group(), function splaplacian{TT<:Group}(RG::GroupRing{TT}, S, Id=RG.group(), T::Type=Int)
n=length(RG.basis), T::Type=Int) result = RG(T)
result = RG(spzeros(n)) result[Id] = T(length(S))
result[Id] = float(length(S)) for s in S
result[s] -= one(T)
end
return result
end
function splaplacian{TT<:Ring}(RG::GroupRing{TT}, S, Id=one(RG.group), T::Type=Int)
result = RG(T)
result[Id] = T(length(S))
for s in S for s in S
result[s] -= one(T) result[s] -= one(T)
end end