From fc3cbeb14c28d77d0dfc0a7fa0830ba2e20c3a1a Mon Sep 17 00:00:00 2001 From: kalmar Date: Wed, 12 Jul 2017 20:54:20 +0200 Subject: [PATCH] preserve type of coerced element --- src/GroupRings.jl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index 029d79a..066485e 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -151,11 +151,13 @@ function (RG::GroupRing)(X::GroupRingElem) 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 + result = RG(eltype(X.coeffs)) + T = typeof(X.coeffs) + result.coeffs = T(result.coeffs) + for g in parent(X).basis + result[emb(g)] = X[g] + end + return result end ###############################################################################