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

better show of ::GroupRingElem

This commit is contained in:
kalmar 2017-05-19 10:32:09 +02:00
parent 6379c76646
commit 1e990f5896

View File

@ -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