From 1e990f58964f8ccadc4d29acfa4b83bd3d9e3f41 Mon Sep 17 00:00:00 2001 From: kalmar Date: Fri, 19 May 2017 10:32:09 +0200 Subject: [PATCH] better show of ::GroupRingElem --- src/GroupRings.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index 4d07bc7..01adaeb 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -179,8 +179,9 @@ function show(io::IO, X::GroupRingElem) if X == RG(T) print(io, "$(zero(T))*$((RG.group)())") else - elts = ("$(X[i])*$(RG.basis[i])" for i in 1:length(RG.basis) if X[i] != zero(T)) - join(io, elts, " + ") + non_zeros = ((X.coeffs[i], RG.basis[i]) for i in findn(X.coeffs)) + elts = ("$(sign(c)> 0? " + ": " - ")$(abs(c))*$g" for (c,g) in non_zeros) + join(io, elts, "") end end