Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Oscar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,19 @@ function __init__()
Pkg.is_manifest_current(dirname(Base.active_project())))
@warn "Project dependencies might have changed, please run `]up` or `]resolve`."
end

# Temporary workaround to allow access to Singular's tropicalVariety command
# see https://github.com/oscar-system/Oscar.jl/issues/5392
# see TropicalGeometry/variety_prime.jl
Singular.libSingular.load_library("tropical.lib")
Singular.call_interpreter("""
proc tropicalVariety_as_string(ideal I, list #) {
if(size(#)==0) {
return(string(tropicalVariety(I)));
};
return(string(tropicalVariety(I,number(#[1]))));
}
""")
end

const PROJECT_TOML = Pkg.TOML.parsefile(joinpath(@__DIR__, "..", "Project.toml"))
Expand Down
24 changes: 6 additions & 18 deletions src/TropicalGeometry/variety_prime.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,9 @@ function tropical_variety_prime(I::MPolyIdeal, nu::TropicalSemiringMap; weighted
end

# trivial valuation
function tropical_variety_prime_singular(I::MPolyIdeal, nu::TropicalSemiringMap{QQField,Nothing,<:Union{typeof(min),typeof(max)}}; weighted_polyhedral_complex_only::Bool=false)
R = base_ring(I)
singularCommand = join(["ring r=0,("*join(string.(symbols(R)),",")*"),dp;",
"ideal I = "*join(string.(gens(I)), ",")*";",
"if (!defined(tropicalVariety)) { LIB \"tropical.lib\"; };",
"fan TropI = tropicalVariety(I);",
"string TropIString = string(TropI);"])
Singular.call_interpreter(singularCommand)
TropIString = Singular.lookup_library_symbol("Top", "TropIString")
function tropical_variety_prime_singular(I::MPolyIdeal, nu::TropicalSemiringMap{QQField,Nothing}; weighted_polyhedral_complex_only::Bool=false)
sI = Oscar.singular_generators(I)
TropIString = Singular.low_level_caller("tropical", "tropicalVariety_as_string", (sI, ))
Sigma = gfan_fan_string_to_oscar_complex(TropIString,convention(nu)==max,false)
TropI = compute_weights_and_construct_tropical_variety(Sigma,I,nu)
if !weighted_polyhedral_complex_only
Expand All @@ -39,15 +33,9 @@ function tropical_variety_prime_singular(I::MPolyIdeal, nu::TropicalSemiringMap{
end

# p-adic valuation
function tropical_variety_prime_singular(I::MPolyIdeal, nu::TropicalSemiringMap{QQField,ZZRingElem,<:Union{typeof(min),typeof(max)}}; weighted_polyhedral_complex_only::Bool=false)
R = base_ring(I)
singularCommand = join(["ring r=0,("*join(string.(symbols(R)),",")*"),dp;",
"ideal I = "*join(string.(gens(I)), ",")*";",
"if (!defined(tropicalVariety)) { LIB \"tropical.lib\"; };",
"fan TropI = tropicalVariety(I,number("*string(uniformizer(nu))*"));",
"string TropIString = string(TropI);"])
Singular.call_interpreter(singularCommand)
TropIString = Singular.lookup_library_symbol("Top", "TropIString")
function tropical_variety_prime_singular(I::MPolyIdeal, nu::TropicalSemiringMap{QQField,ZZRingElem}; weighted_polyhedral_complex_only::Bool=false)
sI = Oscar.singular_generators(I)
TropIString = Singular.low_level_caller("tropical", "tropicalVariety_as_string", (sI, Int(uniformizer_ring(nu))))
Sigma = gfan_fan_string_to_oscar_complex(TropIString,convention(nu)==max,true)
TropI = compute_weights_and_construct_tropical_variety(Sigma,I,nu)
if !weighted_polyhedral_complex_only
Expand Down
6 changes: 6 additions & 0 deletions test/TropicalGeometry/variety.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,11 @@
@test f_vector(TropV) == [1,3]

# general ideals, see doctests
I = grassmann_pluecker_ideal(2, 5)
nu = tropical_semiring_map(QQ, 3)
TropI = tropical_variety(I; skip_saturation=true, skip_decomposition=true)
@test f_vector(TropI) == [0, 0, 0, 0, 0, 1, 10, 15]
TropI = tropical_variety(I,nu; skip_saturation=true, skip_decomposition=true)
@test f_vector(TropI) == [0, 0, 0, 0, 0, 1, 10, 15]
end
end
Loading