Skip to content
Open
Show file tree
Hide file tree
Changes from 6 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
5 changes: 5 additions & 0 deletions src/Oscar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ 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
Singular.libSingular.load_library("tropical.lib")
Singular.call_interpreter("proc tropicalVariety_as_string(ideal I) { return(string(tropicalVariety(I))); }")
end

const PROJECT_TOML = Pkg.TOML.parsefile(joinpath(@__DIR__, "..", "Project.toml"))
Expand Down
1 change: 0 additions & 1 deletion src/TropicalGeometry/variety.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ julia> vertices(TropI_3)
```
"""
function tropical_variety(I::MPolyIdeal, nu::TropicalSemiringMap=tropical_semiring_map(coefficient_ring(I)); weighted_polyhedral_complex_only::Bool=false, skip_saturation::Bool=false, skip_decomposition::Bool=false)

if !skip_saturation
###
# If saturation requested, saturate `I`
Expand Down
22 changes: 13 additions & 9 deletions src/TropicalGeometry/variety_prime.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ function tropical_variety_prime(I::MPolyIdeal, nu::TropicalSemiringMap; weighted
return dehomogenize_post_tropicalization(TropIh)
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")

name = "tropicalVariety_as_string"
sI = Oscar.singular_generators(I)
arguments = Any[ Singular.prepare_argument(sI)[1] ]
return_value = Singular.libSingular.call_singular_library_procedure(name, base_ring(sI).ptr, arguments);
if Singular.libSingular.have_error()
error(Singular.libSingular.get_and_clear_error())
end
TropIString = Singular.convert_return(return_value, ring)

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 @@ -40,6 +43,8 @@ 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)
phi = hom_rename_variables_singular_compatible(base_ring(I))
I = phi(I)
R = base_ring(I)
singularCommand = join(["ring r=0,("*join(string.(symbols(R)),",")*"),dp;",
"ideal I = "*join(string.(gens(I)), ",")*";",
Expand Down Expand Up @@ -121,7 +126,6 @@ function gfan_fan_string_to_oscar_complex(input_string::String, negateFan::Bool=
coneIncidences = [ vcat(incidence,[originIndex]) for incidence in coneIncidences ]
return polyhedral_complex(IncidenceMatrix(coneIncidences), rayGenerators, rayIndices, linealityGenerators)
end

end


Expand Down
3 changes: 3 additions & 0 deletions test/TropicalGeometry/variety.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,8 @@
@test f_vector(TropV) == [1,3]

# general ideals, see doctests
I = grassmann_pluecker_ideal(2, 5)
TropI = tropical_variety(I)
@test f_vector(TropI) == [0, 0, 0, 0, 0, 1, 10, 15]
end
end
Loading