1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-23 08:15:29 +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 Groups
import Nemo: Group, GroupElem
import Nemo: Ring, Group, GroupElem
const 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
end
function splaplacian(RG::GroupRing, S, Id=RG.group(),
n=length(RG.basis), T::Type=Int)
result = RG(spzeros(n))
result[Id] = float(length(S))
function splaplacian{TT<:Group}(RG::GroupRing{TT}, S, Id=RG.group(), T::Type=Int)
result = RG(T)
result[Id] = T(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
result[s] -= one(T)
end