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

in setindex! perform coercion only when necessary

This commit is contained in:
kalmar 2017-06-05 21:38:03 +02:00
parent b2231c44e6
commit 1e75372068

View File

@ -173,8 +173,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)