From 203743bb4d1c35b875ddbd0813d33b7a52db2a7c Mon Sep 17 00:00:00 2001 From: kalmar Date: Wed, 17 May 2017 17:39:56 +0200 Subject: [PATCH] hide correctness check of GroupRingElem behind check arg --- src/GroupRings.jl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index ab6bd0f..8048889 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -34,11 +34,12 @@ type GroupRingElem{T<:Number} <: RingElem coeffs::AbstractVector{T} parent::GroupRing - function GroupRingElem(c::AbstractVector{T}, RG::GroupRing) - isdefined(RG, :basis) || complete(RG) - length(c) == length(RG.basis) || throw("Can't create GroupRingElem -- lengths differ: length(c) = $(length(c)) != $(length(RG.basis)) = length(RG.basis)") - - return new(c,RG) + function GroupRingElem(c::AbstractVector{T}, RG::GroupRing, check=true) + if check + isdefined(RG, :basis) || complete(RG) + length(c) == length(RG.basis) || throw("Can't create GroupRingElem -- lengths differ: length(c) = $(length(c)) != $(length(RG.basis)) = length(RG.basis)") + end + return new(c, RG) end end