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

Tropical variety overhaul #4061

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
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
7 changes: 6 additions & 1 deletion src/TropicalGeometry/TropicalGeometry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@ include("semiring.jl")
include("semiring_map.jl")
include("matrix.jl")
include("poly.jl")
include("variety_supertype.jl")
include("homogenization.jl")
include("groebner_basis.jl")
include("initial.jl")
# include("groebner_polyhedron.jl")
# include("points.jl")
include("variety_supertype.jl")
include("hypersurface.jl")
include("curve.jl")
include("linear_space.jl")
include("variety.jl")
include("variety_binomial.jl")
include("variety_principal.jl")
include("variety_affine_linear.jl")
include("variety_zerodimensional.jl")
include("variety_prime.jl")
include("intersection.jl")
include("groebner_fan.jl")
24 changes: 15 additions & 9 deletions src/TropicalGeometry/homogenization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ function homogenize_pre_tropicalization(I::MPolyIdeal)
end


function dehomogenize_post_tropicalization(Sigma::PolyhedralComplex)
@req lineality_dim(Sigma)>0 "dehomogenizing polyhedral complex without lineality"
function dehomogenize_post_tropicalization(TropV::TropicalVarietySupertype)

@req lineality_dim(TropV)>0 "dehomogenizing polyhedral complex without lineality"

###
# Construct hyperplane {first coord = 0}
###
n = ambient_dim(Sigma)
n = ambient_dim(TropV)
zerothUnitRowVector = zeros(Int,1,n)
zerothUnitRowVector[1,1] = 1
dehomogenisingHyperplane = polyhedron((zeros(Int,0,n),zeros(Int,0)), (zerothUnitRowVector,[0]))
Expand All @@ -52,7 +53,7 @@ function dehomogenize_post_tropicalization(Sigma::PolyhedralComplex)
dehomogenizedVertices = Vector{QQFieldElem}[]
incidenceMatrixRays = Vector{Int}[]
dehomogenizedRays = Vector{QQFieldElem}[]
for sigma in maximal_polyhedra(Sigma)
for sigma in maximal_polyhedra(TropV)
sigmaDehomogenized = intersect(sigma,dehomogenisingHyperplane)
incidenceVectorVertices = Int[]
V,_ = minimal_faces(sigmaDehomogenized)
Expand Down Expand Up @@ -95,12 +96,17 @@ function dehomogenize_post_tropicalization(Sigma::PolyhedralComplex)
###
# Dehomogenize lineality space
###
sigma = first(maximal_polyhedra(Sigma))
sigma = first(maximal_polyhedra(TropV))
sigmaDehomogenized = intersect(sigma,dehomogenisingHyperplane)
dehomogenizedLineality = [linealityVector[2:end] for linealityVector in lineality_space(sigmaDehomogenized)]

return polyhedral_complex(incidenceMatrixVerticesAndRays,
dehomogenizedVerticesAndRays,
collect(length(dehomogenizedVertices)+1:length(dehomogenizedVertices)+length(dehomogenizedRays)),
dehomogenizedLineality)
SigmaDehom = polyhedral_complex(incidenceMatrixVerticesAndRays,
dehomogenizedVerticesAndRays,
collect(length(dehomogenizedVertices)+1:length(dehomogenizedVertices)+length(dehomogenizedRays)),
dehomogenizedLineality)

TropVDehom = tropical_variety(SigmaDehom,multiplicities(TropV),convention(TropV))
# TropVDehom.__attrs = deepcopy(TropV.__attrs) # TODO: not working, how to copy all attributes?
return TropVDehom

end
Loading
Loading