Merge branch 'enh/Nemoification' of https://git.wmi.amu.edu.pl/kalmar/GroupRings.jl into enh/Nemoification

This commit is contained in:
kalmar 2017-06-06 00:12:15 +02:00
commit fe1f552b26
1 changed files with 17 additions and 3 deletions

View File

@ -135,7 +135,18 @@ function {Gr,T}(RG::GroupRing{Gr,T})(x::AbstractVector)
return result return result
end end
(RG::GroupRing)(X::GroupRingElem) = RG(X.coeffs) function (RG::GroupRing)(X::GroupRingElem)
RG == parent(X) || throw("Can not coerce!")
return RG(X.coeffs)
end
function (RG::GroupRing)(X::GroupRingElem, emb::Function)
result = RG(eltype(X.coeffs))
for g in parent(X).basis
result[emb(g)] = X[g]
end
return result
end
############################################################################### ###############################################################################
# #
@ -166,8 +177,11 @@ end
function setindex!(X::GroupRingElem, value, g::GroupElem) function setindex!(X::GroupRingElem, value, g::GroupElem)
RG = parent(X) RG = parent(X)
typeof(g) == elem_type(RG.group) || throw("$g is not an element of $(RG.group)") typeof(g) == elem_type(RG.group) || throw("$g is not an element of $(RG.group)")
g = (RG.group)(g) if !(g in keys(RG.basis_dict))
X.coeffs[RG.basis_dict[g]] = value g = (RG.group)(g)
else
X.coeffs[RG.basis_dict[g]] = value
end
end end
eltype(X::GroupRingElem) = eltype(X.coeffs) eltype(X::GroupRingElem) = eltype(X.coeffs)