Skip to content

Commit

Permalink
Fix bug in universal polynomial ring
Browse files Browse the repository at this point in the history
Not all multivariate polynomial rings can be constructed with
zero indeterminants (e.g. all ring coming from flint).
Thus we always use a generic polynomial ring underpinning the
universal one.
  • Loading branch information
thofma committed Mar 17, 2023
1 parent 70aff86 commit ba52c7c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/UnivPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ end
function UniversalPolynomialRing(R::Ring; ordering=:lex, cached=true)
return Generic.UniversalPolynomialRing(R; ordering=ordering, cached=cached)
end

2 changes: 1 addition & 1 deletion src/generic/GenericTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ end

const UnivPolyID = CacheDictType{Tuple{Ring, Symbol, DataType}, Ring}()

mutable struct UnivPoly{T <: RingElement, U <: MPoly} <: AbstractAlgebra.UniversalPolyRingElem{T}
mutable struct UnivPoly{T <: RingElement, U <: MPolyRingElem{T}} <: AbstractAlgebra.UniversalPolyRingElem{T}
p::U
parent::UniversalPolyRing{T}
end
Expand Down
4 changes: 2 additions & 2 deletions src/generic/UnivPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ parent_type(::Type{UnivPoly{T, U}}) where {T <: RingElement, U <: AbstractAlgebr
UniversalPolyRing{T, U}

function mpoly_ring(S::UniversalPolyRing{T, U}) where {T <: RingElement, U <: AbstractAlgebra.MPolyRingElem{T}}
return S.mpoly_ring::parent_type(mpoly_type(T))
return S.mpoly_ring::Generic.MPolyRing{T}
end

nvars(S::UniversalPolyRing) = length(S.S)
Expand Down Expand Up @@ -1126,7 +1126,7 @@ end

function UniversalPolynomialRing(R::Ring; ordering=:lex, cached=true)
T = elem_type(R)
U = mpoly_type(T)
U = Generic.MPoly{T}

return UniversalPolyRing{T, U}(R, ordering, cached)
end
Expand Down

0 comments on commit ba52c7c

Please sign in to comment.