mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2024-11-14 21:25:28 +01:00
embedding constructor of GroupRing produces sparse GroupRingElem
This commit is contained in:
parent
d5e390bce3
commit
2c7d968990
@ -151,6 +151,15 @@ function (RG::GroupRing{Gr,T})(V::Vector{T}, S::Type=Int) where {Gr<:Group, T<:G
|
||||
return res
|
||||
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
|
||||
|
||||
function (RG::GroupRing)(x::AbstractVector{T}) where T<:Number
|
||||
@ -163,16 +172,6 @@ function (RG::GroupRing)(X::GroupRingElem)
|
||||
return RG(X.coeffs)
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user