mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2024-09-05 14:46:44 +02:00
in setindex! perform coercion only when necessary
This commit is contained in:
parent
b2231c44e6
commit
1e75372068
@ -173,9 +173,12 @@ 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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user