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 26, 2024
1 parent 5076ad2 commit 815f504
Show file tree
Hide file tree
Showing 5 changed files with 533 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Oscar = "f1435218-dba5-11e9-1e4d-f1a5fab5fc13"

[compat]
Documenter = "1.1"
Expand Down
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
12 changes: 8 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 Expand Up @@ -794,6 +797,7 @@ function oscar_assure(B::BiPolyArray)
else
R = B.Ox
end
#B.O = [preimage(B.f, x) for x = gens(B.S)]
B.O = [R(x) for x = gens(B.S)]
end
end
Expand Down
Loading

0 comments on commit 815f504

Please sign in to comment.