From 4707cdf40a018dc2bbc45f05dd190dfbc2cc1819 Mon Sep 17 00:00:00 2001 From: kalmar Date: Wed, 19 Jul 2017 22:51:56 +0200 Subject: [PATCH] restrict methods to GroupRings with basis --- src/GroupRings.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index 28e9f13..d2d0216 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -130,7 +130,7 @@ function (RG::GroupRing)(i::Int, T::Type=Int) end function (RG::GroupRing)(T::Type=Int) - isdefined(RG, :basis) || throw("Complete the definition of GroupRing first") + isdefined(RG, :basis) || throw("Can not coerce without basis of GroupRing") return GroupRingElem(spzeros(T,length(RG.basis)), RG) end @@ -142,6 +142,7 @@ function (RG::GroupRing)(g::GroupElem, T::Type=Int) end function (RG::GroupRing)(x::AbstractVector) + isdefined(RG, :basis) || throw("Can not coerce without basis of GroupRing") length(x) == length(RG.basis) || throw("Can not coerce to $RG: lengths differ") result = RG(eltype(x)) result.coeffs = x @@ -154,6 +155,7 @@ function (RG::GroupRing)(X::GroupRingElem) end function (RG::GroupRing)(X::GroupRingElem, emb::Function) + isdefined(RG, :basis) || throw("Can not coerce without basis of GroupRing") result = RG(eltype(X.coeffs)) T = typeof(X.coeffs) result.coeffs = T(result.coeffs) @@ -415,7 +417,7 @@ end function star{T}(X::GroupRingElem{T}) RG = parent(X) - isdefined(RG, :basis) || complete(RG) + isdefined(RG, :basis) || throw("*-involution without basis is not possible") result = RG(T) for (i,c) in enumerate(X.coeffs) if c != zero(T)