1
0
mirror of https://github.com/kalmarek/GroupRings.jl.git synced 2024-07-30 06:05:31 +02: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 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)")
if !(g in keys(RG.basis_dict))
g = (RG.group)(g) g = (RG.group)(g)
else
X.coeffs[RG.basis_dict[g]] = value X.coeffs[RG.basis_dict[g]] = value
end
end end
eltype(X::GroupRingElem) = eltype(X.coeffs) eltype(X::GroupRingElem) = eltype(X.coeffs)