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

embedding constructor of GroupRing produces sparse GroupRingElem

This commit is contained in:
kalmarek 2018-08-15 19:28:14 +02:00
parent d5e390bce3
commit 2c7d968990

View File

@ -151,6 +151,15 @@ function (RG::GroupRing{Gr,T})(V::Vector{T}, S::Type=Int) where {Gr<:Group, T<:G
return res return res
end end
function (RG::GroupRing)(f::Function, X::GroupRingElem{T}) where T
isdefined(RG, :basis) || throw("Can not coerce without basis of GroupRing")
res = RG(T)
for g in supp(X)
res[f(g)] = X[g]
end
return res
end
# keep storage type # keep storage type
function (RG::GroupRing)(x::AbstractVector{T}) where T<:Number function (RG::GroupRing)(x::AbstractVector{T}) where T<:Number
@ -163,16 +172,6 @@ function (RG::GroupRing)(X::GroupRingElem)
return RG(X.coeffs) return RG(X.coeffs)
end end
function (RG::GroupRing)(f::Function, X::GroupRingElem)
isdefined(RG, :basis) || throw("Can not coerce without basis of GroupRing")
res = RG(zeros(X.coeffs))
for g in RG.basis
res[f(g)] = X[g]
end
return res
end
############################################################################### ###############################################################################
# #
# Basic manipulation && Array protocol # Basic manipulation && Array protocol