mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2024-09-05 14:46:44 +02: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(::GroupRingElem) = GroupRing
|
||||||
parent_type(::Type{GroupRingElem}) = GroupRing
|
parent_type(::Type{GroupRingElem}) = GroupRing
|
||||||
|
|
||||||
|
eltype(X::GroupRingElem) = eltype(X.coeffs)
|
||||||
|
|
||||||
parent{T}(g::GroupRingElem{T}) = g.parent
|
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
|
# GroupRing / GroupRingElem constructors
|
||||||
@ -77,10 +85,6 @@ function GroupRingElem{T<:Number}(c::AbstractVector{T}, RG::GroupRing)
|
|||||||
return GroupRingElem{T}(c, RG)
|
return GroupRingElem{T}(c, RG)
|
||||||
end
|
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})
|
function GroupRing(G::Group, pm::Array{Int,2})
|
||||||
size(pm,1) == size(pm,2) || throw("pm must be square, got $(size(pm))")
|
size(pm,1) == size(pm,2) || throw("pm must be square, got $(size(pm))")
|
||||||
RG = GroupRing(G, initialise=false)
|
RG = GroupRing(G, initialise=false)
|
||||||
|
Loading…
Reference in New Issue
Block a user