mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2024-09-05 14:46:44 +02:00
length of GroupRingElem is the size of its support
This commit is contained in:
parent
c7477dd25f
commit
e3fa702507
@ -119,8 +119,8 @@ function (RG::GroupRing)(g::GroupElem, T::Type=Int)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function (RG::GroupRing)(x::AbstractVector)
|
function (RG::GroupRing)(x::AbstractVector)
|
||||||
|
length(x) == length(RG.basis) || throw("Can not coerce to $RG: lengths differ")
|
||||||
result = RG(eltype(x))
|
result = RG(eltype(x))
|
||||||
length(x) == length(result) || throw("Can not coerce to $RG: lengths differ")
|
|
||||||
result.coeffs = x
|
result.coeffs = x
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
@ -184,7 +184,7 @@ function show(io::IO, X::GroupRingElem)
|
|||||||
if X == RG(T)
|
if X == RG(T)
|
||||||
print(io, "$(zero(T))*$((RG.group)())")
|
print(io, "$(zero(T))*$((RG.group)())")
|
||||||
else
|
else
|
||||||
elts = ("$(X[i])*$(RG.basis[i])" for i in 1:length(X) if X[i] != zero(T))
|
elts = ("$(X[i])*$(RG.basis[i])" for i in 1:length(RG.basis) if X[i] != zero(T))
|
||||||
join(io, elts, " + ")
|
join(io, elts, " + ")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -341,7 +341,7 @@ end
|
|||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
length(X::GroupRingElem) = length(X.coeffs)
|
length(X::GroupRingElem) = countnz(X.coeffs)
|
||||||
|
|
||||||
norm(X::GroupRingElem, p=2) = norm(X.coeffs, p)
|
norm(X::GroupRingElem, p=2) = norm(X.coeffs, p)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user