Skip to content

Caching of universal polynomials in change_base_ring #2408

@SoongNoonien

Description

@SoongNoonien

With the new approach for the caching of universal polynomials we get some unexpected results. I first noticed this in oscar-system/GenericCharacterTables.jl#319.

julia> R,(x,y)=universal_polynomial_ring(QQ, [:x,:y])
(Universal polynomial ring over Rationals, UniversalRingElem{AbstractAlgebra.Generic.MPoly{Rational{BigInt}}, Rational{BigInt}}[x, y])

julia> f=x
x

julia> change_base_ring(ZZ, f)
x

julia> S,_=universal_polynomial_ring(ZZ, [:x,:y])
(Universal polynomial ring over Integers, UniversalRingElem{AbstractAlgebra.Generic.MPoly{BigInt}, BigInt}[x, y])

julia> z=gen(S,:z)
z

julia> change_base_ring(ZZ, f)
ERROR: length of exponent vector should match the number of variables
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:44
 [2] push_term!(M::MPolyBuildCtx{AbstractAlgebra.Generic.MPoly{BigInt}, DataType}, c::BigInt, expv::Vector{Int64})
   @ AbstractAlgebra.Generic ~/Archiv/Computer/Programme/AbstractAlgebra.jl/src/generic/MPoly.jl:3761
 [3] _map(g::AbstractAlgebra.Integers{BigInt}, p::AbstractAlgebra.Generic.MPoly{Rational{BigInt}}, Rx::AbstractAlgebra.Generic.MPolyRing{BigInt})
   @ AbstractAlgebra ~/Archiv/Computer/Programme/AbstractAlgebra.jl/src/MPoly.jl:1437
 [4] #change_base_ring#403
   @ ~/Archiv/Computer/Programme/AbstractAlgebra.jl/src/MPoly.jl:1397 [inlined]
 [5] change_base_ring
   @ ~/Archiv/Computer/Programme/AbstractAlgebra.jl/src/MPoly.jl:1395 [inlined]
 [6] change_base_ring(R::AbstractAlgebra.Integers{…}, p::UniversalRingElem{…}; cached::Bool, parent::UniversalPolyRing{…})
   @ AbstractAlgebra ~/Archiv/Computer/Programme/AbstractAlgebra.jl/src/UnivPoly.jl:600
 [7] change_base_ring(R::AbstractAlgebra.Integers{BigInt}, p::UniversalRingElem{AbstractAlgebra.Generic.MPoly{Rational{BigInt}}, Rational{BigInt}})
   @ AbstractAlgebra ~/Archiv/Computer/Programme/AbstractAlgebra.jl/src/UnivPoly.jl:598
 [8] top-level scope
   @ REPL[9]:1
Some type information was truncated. Use `show(err)` to see complete types.

The problem is that the caching of universal polynomial ignores the supplied symbols. We've discussed this and decided that this should indeed be the way to go.

To resolve this problem here we would need to discuss how to deal with a supplied parent which has a different number of variables. Should we just silently ignore this and map the polynomial anyway? Or should we at least check that the first variables have the same name?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions