Skip to content

Commit

Permalink
Refactor power_series_ring(R, weights, prec, s) (#1486)
Browse files Browse the repository at this point in the history
Now use `power_series_ring(R, prec, s; weights)`
  • Loading branch information
mgkurtz authored Nov 3, 2023
1 parent 31e80e2 commit 8be657c
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions src/generic/AbsMSeries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -716,37 +716,36 @@ end
function power_series_ring(R::AbstractAlgebra.Ring, prec::Vector{Int},
s::Vector{Symbol}; cached::Bool=true, model=:capped_absolute)
U = elem_type(R)

S, _ = AbstractAlgebra.polynomial_ring(R, s)
V = elem_type(S)

if model == :capped_absolute
parent_obj = AbsMSeriesRing{U, V}(S, prec, s, cached)
else
error("Unknown model")
end

return tuple(parent_obj, gens(parent_obj))
model === :capped_absolute || error("Unknown model")

parent_obj = AbsMSeriesRing{U, V}(S, prec, s, cached)

return parent_obj, gens(parent_obj)
end

function power_series_ring(R::AbstractAlgebra.Ring, weights::Vector{Int}, prec::Int,
s::Vector{Symbol}; cached::Bool=true, model=:capped_absolute)
U = elem_type(R)
function power_series_ring(R::AbstractAlgebra.Ring, prec::Int,
s::Vector{Symbol}; weights::Union{Vector{Int}, Nothing}=nothing,
cached::Bool=true, model=:capped_absolute)
U = elem_type(R)

S, _ = AbstractAlgebra.polynomial_ring(R, s)
V = elem_type(S)
S, _ = AbstractAlgebra.polynomial_ring(R, s)
V = elem_type(S)

if model == :capped_absolute
parent_obj = AbsMSeriesRing{U, V}(S, weights, prec, s, cached)
else
error("Unknown model")
end
model === :capped_absolute || error("Unknown model")

return tuple(parent_obj, gens(parent_obj))
end
if weights === nothing
parent_obj = AbsMSeriesRing{U, V}(S, [prec for _ in s], s, cached)
else
parent_obj = AbsMSeriesRing{U, V}(S, weights, prec, s, cached)
end

function power_series_ring(R::AbstractAlgebra.Ring, prec::Int,
s::Vector{Symbol}; cached::Bool=true, model=:capped_absolute)
prec_vec = [prec for v in s]
return power_series_ring(R, prec_vec, s; cached=cached, model=model)
return parent_obj, gens(parent_obj)
end

power_series_ring(R::AbstractAlgebra.Ring, weights::Vector{Int},
prec::Int, s::Vector{Symbol}; kw...
) = power_series_ring(R, prec, s; weights, kw...)

0 comments on commit 8be657c

Please sign in to comment.