Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of ideals fails #1058

Closed
HechtiDerLachs opened this issue Feb 7, 2022 · 6 comments
Closed

Addition of ideals fails #1058

HechtiDerLachs opened this issue Feb 7, 2022 · 6 comments

Comments

@HechtiDerLachs
Copy link
Collaborator

Try running the following code:

R, (x,y) = QQ["x", "y"]
S, (u,v) = R["u", "v"]
I = ideal(S, [u]) + ideal(S, [v])

Addition of ideals is not possible due to some (certainly unnecessary) calls to Singular.

@fingolfin
Copy link
Member

Actually the last line is executed just fine. What doesn't work is printing the result:

julia> R, (x,y) = QQ["x", "y"]
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])

julia> S, (u,v) = R["u", "v"]
(Multivariate Polynomial Ring in u, v over Multivariate Polynomial Ring in x, y over Rational Field, AbstractAlgebra.Generic.MPoly{fmpq_mpoly}[u, v])

julia> I = ideal(S, [u]) + ideal(S, [v]);

julia> typeof(I)
MPolyIdeal{AbstractAlgebra.Generic.MPoly{fmpq_mpoly}}

julia> typeof(ideal(S, [u]))
MPolyIdeal{AbstractAlgebra.Generic.MPoly{fmpq_mpoly}}

julia> I
Error showing value of type MPolyIdeal{AbstractAlgebra.Generic.MPoly{fmpq_mpoly}}:
ERROR: TypeError: in typeassert, expected fmpq_mpoly, got a value of type Singular.spoly{Singular.n_Q}
Stacktrace:
  [1] Ring
    @ ~/Projekte/OSCAR/Oscar.spielwiese/src/Rings/mpoly.jl:441 [inlined]
  [2] (::AbstractAlgebra.Generic.MPolyRing{fmpq_mpoly})(f::Singular.spoly{Singular.n_RingElem{Singular.spoly{Singular.n_Q}}})
    @ Oscar ~/Projekte/OSCAR/Oscar.spielwiese/src/Rings/mpoly.jl:246
  [3] getindex(A::Oscar.BiPolyArray{AbstractAlgebra.Generic.MPoly{fmpq_mpoly}}, #unused#::Val{:O}, i::Int64)
    @ Oscar ~/Projekte/OSCAR/Oscar.spielwiese/src/Rings/mpoly.jl:204
  [4] iterate
    @ ~/Projekte/OSCAR/Oscar.spielwiese/src/Rings/mpoly.jl:221 [inlined]
  [5] iterate
    @ ~/Projekte/OSCAR/Oscar.spielwiese/src/Rings/mpoly.jl:218 [inlined]
  [6] copyto!(dest::Vector{AbstractAlgebra.Generic.MPoly{fmpq_mpoly}}, src::Oscar.BiPolyArray{AbstractAlgebra.Generic.MPoly{fmpq_mpoly}})
    @ Base ./abstractarray.jl:896
  [7] _collect
    @ ./array.jl:715 [inlined]
  [8] collect
    @ ./array.jl:709 [inlined]
  [9] expressify(a::MPolyIdeal{AbstractAlgebra.Generic.MPoly{fmpq_mpoly}}; context::Nothing)
    @ Oscar ~/Projekte/OSCAR/Oscar.spielwiese/src/Rings/mpoly.jl:491
 [10] show_via_expressify(io::IOContext{Base.TTY}, mi::MIME{Symbol("text/plain")}, obj::Any; context::Nothing)
    @ AbstractAlgebra.PrettyPrinting ~/Projekte/OSCAR/AbstractAlgebra.jl/src/PrettyPrinting.jl:78
 [11] show_via_expressify
    @ ~/Projekte/OSCAR/AbstractAlgebra.jl/src/PrettyPrinting.jl:78 [inlined]
 [12] show(io::IOContext{Base.TTY}, mi::MIME{Symbol("text/plain")}, x::MPolyIdeal{AbstractAlgebra.Generic.MPoly{fmpq_mpoly}})
...

@HechtiDerLachs
Copy link
Collaborator Author

That's weird. Because where the error originally occurred, I didn't have any printing going on. Either way: It tries to print from a Singular polynomial, which is probably not the correct thing to do.

@thofma
Copy link
Collaborator

thofma commented Feb 8, 2022

No, it is not trying to print a Singular polynomial. The problem is that the print function tries to iterate over I.gens, which tries to call some conversion function. It is another manifestation from the current singular_ring design limitations and bugs, see #975, #976.

@YueRen
Copy link
Member

YueRen commented Apr 5, 2023

@HechtiDerLachs I don't get this error anymore in the newest Oscar. Can we close the issue?

julia> R, (x,y) = QQ["x", "y"]
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])

julia> S, (u,v) = R["u", "v"]
(Multivariate Polynomial Ring in u, v over Multivariate Polynomial Ring in x, y over Rational Field, AbstractAlgebra.Generic.MPoly{fmpq_mpoly}[u, v])                                                                                             

julia> I = ideal(S, [u]) + ideal(S, [v])
ideal(u, v)

@HechtiDerLachs
Copy link
Collaborator Author

If this error doesn't persist, we can close it, yes.

@YueRen
Copy link
Member

YueRen commented Apr 6, 2023

Then I will close the issue. The Oscar <-> Singular interface is not perfect (yet), but this is an issue it doesn't have (anymore).

@YueRen YueRen closed this as completed Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants