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

check on the vector length in GroupRingElem constructor

This commit is contained in:
kalmar 2017-05-17 11:32:28 +02:00
parent ec39853e92
commit 3da2110355

View File

@ -53,7 +53,12 @@ parent{T}(g::GroupRingElem{T}) = g.parent
#
###############################################################################
GroupRingElem{T}(c::AbstractVector{T}, A::GroupRing) = GroupRingElem{T}(c,A)
function GroupRingElem{T<:Number}(c::AbstractVector{T}, A::GroupRing)
length(c) == length(A.basis) || throw("Can't create GroupRingElem -- lengths
differ: length(c) = $(length(c)) != $(length(A.basis)) = length(A.basis)")
GroupRingElem{T}(c,A)
end
convert{T<:Number}(::Type{T}, X::GroupRingElem) =
GroupRingElem(parent(X), convert(AbstractVector{T}, X.coeffs))