Skip to content

Commit

Permalink
feat: add iso_oscar_singular_*
Browse files Browse the repository at this point in the history
- use it in some places
  • Loading branch information
thofma committed Nov 23, 2024
1 parent 5076ad2 commit ec537de
Show file tree
Hide file tree
Showing 4 changed files with 453 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Rings/Rings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ include("groebner/groebner.jl")
include("solving.jl")
include("MPolyQuo.jl")
include("FractionalIdeal.jl")
include("oscar_singular.jl")

include("special_ideals.jl")

Expand Down
11 changes: 7 additions & 4 deletions src/Rings/mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ mutable struct BiPolyArray{S}
Ox::NCRing #Oscar Poly Ring or Algebra
O::Vector{S}
Sx # Singular Poly Ring or Algebra, poss. with different ordering
f #= isomorphism Ox -> Sx =#
S::Singular.sideal

function BiPolyArray(O::Vector{T}) where {T <: NCRingElem}
Expand Down Expand Up @@ -381,7 +382,8 @@ function singular_generators(B::IdealGens, monorder::MonomialOrdering=default_or
# in case of quotient rings, monomial ordering is ignored so far in singular_poly_ring
isa(B.gens.Ox, MPolyQuoRing) && return B.gens.S
isdefined(B, :ord) && B.ord == monorder && monomial_ordering(B.Ox, Singular.ordering(base_ring(B.S))) == B.ord && return B.gens.S
SR = singular_poly_ring(B.Ox, monorder)
g = iso_oscar_singular_poly_ring(B.Ox, monorder)
SR = codomain(g)
f = Singular.AlgebraHomomorphism(B.Sx, SR, gens(SR))
S = Singular.map_ideal(f, B.gens.S)
if isdefined(B, :ord) && B.ord == monorder
Expand Down Expand Up @@ -481,7 +483,6 @@ for T in [:MPolyRing, :(AbstractAlgebra.Generic.MPolyRing)]
end
end


#Note: Singular crashes if it gets Nemo.ZZ instead of Singular.ZZ ((Coeffs(17)) instead of (ZZ))
singular_coeff_ring(::ZZRing) = Singular.Integers()
singular_coeff_ring(::QQField) = Singular.Rationals()
Expand Down Expand Up @@ -746,8 +747,10 @@ end

function singular_assure(I::IdealGens)
if !isdefined(I.gens, :S)
I.gens.Sx = singular_poly_ring(I.Ox; keep_ordering = I.keep_ordering)
I.gens.S = Singular.Ideal(I.Sx, elem_type(I.Sx)[I.Sx(x) for x = I.O])
g = iso_oscar_singular_poly_ring(I.Ox; keep_ordering = I.keep_ordering)
I.gens.Sx = codomain(g)
I.gens.f = g
I.gens.S = Singular.Ideal(I.gens.Sx, elem_type(I.gens.Sx)[g(x) for x = I.gens.O])
end
if I.isGB && (!isdefined(I, :ord) || I.ord == monomial_ordering(I.gens.Ox, internal_ordering(I.gens.Sx)))
I.gens.S.isGB = true
Expand Down
Loading

0 comments on commit ec537de

Please sign in to comment.