mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2024-12-29 11:00:28 +01:00
move type-related functions to one location
This commit is contained in:
parent
688dfa5062
commit
27e0b03b3c
@ -65,8 +65,16 @@ elem_type(::GroupRing) = GroupRingElem
|
||||
parent_type(::GroupRingElem) = GroupRing
|
||||
parent_type(::Type{GroupRingElem}) = GroupRing
|
||||
|
||||
eltype(X::GroupRingElem) = eltype(X.coeffs)
|
||||
|
||||
parent{T}(g::GroupRingElem{T}) = g.parent
|
||||
|
||||
Base.promote_rule{T<:Number,S<:Number}(::Type{GroupRingElem{T}}, ::Type{GroupRingElem{S}}) = GroupRingElem{promote_type(T,S)}
|
||||
|
||||
function convert{T<:Number}(::Type{T}, X::GroupRingElem)
|
||||
return GroupRingElem(convert(AbstractVector{T}, X.coeffs), parent(X))
|
||||
end
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# GroupRing / GroupRingElem constructors
|
||||
@ -77,10 +85,6 @@ function GroupRingElem{T<:Number}(c::AbstractVector{T}, RG::GroupRing)
|
||||
return GroupRingElem{T}(c, RG)
|
||||
end
|
||||
|
||||
function convert{T<:Number}(::Type{T}, X::GroupRingElem)
|
||||
return GroupRingElem(convert(AbstractVector{T}, X.coeffs), parent(X))
|
||||
end
|
||||
|
||||
function GroupRing(G::Group, pm::Array{Int,2})
|
||||
size(pm,1) == size(pm,2) || throw("pm must be square, got $(size(pm))")
|
||||
RG = GroupRing(G, initialise=false)
|
||||
|
Loading…
Reference in New Issue
Block a user