oscar-system / Oscar.jl

A comprehensive open source computer algebra system for computations in algebra, geometry, and number theory.
https://www.oscar-system.org
Other
343 stars 126 forks source link

Extract KS polytopes from polyDB and turn it into (Fano?) toric variety #3974

Open HereAround opened 3 months ago

HereAround commented 3 months ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context about the feature request here.

benlorenz commented 3 months ago

Some code for the database access:

julia> db = Polymake.Polydb.get_db();

julia> collection = db["Polytopes.Lattice.Reflexive"]
Polymake.Polydb.Collection{Polymake.LibPolymake.BigObject}: Polytopes.Lattice.Reflexive

julia> query = Dict("_id"=>"v10-002900002")
Dict{String, String} with 1 entry:
  "_id" => "v10-002900002"

julia> polytope = Polymake.Polydb.find_one(collection, query)
name: v10-002900002
type: Polytope<Rational>
...

julia> Polymake.get_attachment(polytope,"H_11")
22

julia> Polymake.get_attachment(polytope,"H_12")
28

julia> Polymake.get_attachment(polytope,"EULER_CHARACTERISTIC")
-12

julia> ntv = normal_toric_variety(polyhedron(polytope))
Normal toric variety

It is also possible to query by some properties:

julia> query = Dict("H_11"=>22);

julia> curs = Polymake.Polydb.find(collection, query);

julia> for xx in curs
       println(Polymake.getname(xx),": H_12=",Polymake.get_attachment(xx,"H_12"))
       end
v05-000000915: H_12=34
v05-000000917: H_12=34
v05-000000918: H_12=34
v05-000000921: H_12=34
v05-000000923: H_12=34
v05-000000924: H_12=34
v05-000000927: H_12=34
v05-000000929: H_12=46
v05-000000930: H_12=46
v05-000000933: H_12=46
v05-000000935: H_12=58
...

Querying should work for most of the properties from this list:

julia> Polymake.Polydb.get_fields(collection)
35-element Vector{String}:
 "ALTSHULER_DET"
 "BALANCED"
 "CENTROID"
 "CONE_DIM"
 "DIAMETER"
 "DIM"
 "EHRHART_POLYNOMIAL"
 "EULER_CHARACTERISTIC"
 "F_VECTOR"
 "FACET_SIZES"
 "FACET_WIDTHS"
 "FACETS"
 "H_11"
 "H_12"
 "H_STAR_VECTOR"
 "LATTICE_DEGREE"
 "LATTICE_VOLUME"
 "N_BOUNDARY_LATTICE_POINTS"
 "N_FACETS"
 "N_EDGES"
 "N_HILBERT_BASIS"
 "N_LATTICE_POINTS"
 "N_RIDGES"
 "N_VERTICES"
 "NORMAL"
 "REFLEXIVE"
 "POLAR_SMOOTH"
 "SELF_DUAL"
 "SIMPLE"
 "SIMPLICIAL"
 "SMOOTH"
 "TERMINAL"
 "VERTEX_SIZES"
 "VERTICES"
 "VERY_AMPLE"

(at least where it makes sense, since querying for a matrix is not really practial)