1
0
mirror of https://github.com/kalmarek/GroupRings.jl.git synced 2024-12-29 11:00:28 +01:00

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

View File

@ -135,7 +135,18 @@ function {Gr,T}(RG::GroupRing{Gr,T})(x::AbstractVector)
return result
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)
RG = parent(X)
typeof(g) == elem_type(RG.group) || throw("$g is not an element of $(RG.group)")
g = (RG.group)(g)
X.coeffs[RG.basis_dict[g]] = value
if !(g in keys(RG.basis_dict))
g = (RG.group)(g)
else
X.coeffs[RG.basis_dict[g]] = value
end
end
eltype(X::GroupRingElem) = eltype(X.coeffs)